Discovery problems
This commit is contained in:
@@ -779,12 +779,15 @@ def publish_discovery(client):
|
|||||||
|
|
||||||
|
|
||||||
def publish_state(client):
|
def publish_state(client):
|
||||||
|
states = {}
|
||||||
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()
|
||||||
|
states[str(i)] = round(val, 1)
|
||||||
client.publish(gt["state"], str(round(val, 1)), retain=True)
|
client.publish(gt["state"], str(round(val, 1)), retain=True)
|
||||||
client.publish(gt["status"], "online", retain=True)
|
client.publish(gt["status"], "online", retain=True)
|
||||||
info(f"Gauge {i} state: {val:.1f} step={g._current_step}")
|
info(f"Gauge {i} state: {val:.1f} step={g._current_step}")
|
||||||
|
client.publish(T_STATE, ujson.dumps(states), retain=True)
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user