Pi Architecture (v3.14) - Config-Driven Modem Support #125
kwschulz
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Cable Modem Monitor currently supports 33 modems across 7 manufacturers. Adding each one required understanding the modem's web interface from scratch; different auth mechanisms, different page structures, different data formats.
v3.14 restructures the project so that most of this variety is handled by configuration, not code. A
modem.yamlfile and a HAR capture should be enough for most modems. Custom parser code is only needed for genuine structural quirks that can't be expressed declaratively.Architecture
Three packages with strict dependency direction. Import boundaries are enforced by real Python packaging — violations are missing module errors, not lint warnings.
graph TD HA["<b>HA Integration</b><hr/>cable-modem-monitor"] --> Core["<b>Core Library</b><hr/>solentlabs-cable-modem-monitor-core"] HA --> Catalog["<b>Modem Catalog</b><hr/>solentlabs-cable-modem-monitor-catalog"] Catalog --> Corehomeassistant.*imports.modem.yamlconfigs,parser.yamlextraction mappings, optionalparser.pyoverrides, HAR captures. Each modem is isolated — adding one can't break another.Transport and Format
The
transportfield in modem.yaml is the first config decision — it identifies the wire protocol and determines whether auth and format are free or locked.graph TD T[transport] --> HNAP["<b>hnap</b><hr/>HNAPLoader to dict"] T --> HTTP["<b>http</b><hr/>HTTPLoader to BeautifulSoup or dict"] HNAP --> HA["<b>AUTH</b><hr/>HMAC challenge-response"] HA --> HS["<b>SESSION</b><hr/>uid cookie + HNAP_AUTH header"] HS --> HF["<b>FORMAT</b><hr/>hnap (JSON + delimiters)"] HTTP --> HTA["<b>AUTH</b><hr/>none, basic, form, form_nonce,<br/>url_token, form_pbkdf2, form_sjcl"] HTA --> HTS["<b>SESSION</b><hr/>stateless, cookie, CSRF, url_token"] HTS --> HTF["<b>FORMAT</b><hr/>table, table_transposed, javascript,<br/>javascript_json, html_fields, json, xml"]HNAP modems are fully constrained — the protocol defines auth, session, and format. Only the HMAC algorithm and action names vary per modem. HTTP is where the variety lives, but auth, session, and format are independent config axes.
Auth is config, not code
Eight auth strategies cover all 33 supported modems:
nonebasicformform_noncehnapform_pbkdf2form_sjclurl_tokenNo per-modem auth hooks means a smaller security surface — one audited implementation per strategy, not per-modem overrides that could mishandle credentials.
What a modem needs
modem.yamlparser.yamlhar/modem.harparser.pyThe HAR capture is how we understand your modem. We analyze it to determine auth mechanism, session management, data format, and endpoints; then express all of that in
modem.yamlandparser.yaml.Two data models, two cadences
A flaky modem gets fast heartbeats without hammering its web interface.
Current status
Core library and modem catalog are implemented. 33 modems across 7 manufacturers are configured and tested (1254 tests, ~96% coverage). The MCP onboarding pipeline (
validate_hartoanalyze_hartogenerate_configtogenerate_golden_filetorun_tests) automates most of the work of adding a new modem from a HAR capture.Next: HA integration wiring (replacing the v3.13 parsing/auth code with Core) and release.
If you want to help, the most valuable thing is a HAR capture of your modem. Open an issue and we'll walk you through it.
Beta Was this translation helpful? Give feedback.
All reactions