MQTT support with Home Assistant discovery (optional)#6
Merged
Conversation
Publishes controller status to MQTT and accepts commands, so the R730's fan state appears in Home Assistant as a self-registered device. Off by default; zero behavior change when disabled. - New internal/mqtt bridge (paho) consuming the same controller methods the HTTP API uses (GetStatus/SetOverride/ClearOverride/AddHint/ RemoveHint), so MQTT commands inherit all safety rules: min/max clamping, 24h override cap, critical-temp ramp override, hint validation. The controller package stays MQTT-unaware. - MQTT Discovery: one HA device with 11 entities (6 sensors, 3 binary sensors, an override-speed number bounded to min/max, a clear-override button), retained config republished on every (re)connect. - Per-tick retained state JSON on monitoring.interval; availability topic with Last Will so HA marks the device unavailable the instant the process dies. - Command topics (override/clear/hint, QoS 1) validated by a shared internal/validate package extracted from the HTTP layer so both enforce identical rules. Retained command messages are dropped (logged once per topic) to avoid stale commands replaying on reconnect. - A hung or unreachable broker can never block the control loop or delay the shutdown restore(): connect is fire-and-forget, publish/subscribe/ stop are bounded, and bridge teardown is sequenced after the BMC hand-back with a 3s bound. - Config: mqtt section (default off, broker required when enabled, password json:"-", env overrides); README HA section; Unraid template MQTT fields; config.example.yaml documents the block and validates verbatim. Design + plan: docs/superpowers/specs and docs/superpowers/plans. Task: dex e6fla2yl - MQTT / Home Assistant support Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sethpjohnson
changed the base branch from
claude/followups-review-mediums
to
main
July 17, 2026 21:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #5 (→ #4 → #3 → #2 → #1) — the sixth and final PR in the stack; merge in order. Off by default: setting nothing changes existing behavior.
Publishes controller status to MQTT and accepts commands, so the R730's fan state appears in Home Assistant as a self-registered device with full control parity.
internal/mqtt, paho) consuming the same controller methods the HTTP API uses — so MQTT commands inherit every safety rule from the earlier tiers: min/max clamping, 24h override cap, critical-temp ramp override, hint validation. The controller package stays MQTT-unaware.internal/validateextracted from the HTTP layer (verified byte-for-byte lossless) so HTTP and MQTT enforce identical rules. Retained command messages are dropped (logged once/topic) so a straymosquitto_pub -rcan't replay a stale command on every restart.Review & verification
go vet+go test -raceclean across all 8 packages; integration test drives a real paho client against a real in-process mochi broker (connect→discovery→command→state→LWT + retained-drop), stable across repeated runs.f5u9g234(topic charset validation, shared WorkloadHint constructor, Subscribe-timeout retry).Task: dex e6fla2yl — MQTT / Home Assistant support
🤖 Generated with Claude Code