From 036fa045f8f8422ba15e563fb667bd325dd6b4bd Mon Sep 17 00:00:00 2001 From: "Adrian A. Baumann" Date: Wed, 15 Apr 2026 00:44:22 +0200 Subject: [PATCH] Discovery didn't set online status --- Gaugecontroller/Gaugecontroller.ino | 2 +- gauge.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Gaugecontroller/Gaugecontroller.ino b/Gaugecontroller/Gaugecontroller.ino index 2784be3..4a24497 100644 --- a/Gaugecontroller/Gaugecontroller.ino +++ b/Gaugecontroller/Gaugecontroller.ino @@ -10,7 +10,7 @@ static const uint8_t GAUGE_COUNT = 2; static const uint8_t LED_DATA_PIN = 22; // For now: commands come over USB serial -#define CMD_PORT Serial +#define CMD_PORT Serial1 #define DEBUG_PORT Serial struct GaugePins { diff --git a/gauge.py b/gauge.py index 592671d..f289ba4 100644 --- a/gauge.py +++ b/gauge.py @@ -642,6 +642,7 @@ def check_mqtt(): info("MQTT reconnected!") publish_discovery(client_ref) _subscribe_all(client_ref) + publish_online(client_ref) publish_state(client_ref) publish_backlight_states(client_ref) return True @@ -789,6 +790,11 @@ def publish_discovery(client): utime.sleep_ms(10) +def publish_online(client): + for i in range(num_gauges): + client.publish(gauge_topics[i]["status"], b"online", retain=True) + + def publish_state(client): for i in range(num_gauges): gt = gauge_topics[i] @@ -825,6 +831,7 @@ def main(): info("Home command sent") info("Publishing state...") + publish_online(client_ref) publish_state(client_ref) utime.sleep_ms(50) for _ in range(5):