Skip to content

feat: add dimmer_set subcommand (API 2.0) #40

Description

@chicks-net

What exists already

  • locatorCommands (main.go:88) maps subcommand names to wire bytes, but has no
    dimmer entry
  • sendCommand sends fixed 3-byte mode commands; sendSetCommand sends the
    6-byte SetTimer struct — neither fits a 1-byte-payload command

What's missing

Per TimeMachinesCorp Locator Protocol API v2.0
section 1.4.4, Dimmer Set is:

Byte Description
0 Command byte: 0xB5
1 Digit Brightness: 0-100

There is no CLI subcommand to send it.

Proposed subcommand

  • ctm dimmer_set <level> <clock_ip> → sends \xb5 + one brightness byte

Example:

ctm dimmer_set 50 192.168.42.204   # sends \xb5\x32, expects ACK

Notes / constraints

  • API v2.0-only feature; the clock must return a 40-byte status response to be
    v2.0, though the command itself just needs an ACK.
  • Volatile: the dimmer level is not saved to non-volatile memory — it is
    lost on reboot or until changed. Worth noting in --help text.
  • Needs a small send helper for a command byte + 1 payload byte (or a
    generalized payload-send function that sendSetCommand can share).
  • Brightness must be validated to 0-100.

Acceptance Criteria

  • locatorCommands["dimmer_set"] = "\xb5" entry added and pinned in main_test.go
  • ctm dimmer_set 50 <ip> sends \xb5\x32 and receives ACK
  • levels outside 0-100 are rejected with a clear error
  • dispatch test via newCommandTree with fakeConn verifying wire bytes
  • README.md and CLAUDE.md subcommand lists updated (remove from "coming soon")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions