Repository navigation
fix(lighting): WHAT 39 is the end of movement of a WHO 1 motion detector - #135
Merged
Merged
Conversation
A WHO 1 motion detector (Legrand 067226, BTicino 048834) reports *1*34*WHERE## when it detects movement and *1*39*WHERE## when its occupancy timer runs out. The F461 bt_luci translator decodes the SCS presence status frame (class 0x1D) value 00 as WHAT 34 and value 01 as WHAT 39 (oracle2/hex2own_corpus.tsv rows B8311D00 / B8311D01). OWNd only knew WHAT 34, so WHAT 39 was an unknown lighting WHAT and a light sharing the sensor's address logged a warning on every end of movement (OpenWebNet-HA/MyHOME#777). WHAT 39 now sets message_type motion_detected with motion False, a new motion_end property, is_sensor True and is_on None. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Audit follow-up to the WHAT 39 commit: - Evidence is now stated by strength: specified in the ZigBee OpenWebNet WHO 1 table, observed on SCS in the MyHOME#777 F454 + Legrand 067226 trace, and the 0x1D translator reading marked as reported (it is not in the OpenWebNet-HA firmware oracle). - motion / motion_end / is_on docstrings say how WHAT 39 surfaces, and why it stays MESSAGE_TYPE_MOTION with motion False (consumers that act on motion is True keep ignoring it). - Tests for the reporter's 39 / 1000#0 / 0 sequence and for that backward-compatible shape; CHANGELOG entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The SCS presence status decode is now reproduced on emulated F454 2.0.51 and F461 2.0.11 firmware (own-firmware-oracle suite who1-motion-detector): B8 52 1D 00 -> *1*34*52##, B8 52 1D 01 -> *1*39*52##. The test docstring and the parser comment no longer call it "reported, not reproduced". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 of 9 tasks
own-firmware-oracle#56 (suites run 39967360131) replayed the presence status frames on all 12 emulated gateways: B8 52 1D 00 / 01 give *1*34*52## / *1*39*52## on F454, F459, F460, F461, MH200N, MH202 and MyHomeServer1; F453 / F453AV give WHAT 34 only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fedem95
approved these changes
Oct 23, 2026
fedem95
left a comment
Contributor
There was a problem hiding this comment.
The WHAT 39 motion-end handling is clearly distinguished from motion detection and lighting states, with focused regression coverage and supporting trace evidence. All checks are passing. Approved.
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.
What is the problem
In
OpenWebNet-HA/MyHOME#777,@eC0y0tereported a Legrand067226Céliane BUS motion/luminosity detector (no relay) configured atA=5, PL=2(WHERE=52) to drive a BTicinoF411channel at the same address, behind a BTicinoF454gateway (firmware2.0.51).*1*34*52##: movement detected. OWNd already parses this asMESSAGE_TYPE_MOTION,motion = True.*1*39*52##: end of movement, sent when the detector's occupancy timer runs out. OWNd did not knowWHAT 39. It becameunknown_state = 39, withis_on = Noneandis_sensor = False.light 52 reports unknown lighting WHAT 39; keeping its last stateon every occupancy cycle.binary_sensorcould not clear onWHAT 39. It waited for its 315 s software timeout instead of the detector's own 45 s.How is it solved
WHAT 39is parsed as end of movement (OWNd/message/lighting.py) (@gdluck's patch, authorship kept):*1*39*WHERE##sets:message_type = MESSAGE_TYPE_MOTIONmotion = Falsemotion_end = Trueis_sensor = Trueis_on = Noneunknown_state = NoneOWNLightingEvent.motion_endproperty.is_onreturnsNoneformotion_end, just as it does formotionandis_anomaly.WHAT 39staysMESSAGE_TYPE_MOTION, withmotion = False.message_type == motion_detected and message.motion. For themWHAT 39stays the no-op it was asunknown_state 39.motion,motion_endandis_onsay how to tell the cases apart.CHANGELOG.md: entry under[Unreleased].How is it tested
tests/test_who1_what39_motion_end.py(new):WHAT 39givesMESSAGE_TYPE_MOTION,motion False,motion_end True,is_sensor True,is_on None,unknown_state None.WHAT 34is unchanged.*1*39*52#4#01##with a bus interface.*1*0*52##,*1*1*52##,*1*19*52##) are notmotion_end.*1*39*52##→*1*1000#0*52##→*1*0*52##gives one motion end, then a non-sensor command translation, then the F411 OFF state.not (message_type == motion_detected and motion).tests/test_message_protocol.py:WHAT 39is no longer in the unknown-WHAT parametrization (38replaces it).1907 passed, 1 skipped;mypy OWNdis clean, with 0 issues.ruff checkis clean.OpenWebNet-HA/MyHOME#781): its#777, light and binary_sensor tests pass against both this branch and the released2.0.0b11.State Diagram
stateDiagram-v2 direction TB state "1. OWNLightingEvent parse of *1*WHAT*WHERE##" as Parse { [*] --> CheckWhat CheckWhat --> LightState : WHAT 0..18, 20..31 (table)\nis_on True/False, is_sensor False CheckWhat --> Anomaly : WHAT 19\nis_anomaly True, unknown_state 19, is_on None CheckWhat --> Motion : WHAT 34\nmessage_type motion_detected\nmotion True, is_sensor True, is_on None CheckWhat --> MotionEnd : WHAT 39 (new)\nmessage_type motion_detected\nmotion False, motion_end True\nis_sensor True, is_on None CheckWhat --> Unknown : any other WHAT\nunknown_state WHAT, is_on None } state "2. Detector occupancy cycle on the bus (F454 + 067226 + F411 at 52)" as Cycle { [*] --> Idle Idle --> Occupied : *1*34*52##\nthen detector *1*1000#1*52##\nthen F411 *1*1*52## Occupied --> Occupied : *1*34*52## repeated while people move Occupied --> Idle : ~45 s (DIM 7) after last WHAT 34\n*1*39*52##\nthen *1*1000#0*52##\nthen F411 *1*0*52## } state "3. Consumer view (MyHOME)" as Consumer { [*] --> SensorOff SensorOff --> SensorOn : motion True (WHAT 34) SensorOn --> SensorOff : motion_end True (WHAT 39)\nor software timeout SensorOn --> SensorOn : older consumers ignore WHAT 39\n(motion False) and wait for the timeout }Where are the traces
WHO=1motion detector sharing an actuator addressMyHOME#777(comment), replayed inMyHOME/tests/test_issue_777_light_motion_same_address.py(OpenWebNet-HA/MyHOME#781)@eC0y0te: BTicinoF454(FW2.0.51), Legrand067226detector + BTicinoF411atWHERE 52*1*34*52##→*1*1000#1*52##→*1*1*52##;*1*39*52##→*1*1000#0*52##→*1*0*52##(~45 s after the lastWHAT 34, within ~90 ms). Detector timeout:*#1*0*7*0*0*45##.2.0.0b11MyHOME#777(comment)@eC0y0te: same plantWHAT 39clears the motion sensor immediately, and the F411*1*0*52##follows ~90 ms later.What does the Oracle / Encyclopedia say
OpenWebNet Encyclopedia (
functional/who-1-lighting/zigbee-variant.md):specified: the ZigBee OpenWebNet WHO 1 table definesWHAT 34"Movement detected" andWHAT 39"End of movement detected" (ownkb:claim:c001481,c001463,c001464).WHAT 32Toggle at half the detector's time while people are still present. That has not been seen on SCS and is left as is.Firmware oracle (OpenWebNet-HA/own-firmware-oracle#56 (merged), suite
who1-motion-detector(findings), suites run 39967360131):harness=full, on all 12 targets, including the reporter's exact gateway and version (F4542.0.51).Presence decode,
up(inbound SCS):B8 52 1D 00*1*34*52##B8 52 1D 01*1*39*52##B8 52 1D 01So
WHAT 39reaches a client on the seven current gateways. On F453 / F453AV onlyWHAT 34does, and this PR changes nothing for them. MH200020102gives*1*32*52##for presence00; that is recorded in the findings but not interpreted.Dimension replies,
up(inbound SCS): these are the replies to the detector's own requests. They give context for MyHOME; this PR does not parse them differently.D5 00 21 44 15 00 00 02*#1*0*5*2##D5 00 21 44 10 00 00 00*#1*0*6*0##D5 00 21 44 16 00 00 2D*#1*0*7*0*0*45##D1 52 01 44 {15,10,16} …*#1*52*{5,6,7}*…##Only frames whose address byte is
00give the reporter's*#1*0*…##; the same replies carrying52come out with52. So theWHERE 0is on the bus, not added by the gateway.Requests,
down:*#1*52*7##goes on the bus asD1 52 01 43 16 00 00 00, and*#1*52*5##/*#1*52*6##the same way with15/10in place of16.🤖 Generated with Claude Code