Skip to content

fix(light): keep the last state when a light reports an unknown WHAT - #456

Merged
GreenGrassBlueOcean merged 2 commits into
OpenWebNet-HA:v2-phase1-architecturefrom
GreenGrassBlueOcean:fix/light-unknown-what
Sep 24, 2026
Merged

GreenGrassBlueOcean merged 2 commits into
OpenWebNet-HA:v2-phase1-architecturefrom
GreenGrassBlueOcean:fix/light-unknown-what

Conversation

@GreenGrassBlueOcean

@GreenGrassBlueOcean GreenGrassBlueOcean commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

An MH200 actuator at 74 (not a configured light) answers *#1*74## with *1*19*74## plus a WHO 1001 DIMENSION 11 autodiagnostic fault mask (*#1001*74*11*111110111111111111110111##). WHAT 19 isn't in the WHO 1 WHAT table, but OWNd reported it as on. So light.light_74 stayed on, and turning it off made the device answer 19 again and the entity flipped back.

Change

  • OWNd fix: fix(message): treat lighting WHATs outside the WHO 1 table as unknown OWNd#59 makes is_on None for WHATs outside the table and adds unknown_state.
  • handle_event already ignored is_on is None, so the light keeps its last state. On top of that, the light now:
    • exposes the value as an unknown_state attribute, cleared by the next known on/off state
    • logs one warning per value (light 74 reports unknown lighting WHAT 19; keeping its last state)
  • unknown_state is read with getattr + isinstance(int), so the pinned OWNd==2.0.0b8 still works.

Behaviour change: with OWNd#59, lighting WHATs 32/33 and 39+ also become unknown, so a light that receives one now keeps its last state instead of turning off.

Tests

tests/test_component_light.py:

Full suite: 2008 passed against the released OWNd and 2015 passed against OWNd#59; ruff and mypy on light.py are clean.

Checklist

  • V2 Architecture: New entities implement handle_event() and do not manually subscribe via async_dispatcher_connect. (No new entities.)

Follow-up

Home Assistant only gets the fix once OWNd#59 is released and the manifest pin is bumped. At that point the strict xfail will start failing, and its marker should be removed.

🤖 Generated with Claude Code

An MH200 actuator at 74 answers *#1*74## with *1*19*74## and a WHO 1001
DIMENSION 11 autodiagnostic mask. WHAT 19 is not in the WHO 1 table, but
OWNd reported it as on, so light.light_74 kept flipping back on.

The OWNd fix makes is_on None and exposes the raw value as unknown_state.
handle_event already ignores is_on None; the light now also shows the
value as an unknown_state attribute, cleared by the next known state, and
warns once per value.

The live-frame test is a strict xfail while the installed OWNd still
reports WHAT 19 as on.

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!

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GreenGrassBlueOcean
GreenGrassBlueOcean merged commit 60dbeba into OpenWebNet-HA:v2-phase1-architecture Sep 24, 2026
16 checks passed
@GreenGrassBlueOcean
GreenGrassBlueOcean deleted the fix/light-unknown-what branch September 24, 2026 16:32
GreenGrassBlueOcean added a commit that referenced this pull request Sep 24, 2026
Live on the MH200 with the #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>
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