use device serial if description is not set
This commit is contained in:
parent
c084048905
commit
e55f32bfb6
1 changed files with 4 additions and 1 deletions
|
@ -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"],
|
||||||
|
|
Loading…
Reference in a new issue