bundles/infobeamer-monitor: better state dump output

This commit is contained in:
Franzi 2024-03-25 14:52:51 +01:00
parent 713f7e02d8
commit df8955fa35
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -55,14 +55,17 @@ def mqtt_out(message, level="INFO", device=None):
def mqtt_dump_state(device):
if not device["is_online"]:
return
out = []
if device["location"]:
out.append("Location: {}".format(device["location"]))
out.append("Setup: {} ({})".format(device["setup"]["name"], device["setup"]["id"]))
out.append("Resolution: {}".format(device["run"].get("resolution", "unknown")))
if not device["is_synced"]:
out.append("syncing ...")
mqtt_out(
"Sync status: {} - Location: {} - Running Setup: {} ({}) - Resolution: {}".format(
"yes" if device["is_synced"] else "syncing",
device["location"],
device["setup"]["name"],
device["setup"]["id"],
device["run"].get("resolution", "unknown"),
),
" - ".join(out),
device=device,
)