Skip to content

Add device-control commands to the CLI (setpoint, mode, hold, resume schedule)#7

Open
jgordner wants to merge 1 commit into
dlenski:mainfrom
jgordner:add-device-control
Open

Add device-control commands to the CLI (setpoint, mode, hold, resume schedule)#7
jgordner wants to merge 1 commit into
dlenski:mainfrom
jgordner:add-device-control

Conversation

@jgordner

Copy link
Copy Markdown

The README notes that setpoint/schedule control "should be pretty easy to add to the CLI as well." This wires the msg:44 command (already documented in mysa_messages.md) into mysotherm so the CLI can control thermostats, not just inspect them.

New options (all require an explicit --device list):

Option Sends Effect
--set-point TEMP (-F/--fahrenheit) {sp, tm:-1} Set target temp; holds until the next scheduled change (mirrors the app)
--mode {off,on,floor,ambient} {md[, tr]} Set mode; floor/ambient handle the INF-V1-0 tracked sensor
--resume-schedule {ho:1, tm:-1} Clear a manual hold, follow the schedule
--hold {ho:2, tm:-1} Hold indefinitely, until explicitly changed
--hold-until UNIXTIME {ho:1, tm:T} Hold until a time, then auto-resume the schedule

Each command is published to the device's /in topic, then the tool waits for the device's msg:44 acknowledgement (matched by resp_id) and exits 0 only if every targeted device acked — so it's safe to use from scripts/automations. The per-model command type code is selected automatically, so mixed fleets (baseboard / floor / V2 / V2 Lite) work in one invocation.

Reusable helpers (COMMAND_TYPE_BY_MODEL, command_body_for_model, make_command) live in mysa_stuff.py.

Tested live against BB-V2-0 and INF-V1-0 devices: setpoint, indefinite hold, and resume-schedule round-trip all confirmed (and the on-device ScheduleMode flag flips 1↔2 as expected).

The README noted that setpoint/schedule control "should be pretty easy to
add"; this wires the documented msg:44 command into the `mysotherm` CLI:

  --set-point TEMP [-F/--fahrenheit]   set target temperature
  --mode {off,on,floor,ambient}        set operating mode (handles the INF
                                       floor tracked-sensor variants)
  --resume-schedule                    clear a manual hold, follow the schedule
  --hold                               hold indefinitely (until changed)
  --hold-until UNIXTIME                hold until a time, then resume schedule
  --command-timeout SECS               ack wait (default: 30)

Each control option publishes a msg:44 command to the device's /in topic,
waits for the device's msg:44 acknowledgement (matched by resp_id), and exits
0 only if every --device acknowledged -- so it is scriptable. The per-model
command `type` code is selected automatically, so mixed fleets (baseboard,
floor, V2, V2 Lite) work. Control commands require an explicit --device list.

Reusable helpers (COMMAND_TYPE_BY_MODEL, command_body_for_model, make_command)
live in mysa_stuff.py. A bare --set-point mirrors the app (the setpoint holds
only until the next scheduled change); --hold / --hold-until make it persist.

Tested live against BB-V2-0 and INF-V1-0 devices.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant