Repository navigation
feat(light): support 2-digit Area 0 point-to-point addressing (01-09) (#684) - #713
Conversation
…#684) In Home + Project installations, light actuators are assigned starting at A=0, PL=1..15. Firmware reverse-engineering and empirical testing across the gateway fleet (own-firmware-oracle#35, own-firmware-oracle#39, findings/MH200N/area0-lighting.md) proved that: - Area 0 actuators with PL in 1..9 are addressed using 2-digit format '01'..'09' (*1*1*02## -> SCS Point-to-Point \), accepted across MH200N, F460, F461, F454, F459, F453AV, and MyHomeServer1. - 4-digit zero-padded forms (*1*1*0002##) are strictly NACKed by gateway firmware. - Single-digit '2' (*1*1*2##) is universally parsed as Area 2 Broadcast (\). Previously, is_apl_address('02') returned False, causing normalize_where('02') to strip the leading zero to '2'. This caused Area 0 lights to falsely alias and react to Area 2 broadcasts. Changes: - const.py: - is_apl_address(): accept 2-digit Area 0 point-to-point addresses (01-09) where a == 0 and 1 <= pl <= 9. - area_of_where(): map 2-digit Area 0 point-to-point addresses (01-09) to Area 0 status WHERE ('00'). - normalize_where(): preserve leading zero on 2-digit Area 0 addresses (01-09), preventing alias collision with Area broadcasts ('2'). - tests/test_issue_684_area0_press_trace.py: - update assertions to verify that '02' is recognized as canonical APL, normalizes to '02', does not alias '2', and maps to area '00' (resolves the sharp edge pinned in #700). - tests/test_infeasible_commands.py: - add test_all_feasible_2_digit_area_0_combinations asserting feasibility, normalization, and area mapping for 01-09. - add '00' to infeasible_zero_pl.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
I solved the problem in my home by using an old touchscreen (my home touchscreen 3,5" axolute h4890) as the openweb gateway. This old touchscreen handles the zero adresses correctly. |
|
@peterbeepping Thank you so much for attaching the original How Area 0 & Zero Handling Was SolvedThanks to your authentic physical press traces and testing across 10 emulated gateways, we merged a series of PRs that completely resolve Area 0 point-to-point addressing without colliding with Area broadcasts:
Note on the Axolute 3.5" Touchscreen (H4890)Your observation that the Axolute 3.5" touchscreen gateway handles Area 0 addresses cleanly is very valuable. We recently added colour touchscreen profile support and WHO 1013 diagnostics for the H4684 family in OWNd (OWNd#112), so having confirmation that the Axolute H4890 gateway translates Area 0 point-to-point correctly gives another verified hardware baseline for users with Home + Project plants. |
…`04`) (#147) (#798) Canonicalise 4-digit area-0 point addresses (`0001`..`0009`) to their 2-digit form (`01`..`09`) across YAML validation, stored `migrated_yaml_platforms`, WHO 1 / WHO 2 `expose` bindings and subentries, WHO 1 `binary_sensor` / `sensor` schemas, and persisted cover calibrations, while leaving `0000`, `0010`..`0015`, non-zero areas (including `#135`'s `0809`), and WHO 5 alarm addresses as typed. Migrate existing `{mac}-{1|2}-0004[#4#II][-suffix]` entities and devices to the canonical spelling at setup, carrying unset `area_id`, `icon`, `name`, `name_by_user`, and `labels`, removing ghost lights + companion buttons on WHO 1 switches/covers, and merging bus-discovered WHO 1 `motion` / `illuminance` twins (`{mac}-04-<suffix>`). Refs #147, #713. Co-Authored-By: gdluck <innowebdevs@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Resolves #684. Grounded in OpenWebNet-HA/own-firmware-oracle#35, OpenWebNet-HA/own-firmware-oracle#39, and firmware findings in MH200N/area0-lighting.md.
Builds upon and completes the trace fixture merged in #700 (
tests/fixtures/traces/issue_684/physical_press_a0pl2_mh200.json).What is the problem?
Area 0 Light Points Assigned by Legrand Home + Project:
Modern Legrand Eliot / Home + Project installations (e.g. paired with F460, F411/4, or MyHomeServer1) assign light point actuators starting at Area 0:
A=0, PL=1,A=0, PL=2, etc.Rejection of 4-Digit Forms (
0001–0009) by Gateway Firmware:Historically,
is_apl_address()assumed Area 0 was represented exclusively as 4-digit APL (0001–0015). However, empirical testing across all 10 catalogued Linux gateways under QEMU emulation inown-firmware-oraclerevealed that 4-digit zero-padded forms (*1*1*0001##,*1*1*0002##) are strictly NACKed / silent by MH200N, F460, F461, F454, F459, F453AV, and MyHomeServer1. Only 2-digit syntax (*1*1*02##) is translated to an SCS Point-to-Point telegram ($0302001200\r).Collision with Area Broadcasts via Zero Stripping:
Because
is_apl_address("02")returnedFalse,normalize_where("02")treated"02"as a non-APL numeric string and stripped the leading zero:This created a critical sharp edge (pinned in test(fixtures): A=0 PL=2 physical press trace from an MH200 (#684) #700):
where: "02"had its normalized address aliased to"2".*1*1*2##or*1*0*2##) falsely updated or toggled the state of the Area 0 light.area_of_where("02")returnedNone, preventing proper area status synchronization with Area 0 ("00").How is it solved?
Recognize 2-Digit Area 0 APL Addresses (
01–09):In
custom_components/myhome/const.py:is_apl_address():len(base) == 2), accepta == 0 and 1 <= pl <= 9."01"through"09"are now recognized as valid Point-to-Point (APL) addresses."00"(a == 0, pl == 0) continues to be correctly rejected as point-to-point.Map Area 0 Point-to-Point to Area Status WHERE
"00":In
custom_components/myhome/const.py:area_of_where():base[0] == "0"("01"–"09"), returns"00"."00"), completely decoupled from Area 2 ("2").Preserve Leading Zeros on 2-Digit Area 0 Addresses:
In
custom_components/myhome/const.py:normalize_where():is_apl_address("02")isTrue,norm_basepreserves"02".normalize_where("02") == "02"andnormalize_where("02#4#01") == "02#4#01"."2").How is it tested?
Resolution of Sharp Edge in Issue Support Area-0 point-to-point lighting addresses (A=0, PL=1–15) assigned by Home + Project #684 Trace Tests (
tests/test_issue_684_area0_press_trace.py):test_two_digit_form_is_canonical_apl_accepted_by_gateways: verifiesis_apl_address("02") is True.test_two_digit_where_does_not_collide_with_area_after_normalisation: assertsnormalize_where("02") == "02",area_of_where("02") == "00", andnormalize_where("02") != normalize_where("2").test_light_configured_at_02_sends_the_two_digit_frame: asserts turning on an Area 0 light dispatches*1*1*02##.Exhaustive Address Matrix (
tests/test_infeasible_commands.py):test_all_feasible_2_digit_area_0_combinations: asserts feasibility, normalization, and area mapping ("00") for all 9 Area 0 combinations (01–09)."00"toinfeasible_zero_plasserting broadcast"00"is not feasible APL.Full Regression & Quality Suite:
pytest tests -q).verify_ha_standards.py).sync_documentation.py --check).