feat(sensing-server): EventBus + MQTT bridge for Home Assistant#486
Open
schwarztim wants to merge 3 commits intoruvnet:mainfrom
Open
feat(sensing-server): EventBus + MQTT bridge for Home Assistant#486schwarztim wants to merge 3 commits intoruvnet:mainfrom
schwarztim wants to merge 3 commits intoruvnet:mainfrom
Conversation
added 3 commits
April 28, 2026 13:17
Add missing mod declarations (mod event_stream, mod mqtt_bridge) and mqtt_url field to the Args struct so the MQTT bridge introduced in the previous commit compiles. Cargo.lock updated with rumqttc resolution.
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.
Motivation
RuView deployments need to publish sensing events (presence, body tracking, zones, vitals) to home-automation systems. MQTT is the de-facto protocol for Home Assistant, Node-RED, openHAB, and others. This PR adds two coupled pieces:
event_stream.rs) — an in-process pub-sub built ontokio::sync::broadcastwith a typedEventenum covering presence, body, zone, and vital-sign events.mqtt_bridge.rs) — opt-in tokio task subscribing to the EventBus and publishing to MQTT topics under a configurable prefix.Why bundled into one PR?
The MQTT bridge depends on the EventBus to source events. EventBus was net-new in this fork and is not yet present in upstream's
v2/. Splitting into two PRs would require shipping the EventBus first as a no-op (no consumer), which is harder to review and provides no immediate value. Keeping them together produces a complete, testable feature.Changes
v2/crates/wifi-densepose-sensing-server/src/event_stream.rs(+288 LOC) —EventBus,Eventenum,EventSubscriberhelperv2/crates/wifi-densepose-sensing-server/src/mqtt_bridge.rs(+212 LOC) —MqttBridgetask usingrumqttcv2/crates/wifi-densepose-sensing-server/src/main.rs(+19 LOC) — mod declarations + instantiateEventBusat startup; spawnMqttBridgeifMQTT_URLis set; addmqtt_urlfield toArgsv2/crates/wifi-densepose-sensing-server/src/cli.rs(+4 LOC) —mqtt_urlfield in publicArgsstructv2/Cargo.toml+ crateCargo.toml— addrumqttcworkspace dependencyConfiguration
SENSING_MQTT_URL/--mqtt-url(required to enable, e.g.mqtt://broker.local:1883)MQTT_TOPIC_PREFIX(defaultruview/)MQTT_USERNAME/MQTT_PASSWORD(optional)Test fixture URL is
mqtt://test.example.com:1883— no real IPs.Test results
cargo test --workspace --no-default-features: 1639 passed, 0 failed (4 new unit tests inmqtt_bridge)python v1/data/proof/verify.py: VERDICT: FAIL — pre-existing, also fails on unmodifiedorigin/main(numpy/scipy version drift); not caused by this PRNotes
--mqtt-url/SENSING_MQTT_URLis set. Zero impact on existing deployments.