Skip to content

MQTT publisher::spawn is never callled.#870

Open
Yesuah wants to merge 3 commits into
ruvnet:mainfrom
Yesuah:yesuah-pr/mqtt-missing-publisher
Open

MQTT publisher::spawn is never callled.#870
Yesuah wants to merge 3 commits into
ruvnet:mainfrom
Yesuah:yesuah-pr/mqtt-missing-publisher

Conversation

@Yesuah
Copy link
Copy Markdown

@Yesuah Yesuah commented May 30, 2026

MQTT publisher is fully implemented but publisher::spawn is never called from main.rs. args.mqtt is never read. Fix adds the channel, wires broadcast_tick_task, and spawns the publisher on startup.

…led from main.rs. args.mqtt is never read. Fix adds the channel, wires broadcast_tick_task, and spawns the publisher on startup.
@Yesuah Yesuah changed the title MQTT publisher is fully implemented but publisher::spawn is never cal… MQTT publisher::spawn is never callled. May 30, 2026
Yesuah added 2 commits May 30, 2026 11:29
main.rs has its own Args struct separate from the library's cli::Args.
MqttConfig::from_args() expects the library type so calling it with the
local type caused a type mismatch. Fix adds all MQTT fields to the local
Args and constructs MqttConfig inline in the spawn block.
broadcast_tick_task only runs for esp32 source. simulate source uses
simulated_data_task which never sent to vitals_tx, so MQTT state topics
never received messages and all entities stayed unknown in HA.
@ruvnet
Copy link
Copy Markdown
Owner

ruvnet commented Jun 2, 2026

Thanks for catching this — your diagnosis was correct at the time this PR was opened: the MQTT publisher was implemented but not spawned.

Triage update: this is now resolved on main via the #872 work, implemented with a slightly different (typed) shape, so this PR is superseded:

  • main.rs:6178if args.mqtt_opts.mqtt { … } reads the flag (the arg moved into a grouped mqtt_opts).
  • main.rs:6182mqtt::config::MqttConfig::from_args(&args.mqtt_opts) + mcfg.validate().
  • main.rs:6195let (vtx, vrx) = broadcast::channel::<mqtt::state::VitalsSnapshot>(64);
  • main.rs:6196mqtt::publisher::spawn(mcfg, builder, vrx); ← the spawn you flagged.
  • main.rs:6197+ — bridges the existing JSON sensing broadcast into the typed VitalsSnapshot stream the publisher consumes; gated behind #[cfg(feature = "mqtt")] (the Docker image builds --features mqtt).

Because of that, this PR's diff (which targets the older flat args.mqtt / args.mqtt_host fields) no longer applies cleanly — those fields are now under args.mqtt_opts, so it would need a rebase to even compile, and the behaviour it adds is already present.

Recommend closing as superseded by #872. Appreciate the clear write-up — it matched the root cause exactly.

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