From 79964ed46a5f27cf4936dc55678e96cb5c486d5e Mon Sep 17 00:00:00 2001 From: "Adrian A. Baumann" Date: Mon, 13 Apr 2026 02:07:06 +0200 Subject: [PATCH] Discovery problems --- gaugemqttcontinuous.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gaugemqttcontinuous.py b/gaugemqttcontinuous.py index b4cca50..7673a2c 100644 --- a/gaugemqttcontinuous.py +++ b/gaugemqttcontinuous.py @@ -790,16 +790,13 @@ def publish_discovery(client): def publish_state(client): - states = {} for i, g in enumerate(gauge_objects): gt = gauge_topics[i] val = g.get() - val_rounded = int(val * 10) / 10 - states[str(i)] = val_rounded - info(f"pub G{i} state={val_rounded:.1f} step={g._current_step}") - client.publish(gt["state"], f"{val_rounded:.1f}", retain=True) - client.publish(gt["status"], "online", retain=True) - client.publish(T_STATE, ujson.dumps(states), retain=True) + info(f"pub G{i} get()={val} step={g._current_step}") + s = str(val) + client.publish(gt["state"], s) + info(f"published {s}") # --------------------------------------------------------------------------- @@ -901,6 +898,7 @@ def main(): direction = 1 if current_target > g._current_step else -1 steps_to_move = current_target - g._current_step steps_to_move = max(-5, min(5, steps_to_move)) + info(f"G{i} tgt={gauge_targets[i]:.1f} cur_step={g._current_step} target_step={current_target} dir={direction} moving={steps_to_move}") for _ in range(abs(steps_to_move)): g.step(direction) moved_any = True