Repository navigation
refactor(arch): modularize config_flow, gateway identity, and decoder pool (#732) - #744
Merged
GreenGrassBlueOcean merged 6 commits intoOct 20, 2026
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
GreenGrassBlueOcean
force-pushed
the
arch/issue-732-modularize-monoliths
branch
from
October 17, 2026 10:16
e99c6b4 to
eb84a8e
Compare
GreenGrassBlueOcean
force-pushed
the
arch/issue-733-sweep-gating-and-yaml-migration
branch
from
October 17, 2026 10:16
f77599f to
91ce456
Compare
GreenGrassBlueOcean
force-pushed
the
arch/issue-732-modularize-monoliths
branch
from
October 17, 2026 10:40
08267ae to
bbdcf40
Compare
GreenGrassBlueOcean
force-pushed
the
arch/issue-733-sweep-gating-and-yaml-migration
branch
2 times, most recently
from
October 19, 2026 09:54
461550b to
0479504
Compare
GreenGrassBlueOcean
force-pushed
the
arch/issue-732-modularize-monoliths
branch
from
October 19, 2026 09:58
db0113c to
aba7687
Compare
GreenGrassBlueOcean
force-pushed
the
arch/issue-732-modularize-monoliths
branch
from
October 19, 2026 10:04
aba7687 to
3ef903f
Compare
GreenGrassBlueOcean
added a commit
that referenced
this pull request
Oct 19, 2026
….0.0 documentation (#735) - Rebase onto #744 (3ef903f) and latest v2-phase1-architecture (fcdb507) - Deduplicate _ensure_oracle_verified_profiles in scripts/update_gateway_profiles.py - Add test_f461_live_traces_2026_10_18_conformance_with_oracle verifying physical BTicino F461 (2.0.11) live traces against OWNd parser and F461 oracle verdicts
GreenGrassBlueOcean
added a commit
that referenced
this pull request
Oct 19, 2026
….0.0 documentation (#735) - Rebase onto #744 (3ef903f) and latest v2-phase1-architecture (fcdb507) - Deduplicate _ensure_oracle_verified_profiles in scripts/update_gateway_profiles.py - Add test_f461_live_traces_2026_10_18_conformance_with_oracle verifying physical BTicino F461 (2.0.11) live traces against OWNd parser and F461 oracle verdicts
GreenGrassBlueOcean
force-pushed
the
arch/issue-733-sweep-gating-and-yaml-migration
branch
from
October 19, 2026 12:37
0479504 to
9a83cf6
Compare
GreenGrassBlueOcean
force-pushed
the
arch/issue-732-modularize-monoliths
branch
from
October 19, 2026 12:37
3ef903f to
3acf978
Compare
Base automatically changed from
arch/issue-733-sweep-gating-and-yaml-migration
to
v2-phase1-architecture
October 20, 2026 20:01
…opologyMixin to meet #732 line budgets
…Mixin and GatewayTopologyMixin
…n and move stub to TYPE_CHECKING
GreenGrassBlueOcean
force-pushed
the
arch/issue-732-modularize-monoliths
branch
from
October 20, 2026 20:05
3acf978 to
b6966a6
Compare
GreenGrassBlueOcean
merged commit Oct 20, 2026
493e2ce
into
v2-phase1-architecture
15 of 16 checks passed
GreenGrassBlueOcean
added a commit
that referenced
this pull request
Oct 20, 2026
) Bring in #742 (sweep gating, myhome.yaml copy in entry options) and #744 (#732 modularization of config_flow, gateway and platforms). Conflicts: - validate.py: import list; keep both CONF_STEP_*_ACTION and CONF_STRATEGY. - legacy_yaml.py: keep the base's _load_live_yaml/_apply_yaml_platforms structure and re-apply the expose handling on top: a top-level `expose:` key counts as single-gateway config, the where-filling loop skips `expose`, and the validated expose list is collected into configured_expose (threaded through _load_live_yaml). - config_flow.py: take the base's split module and move ExposeSubentryFlowHandler into config_flow_expose.py, next to config_flow_options.py; config_flow.py keeps async_get_supported_subentry_types and re-exports the handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GreenGrassBlueOcean
added a commit
that referenced
this pull request
Oct 21, 2026
….0.0 documentation (#735) - Rebase onto #744 (3ef903f) and latest v2-phase1-architecture (fcdb507) - Deduplicate _ensure_oracle_verified_profiles in scripts/update_gateway_profiles.py - Add test_f461_live_traces_2026_10_18_conformance_with_oracle verifying physical BTicino F461 (2.0.11) live traces against OWNd parser and F461 oracle verdicts
This was referenced Oct 21, 2026
4 tasks done
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.
Closes #732
Depends on #742
What is the problem
Three core integration files had grown into multi-responsibility monoliths that exceeded maintainable size boundaries and mixed unrelated concerns:
custom_components/myhome/config_flow.py(1,422 lines / ~65 KB):custom_components/myhome/gateway.py(1,383 lines):_record_gateway_identity, conflict tracking, device-registry updates, worker trimming) and shared-bus cross-gateway topology correlation (_correlate_shared_bus_traffic,peer_gateways,topology_role).custom_components/myhome/decoder_pool.py(1,028 lines):claim,release,set_group,restore_zones).How is it solved
Decomposed all three monoliths into cohesive, single-responsibility modules meeting every explicit line-count budget from #732 while preserving all public entry points (
MyhomeFlowHandler/MyhomeConfigFlow,MyhomeOptionsFlowHandler,MyHOMEGatewayHandler,DecoderPool),hassfestdiscovery rules,mypy --strictzero-error ratchet, and 100.0% statement coverage:config_flow.py: 1,422< 350):custom_components/myhome/config_flow.py(333 lines): CoreMyhomeFlowHandler(MyhomeConfigFlow) user/serial/custom setup steps (async_step_user,async_step_serial,async_step_custom,async_step_custom_manual) andasync_get_options_flow.custom_components/myhome/config_flow_discovery.py(482 lines):ConfigFlowDiscoveryMixin(SSDP discovery, discovery confirmation, reconfigure, reauth, connection test, port, and password steps).custom_components/myhome/config_flow_topology.py(379 lines):ConfigFlowTopologyMixinandOptionsFlowTopologyMixin(shared-bus onboarding, secondary interface#4#<if>validation, and peer gateway selection).custom_components/myhome/config_flow_audio.py(287 lines):OptionsFlowAudioMixin(F441M audio matrix input naming, tuner declaration, environment routing defaults, and decoder slot validation).custom_components/myhome/config_flow_options.py(292 lines):MyhomeOptionsFlowHandler(re-exported fromconfig_flow.py).gateway.py: 1,383< 700):custom_components/myhome/gateway.py(640 lines): Core gateway lifecycle, session orchestration, paced sweeps, and frame dispatch.custom_components/myhome/identity.py(632 lines):GatewayIdentityMixin(WHO=13 Dimension 15/16/23/24 and WHO=1013 Dimension 1 model/firmware resolution, identity conflict repair issues, device-registry synchronization, and single-session worker trimming).custom_components/myhome/topology.py(696 lines):GatewayTopologyMixin(shared-bus cross-gateway frame correlation, peer gateway discovery, and topology role helpers).decoder_pool.py: 1,028< 450):custom_components/myhome/decoder_pool.py(434 lines):DecoderPoollifecycle and async slot/group operations (claim,release,set_group,restore_zones,update_slots).custom_components/myhome/decoder_allocation.py(404 lines):DecoderAllocationMixin(slot allocation state,_set_group_locked,environment_owner,_environment_owners, and diagnostic snapshot building).scripts/verify_ha_standards.py):check_discovery_flows()and IQS Goldreconfiguration-flowrule to inspectconfig_flow*.pyacross the decomposed config flow package, and addeddecoder_allocation.pytoRUNTIME_DATA_READERS.How is it tested
tests/test_config_flow.py,tests/test_config_flow_serial.py,tests/test_shared_bus_onboarding.py,tests/test_gateway.py(includingtest_replay_f461_who14_live_2026_10_18_gateway_identity),tests/test_gateway_identification.py,tests/test_decoder_pool.py,tests/test_where_usage_guard.py, and full 4,193-test suite: all passing with 100.0% statement coverage across every extracted module.scripts/typing_ratchet.py:mypy --strict: 0 error(s) in 0 module(s); baseline 0.scripts/verify_ha_standards.py: all 69 Python source files verified, 54/54 Home Assistant Platinum Quality Scale rules satisfied.scripts/sync_documentation.py --checkandhassfest: 0 violations.State Diagram
flowchart TD subgraph ConfigFlowPackage["Config & Options Flow Package"] CF["config_flow.py\nMyhomeFlowHandler (333 lines)"] CFD["config_flow_discovery.py\nConfigFlowDiscoveryMixin (482 lines)"] CFT["config_flow_topology.py\nConfigFlowTopologyMixin /\nOptionsFlowTopologyMixin (379 lines)"] CFA["config_flow_audio.py\nOptionsFlowAudioMixin (287 lines)"] CFO["config_flow_options.py\nMyhomeOptionsFlowHandler (292 lines)"] CFD --> CF CFT --> CF CFT --> CFO CFA --> CFO CF --> CFO end subgraph GatewayPackage["Gateway Handler Package"] GW["gateway.py\nMyHOMEGatewayHandler (640 lines)"] GWI["identity.py\nGatewayIdentityMixin (632 lines)\n(WHO 13 / WHO 1013)"] GWT["topology.py\nGatewayTopologyMixin (696 lines)\n(Shared-Bus Correlation)"] GWI --> GW GWT --> GW end subgraph DecoderPoolPackage["Audio Decoder Pool Package"] DP["decoder_pool.py\nDecoderPool (434 lines)"] DPA["decoder_allocation.py\nDecoderAllocationMixin (404 lines)"] DPA --> DP endWhere are the traces
tests/fixtures/traces/f461_who14_live_2026-10-18/myhome_trace_F461_who14_live_2026-10-18.json(physical BTicino F4612.0.11, kernel5.10.35, distribution2.26.4WHO=13 Dims 15/16/23/24 + WHO=1013 Dim 1134*15*5*0replayed intests/test_gateway.py::test_replay_f461_who14_live_2026_10_18_gateway_identity).tests/fixtures/traces/f461_live_2026-10-15/myhome_trace_F461_live_2026-10-15.json(BTicino F461WHO=13 code200+ WHO=1013 code134disambiguation).tests/fixtures/traces/oracle_h4684_gateway/myhome_trace_oracle_h4684_gateway_identification.json(H4684WHO=13 / WHO=1013 identification sequence exercised viaidentity.py::GatewayIdentityMixin).tests/fixtures/traces/issue_484/&issue_486/(H4890+F454shared-bus topology correlation exercised viatopology.py::GatewayTopologyMixin).What does the Oracle / Encyclopedia say
identity.py&tests/golden/firmware_oracle.json):tests/golden/firmware_oracle.json, Linux-based gateways (F454020051,F459020105,F460020012,F461020011,MH202010024,MyHomeServer1028206) all reply to*#13**15##with shared family code200(*#13**15*200##), whereas*#1013*0*1##disambiguates the exact hardware model viabt_device(*#1013**1*51##forF454,*#1013**1*65##forF459,*#1013**1*134##forF461,*#1013**1*5##forMH202,*#1013**1*67##forMyHomeServer1,*#1013**1*19##forH4684,*#1013**1*12##forF453AV,*#1013**1*22##forF453,*#1013**1*4##forMH200,*#1013**1*44##forMH200N).identity.py(GatewayIdentityMixin) keepsgateway.pyfocused strictly on session transport and frame routing.