use device serial if description is not set

This commit is contained in:
Franzi 2024-12-08 15:49:19 +01:00
parent c084048905
commit e55f32bfb6
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -40,7 +40,10 @@ def mqtt_out(message, level="INFO", device=None):
key = "infobeamer" key = "infobeamer"
if device: if device:
key += f"/{device['id']}" key += f"/{device['id']}"
if device["description"]:
message = f"[{device['description']}] {message}" message = f"[{device['description']}] {message}"
else:
message = f"[{device['serial']}] {message}"
client.publish( client.publish(
CONFIG["mqtt"]["topic"], CONFIG["mqtt"]["topic"],