Discovery problems

This commit is contained in:
2026-04-13 02:09:18 +02:00
parent 79964ed46a
commit 00d5ece4e1

View File

@@ -790,13 +790,14 @@ def publish_discovery(client):
def publish_state(client): def publish_state(client):
info("publish_state called")
for i, g in enumerate(gauge_objects): for i, g in enumerate(gauge_objects):
gt = gauge_topics[i] gt = gauge_topics[i]
val = g.get() val = g.get()
info(f"pub G{i} get()={val} step={g._current_step}") info(f"pub G{i} get()={val} step={g._current_step}")
s = str(val) s = str(val)
client.publish(gt["state"], s) client.publish(gt["state"], s)
info(f"published {s}") info(f"pub to {gt['state']}: {s}")
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -913,11 +914,8 @@ def main():
was_moving = False was_moving = False
utime.sleep_ms(10) utime.sleep_ms(10)
if utime.ticks_diff(utime.ticks_ms(), last_heartbeat) > 10000:
info(f"Heartbeat: {gauge_targets}")
last_heartbeat = utime.ticks_ms()
if utime.ticks_diff(now, last_heartbeat) >= HEARTBEAT_MS: if utime.ticks_diff(now, last_heartbeat) >= HEARTBEAT_MS:
info(f"Heartbeat: {gauge_targets}")
publish_state(client_ref) publish_state(client_ref)
last_heartbeat = now last_heartbeat = now