Skip to content

feat(gateway): include kernel and distribution queries in diagnostic sweep (#466, #709) - #711

Merged
GreenGrassBlueOcean merged 1 commit into
v2-phase1-architecturefrom
feat/gateway-kernel-distribution-diagnostics
Oct 14, 2026
Merged

GreenGrassBlueOcean merged 1 commit into
v2-phase1-architecturefrom
feat/gateway-kernel-distribution-diagnostics

Conversation

@GreenGrassBlueOcean

@GreenGrassBlueOcean GreenGrassBlueOcean commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What is the problem?

  1. Limited Gateway Diagnostic Visibility:
    During myhome.sweep_bus diagnostic executions, MyHOME historically queried WHO=13 dimensions 0 (Real-time clock / time & timezone), 15 (Device model/type), and 16 (Firmware version). Modern Linux-based OpenWebNet gateways such as the Legrand/BTicino F461 (and MyHomeServer1) additionally support dimension 23 (OS kernel version) and dimension 24 (Distribution version). Without querying these dimensions during bus sweeps, diagnostic bundles lack critical underlying OS build metadata needed to triage firmware variations, regressions, and feature support across releases.

  2. Spurious Timezone Repair Warning on F461 (Unconfigured timezone on MyHOME gateway (F461 Gateway) #709):
    The Legrand F461 gateway (firmware 2.26.4) manages its system clock via NTP and reports timezone code 999 in dimension 0/22 clock frames (*#13**0*H*M*S*999##). MyHOME previously treated 999 universally as an unconfigured timezone, raising a spurious Home Assistant repair issue ("Gateway timezone unconfigured") on properly functioning F461 installations.

  3. Uncalibrated F461 Test Fixture (Community Call for Real-World Gateway Traces: Help Us Eliminate Hardware Blind Spots! 📡 #466):
    The test plant fixture for issue_466_f461 lacked the actual physical kernel and distribution response frames, leaving a gap between synthetic test fixtures and physical hardware behavior.


How is it solved?

  1. Include Kernel and Distribution Dimensions in Bus Sweep:

    • Added *#13**23## (Gateway kernel version) and *#13**24## (Gateway distribution version) to gateway_queries in custom_components/myhome/services.py:async_sweep_bus().
    • The diagnostic sweep now dispatches the full 5-frame gateway query sequence:
      • *#13**0## — Real-time clock (time and timezone)
      • *#13**15## — Device model / type
      • *#13**16## — Firmware version
      • *#13**23## — OS kernel version
      • *#13**24## — OS distribution version
    • Gateways that do not support dimensions 23 or 24 return NACK, which is cleanly handled and logged at DEBUG level.
    • Fully decoupled from OpenWebNet-HA/OWNd#112 (superseding Bug report: Deprecation warning by 2025.1 #110): uses raw OpenWebNet frames and parsed dimension values already processed into _who13 (who13_kernel, who13_distribution), with tests gracefully supporting both public and private version properties.
  2. F461 Timezone 999 Repair Issue Exemption (Unconfigured timezone on MyHOME gateway (F461 Gateway) #709):

    • In custom_components/myhome/gateway.py:
      • In _handle_gateway_diagnostics (handling dims 0 and 22): when dim_val[3] == "999", if the gateway is recognized as F461 (via either canonical model name "F461" or resolved WHO=1013 object model code "134"), deletes/suppresses the repair issue rather than creating it.
      • In _resolve_identity: when the resolved gateway model becomes "F461" or object model code is "134", proactively cleans up any existing timezone repair issue to eliminate timing/ordering races during startup.
    • Updated documentation in docs/configuration/gateways.md and docs/diagnostics/repair-issues.md.
  3. Plant Calibration & Documentation:

    • Enriched tests/fixtures/plants/issue_466_f461/diagnostic_summary.json with physical frames *#13**23*5*10*35## and *#13**24*2*26*4##, populating who13_kernel: "5.10.35" and who13_distribution: "2.26.4".
    • Updated docs/configuration/gateway-identification.md to document verified physical hardware status for F461.

How is it tested?

  1. Unit & Gateway Logic Tests:

    • tests/test_gateway.py:
      • When self.model == "F461", dimension 0/22 replies with timezone 999 do not raise a repair issue.
      • When gateway.model_name == "Generic" but _who1013["code"] == "134", the F461 exemption applies identically.
      • When identity resolves from "Generic" to "134"/"F461" after an issue was created, the issue is proactively deleted.
      • Other gateway models reporting 999 continue to create the repair issue as expected.
    • tests/test_services.py: Updated test_sweep_bus_energy_queries and test_sweep_bus_follower_delegated_who1 to assert the 5-frame prefix sequence.
    • tests/test_multi_gateway.py: Updated test_services_multi_gateway ensuring multi-gateway sweeps propagate all 5 gateway query frames across primary and secondary gateways (45 status requests).
  2. Hardware Trace & Golden Playback Tests:

    • tests/test_issue_466_f461_trace.py: Added assertions verifying kernel (5.10.35) and distribution (2.26.4) frame extraction and event handling during trace replay, supporting both public and private version properties.
    • tests/test_gateway_identification.py: Asserted issue_466_f461 in test_golden_who1013_exchange().
    • WSL test execution: All 3,708 tests passed (pytest tests -q).
  3. Standards & Architectural Validation:

    • ruff check custom_components tests scripts: 0 violations.
    • python scripts/verify_ha_standards.py: All 54/54 quality scale rules satisfied/exempt.
    • python scripts/sync_documentation.py --check: All documentation tables, anchors, and links synchronized.

Where are the traces?

  1. Physical F461 Plant Fixture:

  2. Replay & Trace Harness:

    • tests/test_issue_466_f461_trace.py: Exercises mock bus playback using recorded frames from the physical plant.
    • tests/golden/corpus.json: Contains reference OpenWebNet frame corpus for regression testing.

@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!

…sweep (#466, #709)

- Query WHO=13 dimensions 23 (kernel version) and 24 (distribution version) in sweep_bus diagnostic action

- Calibrate test plant issue_466_f461 fixture with physical F461 kernel (5.10.35) and distribution (2.26.4) frames

- Assert kernel and distribution frames in trace, golden, services, and multi-gateway tests

- Update gateway identification documentation to reflect verified F461 physical plant trace

- Exempt F461 (model 134) from timezone 999 unconfigured warning checking both canonical model and WHO=1013 code 134 (#709)
@GreenGrassBlueOcean
GreenGrassBlueOcean force-pushed the feat/gateway-kernel-distribution-diagnostics branch from 9408814 to a91d1ef Compare October 14, 2026 14:52
@GreenGrassBlueOcean
GreenGrassBlueOcean merged commit 9714391 into v2-phase1-architecture Oct 14, 2026
23 checks passed
@GreenGrassBlueOcean
GreenGrassBlueOcean deleted the feat/gateway-kernel-distribution-diagnostics branch October 14, 2026 21:13
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