Skip to content

fix(dmx-driver): retry opening the DMX adapter and publish its state (#1547) - #1945

Merged
groupsky merged 5 commits into
masterfrom
fix/1547-dmx-open-retry
Nov 11, 2026
Merged

groupsky merged 5 commits into
masterfrom
fix/1547-dmx-open-retry

Conversation

@groupsky

@groupsky groupsky commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Refs #1547

dmx-driver opened the DMX adapter at module load with no retry. When the adapter could not be opened, the process exited and crash-looped for good.

What changes

  • New docker/dmx-driver/universe.js: opens the adapter in the background. On failure it logs the error and retries after 1 s, 2 s, 4 s … at most every 60 s. It has the same set() as the native universe, so the message handler is unchanged. The latest frame received while the adapter is closed is written when it opens.
  • index.js publishes the adapter state, retained, on STATUS_TOPIC (default homy/dmx-driver/status): opening, online or offline with the error. The MQTT last will sets offline if the service dies.

Choices

  • MQTT state, not a Docker healthcheck. A dead adapter is a hardware fault. An unhealthy container would make the deploy health gate roll back unrelated changes. A retained topic is visible without logs and anything (HA, Grafana) can use it later.
  • Limit: the native dmx addon ignores write errors in its update thread. If the adapter goes silent after it was opened while staying on the USB bus, the state stays online. Fixing that needs a change in the addon fork; it is written in docker/dmx-driver/CLAUDE.md.

Progress

  • new DMX() is wrapped so an open failure is logged and retried with backoff instead of exiting — universe.js
  • A failure to open the device is visible without reading container logs — retained state on homy/dmx-driver/status
  • A transient adapter blip recovers on its own once the device returns, with no manual restart — retry loop, test "recovers once the adapter returns"
  • There is a test covering the open-failure path — universe.test.js
  • Review, green CI

…1547)

new DMX() threw at module load when the adapter could not be opened, and the
service crash-looped. The open now runs in the background with a 1 s to 60 s
backoff, and the adapter state is published retained on STATUS_TOPIC.
@groupsky
groupsky marked this pull request as ready for review November 11, 2026 04:43
@groupsky
groupsky merged commit c8d9fda into master Nov 11, 2026
27 checks passed
@groupsky
groupsky deleted the fix/1547-dmx-open-retry branch November 11, 2026 04:48
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