Skip to content

Feature: Add request helpers for owner info and sensor subscriptions - #132

Merged
fdlamotte merged 1 commit into
meshcore-dev:mainfrom
hamsolodev:request-helpers-owner-subscribe
Nov 22, 2026
Merged

fdlamotte merged 1 commit into
meshcore-dev:mainfrom
hamsolodev:request-helpers-owner-subscribe

Conversation

@hamsolodev

Copy link
Copy Markdown
Contributor

A feature, offered for you to take or leave.

What it's for (#119, B8): the firmware handles three binary request types that meshcore has no helper for. I checked each against the firmware source (companion and server examples at v1.18.0):

  • GET_OWNER_INFO (0x07, simple_repeater/MyMesh.cpp:51 and :372, FIRMWARE_VER_LEVEL ≥ 2). The logged-in counterpart of the anon OWNER request. It answers "<version>\n<name>\n<owner info>".
  • SUBSCRIBE / UNSUBSCRIBE (0x08/0x09, simple_sensor/SensorMesh.cpp:61-62 and :213-250).
    • SUBSCRIBE takes a push tag, a duration in seconds, and LPP-encoded minimum changes of 3 to 14 bytes. It answers with the expiry (0 if refused) and the scope's name.
    • The sensor's pushes reach the client as BINARY_RESPONSE frames carrying the push tag. The companion passes on responses it didn't ask for (MyMesh.cpp, onContactResponse).

What changed

  • BinaryReqType gets OWNER_INFO, SUBSCRIBE and UNSUBSCRIBE.
  • New req_owner_info_sync, req_subscribe_sync and req_unsubscribe_sync in commands/binary.py, built on a small shared helper that sends a binary request and waits for its BINARY_RESPONSE.
  • SUBSCRIBE's argument limits are checked before sending, matching the sensor's own checks.

Left out: a keep-alive helper. The issue suggested one, but reading the firmware, it wouldn't do anything useful:

  • Only the room server acts on REQ_TYPE_KEEP_ALIVE, and only over a direct route.
  • The room server answers with an ACK, which the companion passes on only for its own keep-alives.
  • The companion already sends those keep-alives itself for any server whose login reply asked for them (BaseChatMesh::checkConnections).
  • The repeater and sensor define the type but don't handle it.

Verified

  • Unit tests in tests/unit/test_request_helpers.py; they fail on current main.
  • The whole suite passes on 3.11 and 3.14.
  • GET_OWNER_INFO against a v1.18.0 repeater under MeshBench, after a login:
sent     32 bd38…a4fc 07
answered 06 00 bed95569 1c080000
answered 8c 00 bed95569 76312e31382e300a52657065617465720a 00…
-> {'firmware_version': 'v1.18.0', 'name': 'Repeater', 'owner': ''}

SUBSCRIBE and UNSUBSCRIBE were checked against the sensor source only: I had no sensor to run them against.

Part of #119.

The firmware handles three binary request types meshcore had no helper
for:
- req_owner_info_sync: REQ_TYPE_GET_OWNER_INFO (0x07, simple_repeater at
  FIRMWARE_VER_LEVEL 2+), the logged-in counterpart of the anon OWNER
  request: firmware version, name and owner info;
- req_subscribe_sync / req_unsubscribe_sync: REQ_TYPE_SUBSCRIBE and
  REQ_TYPE_UNSUBSCRIBE (0x08, 0x09, simple_sensor). Pushes come back as
  BINARY_RESPONSE events tagged with the caller's push tag.

Part of meshcore-dev#119 (B8).
@fdlamotte

Copy link
Copy Markdown
Collaborator

oh I was about to work on sensor subscription ;)

I've read over most of the PRs, think I'll merge them rapidly

@hamsolodev

Copy link
Copy Markdown
Contributor Author

oh! feel free to ignore and implement as you see fit, I don't want to step on your toes 👍

@fdlamotte

Copy link
Copy Markdown
Collaborator

nono I'll merge it, as it is a good starting point ... will build things upon it so thanks

@fdlamotte
fdlamotte merged commit 97093eb into meshcore-dev:main Nov 22, 2026
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