Discovery problems
This commit is contained in:
@@ -790,13 +790,14 @@ def publish_discovery(client):
|
||||
|
||||
|
||||
def publish_state(client):
|
||||
info("publish_state called")
|
||||
for i, g in enumerate(gauge_objects):
|
||||
gt = gauge_topics[i]
|
||||
val = g.get()
|
||||
info(f"pub G{i} get()={val} step={g._current_step}")
|
||||
s = str(val)
|
||||
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
|
||||
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:
|
||||
info(f"Heartbeat: {gauge_targets}")
|
||||
publish_state(client_ref)
|
||||
last_heartbeat = now
|
||||
|
||||
|
||||
Reference in New Issue
Block a user