Discovery problems
This commit is contained in:
@@ -790,14 +790,10 @@ 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}")
|
client.publish(gt["state"], str(val))
|
||||||
s = str(val)
|
|
||||||
client.publish(gt["state"], s)
|
|
||||||
info(f"pub to {gt['state']}: {s}")
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -899,7 +895,6 @@ def main():
|
|||||||
direction = 1 if current_target > g._current_step else -1
|
direction = 1 if current_target > g._current_step else -1
|
||||||
steps_to_move = current_target - g._current_step
|
steps_to_move = current_target - g._current_step
|
||||||
steps_to_move = max(-5, min(5, steps_to_move))
|
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)):
|
for _ in range(abs(steps_to_move)):
|
||||||
g.step(direction)
|
g.step(direction)
|
||||||
moved_any = True
|
moved_any = True
|
||||||
|
|||||||
Reference in New Issue
Block a user