Skip to content

fix(sensor): dynamic discovery for WHO 1 light/motion sensors and ghost light prevention (#244) - #245

Merged
GreenGrassBlueOcean merged 1 commit into
v2-phase1-architecturefrom
feat/244-who1-sensor-discovery
Sep 9, 2026
Merged

fix(sensor): dynamic discovery for WHO 1 light/motion sensors and ghost light prevention (#244)#245
GreenGrassBlueOcean merged 1 commit into
v2-phase1-architecturefrom
feat/244-who1-sensor-discovery

Conversation

@GreenGrassBlueOcean

Copy link
Copy Markdown
Contributor

Summary

Fixes #244.
Follow-up to feedback from @anotherjulien on #232 (comment).

Legrand 048834 / WHO 1 motion & illuminance sensors broadcast under WHO=1 (Lighting). Previously, frames from these devices were treated as lighting telegrams, causing them to be discovered as ghost light entities sharing the same A/PL address. Furthermore, motion frames (WHAT = 34) and illuminance dimension messages (DIMENSION = 6) were not properly interpreted.

Changes Made

  1. OWNLightingEvent Classification (ownd/message.py):

    • Added is_sensor property identifying motion (WHAT=34), illuminance (DIMENSION=6), sensitivity (DIMENSION=5), and timeout (DIMENSION=7) frames.
    • Updated is_on to ensure sensor messages (WHAT=34) do not evaluate as light ON.
    • Maintained strict _NONCE pattern (\d{5,}) to avoid colliding with *#5## and *#9##.
  2. Light Entity Filtering & Registry Purge (light.py):

    • Track known WHO 1 sensor addresses across configured entities, restored entity registry entries, and incoming sensor runtime telegrams.
    • Automatically unregister and suppress ghost light entities when WHO 1 sensor activity is detected on their address.
  3. Motion Sensor Discovery & Routing (binary_sensor.py):

    • Automatically discovers MyHOMEMotionSensor for WHO 1 on *1*34*WHERE##.
    • Restores WHO 1 motion sensors from the entity registry on startup.
    • Safely dispatches motion events without race conditions or entity unmount exceptions.
  4. Illuminance Sensor Integration (sensor.py):

    • Integrated MyHOMEIlluminanceSensor into the Phase 1 sensor architecture.
    • Restores illuminance sensors from the entity registry on startup.
    • Discovers new illuminance sensors dynamically upon receiving illuminance dimension frames (*#1*WHERE*6*LUX##).
  5. Test Coverage:

    • Achieved 100% statement and branch coverage across all modified files and the entire codebase (6,368 / 6,368 statements covered, 800 tests passing).

@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 03c9ac6 into v2-phase1-architecture Sep 9, 2026
8 checks passed
@GreenGrassBlueOcean
GreenGrassBlueOcean deleted the feat/244-who1-sensor-discovery branch September 9, 2026 15:32
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