Repository navigation
feat(lighting): migrate timed turn-on commands to OWNd b11 builders - #659
Merged
GreenGrassBlueOcean merged 5 commits intoOct 9, 2026
Conversation
Adopt the newly introduced typed factory methods in OWNd 2.0.0b11 (OWNLightingCommand.switch_on_timed, set_variable_timer, get_variable_timer, step_up, step_down, set_brightness_preset). Bumps OWNd pin in manifest.json and pyproject.toml to 2.0.0b11.
…erage on released OWNd
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
GreenGrassBlueOcean
merged commit Oct 9, 2026
64800d3
into
OpenWebNet-HA:v2-phase1-architecture
16 checks passed
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.
Note
Companion PR to OpenWebNet-HA/OWNd#93
Migrates
MyHOMEWHO 1 lighting timed turn-on commands to the typedOWNLightingCommandbuilders introduced inOWNd2.0.0b11, with dual-compatibility for releasedOWNd 2.0.0b10.1. Summary & Architectural Context
Historically,
custom_components/myhome/const.py:build_timed_turn_on_commandhad to assemble OpenWebNet frames via string interpolation (*1*{what}*{where}##for standard preset timers and*#1*{where}*#2*{h}*{m}*{s}##for arbitrary variable timers) and re-parse them usingOWNCommand.parse(...)becauseOWNLightingCommandlacked typed factory constructors for timed operations.With OpenWebNet-HA/OWNd#93 completing the lighting command surface,
OWNLightingCommandprovides first-class, typed factory constructors with built-in parameter boundary validation and human-readable logging.This PR:
build_timed_turn_on_commandto consumeOWNLightingCommand.switch_on_timedandOWNLightingCommand.set_variable_timer.hasattrchecks with safe fallbacks and test skips (@pytest.mark.skipif), allowing CI to pass immediately against releasedOWNd==2.0.0b10on PyPI while unlocking the typed constructors whenOWNd>=2.0.0b11is active or locally installed in development.tests/test_lighting.pyfor all newOWNLightingCommandfactory methods.2. Protocol & Specification Grounding
The frames dispatched by these builders conform strictly to canonical Legrand/BTicino specifications and binary implementations:
*1*<WHAT>*<WHERE>##WHAT ∈ {11..18}WHO_1.pdf(v1.1.0) §2.1.1libqtdevices:lighting_device.cpp:24-32*#1*<WHERE>*#2*<H>*<M>*<S>##H ∈ 0..255, M,S ∈ 0..59WHO_1.pdf(v1.1.0) §2.3.2WHO 1,DIMENSION 2)*#1*<WHERE>*2##WHO_1.pdf(v1.1.0) §2.3.2bt_lucirequest frame*1*<WHAT>*<WHERE>##WHAT ∈ {2..10}(10%..100%)WHO_1.pdf(v1.1.0) §2.1.1libqtdevices:lighting_device.cpp:45*1*30[*#<delta>[#<speed>]]*<WHERE>##*1*31[*#<delta>[#<speed>]]*<WHERE>##WHO_1.pdf(v1.1.0) §2.1.13. Empirical On-Wire Trace & Firmware Oracle Evidence
The frames generated by these builders are fully corroborated by authentic customer bus traces and firmware reverse engineering:
Authentic Customer On-Wire Traces in
MyHOMEtests/fixtures/traces/issue_619/myhome_trace_F453AV_all_2026-10-04T08-28-13.json:Physical BTicino F414 dimmer on
WHERE 13cycling discrete preset levels:*1*2*13##*1*3*13##*1*4*13##*1*5*13##*1*6*13##*1*7*13##tests/fixtures/traces/issue_466/myhome_trace_MH202_all_2026-09-26T16-59-17.json:Customer MH202 trace stepping physical dimmer through presets
*1*2*14##through*1*9*14##and back down.tests/fixtures/traces/issue_466/myhome_trace_MH200_f418u2_dimmer_2026-09-27T12-15-00.json:Authentic capture of BTicino F418U2 dimmer cycling presets
*1*3*62##,*1*5*62##, and*1*7*62##.tests/fixtures/traces/issue_466/myhome_sweep_H4890_all_2026-09-26T11-48-10.json:Live capture of an H4890 console emitting presets
*1*6*01##,*1*7*01##,*1*8*01##,*1*9*01##.Gateway Translator Daemon (
bt_luci) Telegram DispatchBinary disassembly of
bt_luciacrossMyHomeServer1,F454, andF459confirms the exact SCS bus telegrams emitted for these OpenWebNet frames:switch_on_timed(11, 11)(*1*11*11##)11 00 12 16(1 min fixed timer)set_variable_timer(11, 0, 1, 0)(*#1*11*#2*0*1*0##)D1 11 01 42 06 00 01 00(custom 1 min timer)get_variable_timer(11)(*#1*11*2##)D1 11 01 43 06 00 00 00(dimension 2 query)set_brightness_preset(11, 2)(*1*2*11##)11 00 12 1D(level 2)step_up(11)(*1*30*11##)11 00 12 03step_down(11)(*1*31*11##)11 00 12 04step_up(11, 20, 1)(*1*30#20#1*11##)D1 11 01 42 0D 03 14 01(Dimmer 100:4. Key Changes in This PR
custom_components/myhome/const.py:build_timed_turn_on_commandto conditionally invokeOWNLightingCommand.switch_on_timed(where, what)andOWNLightingCommand.set_variable_timer(where, h, m, s)when available.# pragma: no coverfor releasedOWNd==2.0.0b10.#4#INTERFACE) across all paths.custom_components/myhome/manifest.json&pyproject.toml:OWNd==2.0.0b10andOWNd>=2.0.0b10to satisfy PyPI installation in CI pipelines until OWNd 2.0.0b11 wheel is released.tests/test_lighting.py:OWNLightingCommandfactory methods (test_switch_on_timed,test_set_variable_timer,test_get_variable_timer,test_set_brightness_preset,test_step_up,test_step_down).@pytest.mark.skipif(not hasattr(OWNLightingCommand, "switch_on_timed"), ...)to ensure the test suite executes cleanly on both releasedOWNd 2.0.0b10and devOWNd 2.0.0b11.tests/test_timed_lighting.py:isinstance(cmd, OWNLightingCommand)across preset durations, custom durations, clamping bounds, and private bus routings.5. Verification & Quality Gates
All checks executed inside the Python 3.14 WSL Ubuntu test harness:
OWNd==2.0.0b10: 60 passed, 6 skipped in 2.45s (0 failures, 0 regressions).ruff check custom_components tests scripts).python scripts/verify_ha_standards.pypassed with all Platinum criteria satisfied.python scripts/sync_documentation.py --checkpassed with 0 drift.