Skip to content

Firmware: accept enabled:false to support remote disable #19

Description

@TalkingJupiter

Context

docs/mqtt-contract.md §4 defines enabled: false as a valid, applied config that means "provisioned but stay silent" — the remote on/off lever (e.g. to quiet a device during an OTA). The current firmware does the opposite: RuntimeConfig::isValid() returns false when !enabled, so a disabled config is rejected and never applied. The device therefore keeps its previous enabled: true state and cannot be turned off remotely — the dead end noted earlier in this work.

Conflict to resolve

This directly contradicts open issue #6, which lists enabled among fields that must be required/validated (i.e. keeps rejecting enabled: false). The contract supersedes that assumption. #6 should be updated or closed as part of this — its premise (require topic fields + enabled in config) no longer matches the design.

Scope

Make enabled: false an accepted, applied config; keep telemetry gated so a disabled device stays silent.

Implementation notes

  • isValid() must stop treating !enabled as invalid (it still requires configured, mac, rack_id, role).
  • The telemetry send path already gates on config_.enabled (two separate guards in sendMQTT), so once a disabled config is applied, transmission stops correctly — the only change is letting it be applied.
  • Confirm the hello loop stays gated on !configured only, so a disabled-but-configured device does not resume announcing.

Acceptance criteria

  • A config with enabled: false is accepted and applied; the device stops publishing telemetry but remains connected and subscribed.
  • A later enabled: true config re-enables transmission.
  • Matches docs/mqtt-contract.md §4 and §10.

Relates to #6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions