Repository navigation
feat(companion): SNMP, pull OTA and MAC commands (stacked on #18) - #20
Merged
Merged
Conversation
Ported from meshcomod's OtaManifest.h (version compare, partition signature, firmware URL allowlist) with its native tests, plus what the DMC companion needs on top: a small reader for the manifest's string fields (no JSON library on the companion), an https check for the image URL and the stable/dev/default channel selector used by `ota branch`.
For DMC companion builds that can join Wi-Fi (ESP32 *_companion_radio_wifi and the ESP32 *_companion_radio_ble boards with Wi-Fi), ported from meshcomod and the DMC observer: - SNMP: read-only SNMPv2c on UDP 161, off until `set snmp on`. Observer OID layout (.1-.5), companion-only values in .9 and the receive filter counters in .10, as on meshcomod. The community never leaves over the mesh. 0neblock/SNMP_Agent added to the 31 Wi-Fi capable envs. - OTA: `ota check|update|status|branch` against the DutchMeshCore OTA server (/companion/v, /companion/dev/v). The check reads the manifest over plain HTTP; an update refetches it and downloads the image over HTTPS, verified against pinned roots (CompanionOtaCerts.h, generated by scripts/gen_companion_ota_certs.py). Refused on a partition layout change or a single app slot. The flash starts from the main loop a few seconds after the reply, in a 24 KB task. - `get mac`, `get wifi.mac`, `get ble.mac`: factory MACs (n/a off ESP32). Settings in /cnet.json. MyMesh only carries one-line hooks.
For *_companion_radio_wifi and *_companion_radio_ble envs, build.sh passes COMPANION_OTA_VARIANT (the env name) and the stable, dev and native OTA bases (native = dev for DMC_CHANNEL=dev; COMPANION_OTA_URL overrides the server), and writes out/<env>.partsig with scripts/partition_signature.py (same as dmc-observer-dev) for the server's manifest. build_firmware now restores PLATFORMIO_BUILD_FLAGS on return, so one env's -D flags no longer leak into the next env of a multi-env build.
The TLS stack the OTA download needs costs ~180 KB of flash and left the 1.25 MB app slot boards at 95-97%. ThinkNode M2, ThinkNode M5, Xiao C3 and LilyGo T-LoRa V2.1 (Wi-Fi) now set DMC_COMPANION_NO_OTA: they keep SNMP and the MAC commands, and `ota` answers that they update over USB. Xiao C3 back to 81.5%, ThinkNode M2 84.0%.
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.
Adds SNMP, pull OTA and MAC commands to the DMC companion, ported from meshcomod and the DMC observer firmware. Reference:
docs/companion_snmp_ota_reference.md.What
set snmp on. Observer OID layout (.1-.5, same meaning/type/unit), companion values in.9, receive-filter counters in.10(same numbers as meshcomod). Unsupported OIDs readnoSuchObject. The community is never returned over remote CLI.0neblock/SNMP_Agent @ 2.1.0added to the 31 Wi-Fi capable ESP32 companion envs.ota check | update | status | branch [stable|dev|default]against the DutchMeshCore OTA server (/companion/v,/companion/dev/v). The check reads the manifest over plain HTTP; an update refetches it and downloads the image over HTTPS, verified against pinned roots (CompanionOtaCerts.h, regenerate withscripts/gen_companion_ota_certs.py). Refused on a partition-table change (partSig) or single app slot.ota updatereplies first and flashes a few seconds later from the main loop (24 KB task), then reboots. Decision logic insrc/helpers/OtaManifest.h(from meshcomod) with 33 native tests, plus a tiny manifest field reader (no ArduinoJson).DMC_COMPANION_NO_OTA): the TLS stack costs ~180 KB and left them at 95-97%. They keep SNMP and MAC.get mac,get wifi.mac,get ble.mac(factory MACs from eFuse;n/aoff ESP32).*_companion_radio_(wifi|ble)envs bakesCOMPANION_OTA_VARIANTand the stable/dev/native bases (native = dev forDMC_CHANNEL=dev,COMPANION_OTA_URLoverrides), writesout/<env>.partsig(scripts/partition_signature.py, same as dmc-observer-dev).build_firmwarenow restoresPLATFORMIO_BUILD_FLAGSso per-env flags don't leak across a multi-env build. The release button (ci(release): add DMC companion filter firmware to the release button #19) uploads the.partsigfiles unchanged./cnet.json; MyMesh only gets one-line hooks (CompanionNet.cpp,CompanionOta.cpp,CompanionSNMP.cpp).docs/cli_commands.md, dmc-docs nl/en/de, AGENTS.md.Which builds: SNMP + OTA on 22 ESP32
*_companion_radio_wifi(minus the 4 MB ones for OTA) and 9 ESP32*_companion_radio_bleboards that also have Wi-Fi (Heltec V3/WSL3/V4/V4 R8/Wireless Paper, RAK3112, ThinkNode M7, Xiao S3/S3 WIO; Wi-Fi viaset wifi.enabled 1). nRF52/RP2040: unchanged apart fromget mac=n/a.Depends on
OTA only works once the DutchMeshCore-OTA server serves the
/companionfeed (dmc-companion-v*stable,dmc-companion-devdev, prereleases allowed), Cloudflare gets the/companion/*rules, and admc-companion-*release is published.Verification
pio test -e native: all suites pass, incl. newtest_ota_manifest(33 tests).build.sh: Heltec_v3_companion_radio_wifi (40.1%), Heltec_v3_companion_radio_ble, Xiao_C3_companion_radio_wifi (81.5%), ThinkNode_M2_companion_radio_wifi (84.0%), LilyGo_TLora_V2_1_1_6_companion_radio_wifi, LilyGo_T3S3_sx1262_companion_radio_ble, RAK_4631_companion_radio_ble, PicoW_companion_radio_wifi..partsigproduced.Note: upstream's
set wifi.enabledusesatoi, soset wifi.enabled onturns Wi-Fi off; docs say1. Not changed here.🤖 Generated with Claude Code