Skip to content

fix(light): an unknown WHAT does not keep a state restored at startup - #458

Merged
GreenGrassBlueOcean merged 1 commit into
OpenWebNet-HA:v2-phase1-architecturefrom
GreenGrassBlueOcean:fix/light-unknown-after-restore
Sep 24, 2026
Merged

GreenGrassBlueOcean merged 1 commit into
OpenWebNet-HA:v2-phase1-architecturefrom
GreenGrassBlueOcean:fix/light-unknown-after-restore

Conversation

@GreenGrassBlueOcean

Copy link
Copy Markdown
Contributor

Follow-up to #456, found live on the MH200 with a test build (MyHOME v2-phase1-architecture + OWNd#59/#60).

Problem

light.light_74 still showed on. Since the restart, the bus only sent:

17:16:33.475 rx *1*19*74##
17:16:33.519 rx *#1001*74*11*111110111111111111110111##

At startup Home Assistant restored "on", which was the state the WHAT 19 bug had left behind. #456 keeps the last state when an unknown WHAT arrives, so that stale "on" was kept forever.

Change

  • A state seen on the bus or set from Home Assistant is still kept against an unknown WHAT, as before.
  • A state that was only restored at startup becomes unknown on the first fault report. The warning then says its state is unknown instead of keeping its last state.
  • _is_on_restored is set where async_restore_last_state restores on/off. It is cleared wherever a real state is set: bus events, _apply_brightness_state, timed on, and the color-temperature turn-on.

Tests

tests/test_component_light.py:

  • a restored "on", then a fault: the state becomes unknown and the warning says so; a later bus "off" is kept against the next fault
  • a state set from HA (timed on) is kept against a fault
  • the live frames from today (*1*19*74## after a restored "on"): a strict xfail while the installed OWNd reports WHAT 19 as on

Results: 2047 passed and 17 xfailed on the pinned OWNd; 2064 passed against OWNd#59 + #60. ruff and mypy --strict on light.py are clean.

🤖 Generated with Claude Code

Live on the MH200 with the OpenWebNet-HA#456 test build: light.light_74 came back
"on" from the state the WHAT 19 bug had left, and since the bus only
ever answers *1*19*74## (+ a WHO 1001 fault mask), "keep the last
state" kept that stale "on" forever.

A state seen on the bus or set from Home Assistant is still kept
against an unknown WHAT; one that was only restored at startup now
becomes unknown on the first fault report, and the warning says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@GreenGrassBlueOcean
GreenGrassBlueOcean merged commit 57cfd41 into OpenWebNet-HA:v2-phase1-architecture Sep 24, 2026
16 checks passed
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.

2 participants