Skip to content

Nest MQTT topics under the system path per CS API Part 3 - #56

Draft
tipatterson-dev wants to merge 1 commit into
mainfrom
bugfix/cs-api-mqtt/55-part3-nested-topics
Draft

tipatterson-dev wants to merge 1 commit into
mainfrom
bugfix/cs-api-mqtt/55-part3-nested-topics

Conversation

@tipatterson-dev

Copy link
Copy Markdown
Collaborator

Closes #55.

What changed

  • MQTT topics are nested under the system by default: api/systems/{sysId}/datastreams/{dsId}/observations:data[/{token}], same for commands:data and Resource Event topics. This matches sensorhub-service-csapi-mqtt (csapi-mqtt: Part 3 topic scheme (new module, 0.1.0) opensensorhub/osh-addons#261).
  • New Node(mqtt_topic_scheme=...): "part3" (default), "part3-flat" (the previous default) or "legacy". mqtt_legacy_topics=True still works. The scheme is saved with the node config.
  • Discovery records the parent system id on datastreams and control streams; reloaded configs get it filled in.
  • Command status is per command under part3: subscribe(topic='Status', command_id=...). Publishing status over MQTT raises, since the server accepts it only over HTTP.
  • Format subtopics: types outside the built-in table get a token by the Part 3 rule (application/x-custom+json → x-custom-json); added geo-json, sml-xml, swe-xml.
  • NATS subjects are unchanged.
  • Version 0.5.6a0.

Upgrade notes

  • Nodes still on flat :data topics need mqtt_topic_scheme="part3-flat".
  • A config saved by an earlier version has no scheme and loads as part3.

Testing

  • pytest -m "not network" (548 passed), flake8 src/, strict Sphinx build.
  • Network tests were not run, and the nested topics have not been exercised against a live csapi-mqtt broker.

Follow-ups

  • Check the format token against the stream's formats list.
  • Track status subscriptions per control stream.
  • Version the saved config format.

@tipatterson-dev
tipatterson-dev marked this pull request as draft November 19, 2026 16:45
Default scheme is now part3; part3-flat and legacy stay selectable via mqtt_topic_scheme.
@tipatterson-dev
tipatterson-dev force-pushed the bugfix/cs-api-mqtt/55-part3-nested-topics branch from e81032b to e9344d6 Compare November 19, 2026 16:59

This branch has not been deployed

No deployments
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.

MQTT topics do not match the CS API Part 3 topic scheme (system path missing)

1 participant