no need to worry about payload here

This commit is contained in:
Blake Blackshear 2021-07-06 07:22:17 -05:00
parent bb3ba2d572
commit f892a821f5

View File

@ -90,12 +90,7 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
client.publish(state_topic, payload, retain=True) client.publish(state_topic, payload, retain=True)
def on_restart_command(client, userdata, message): def on_restart_command(client, userdata, message):
payload = message.payload.decode()
if payload == "container":
logger.warning(f"Restart container received via mqtt")
restart_frigate() restart_frigate()
else:
logger.warning(f"Received unsupported value at {message.topic}: {payload}")
def on_connect(client, userdata, flags, rc): def on_connect(client, userdata, flags, rc):
threading.current_thread().name = "mqtt" threading.current_thread().name = "mqtt"
@ -197,7 +192,7 @@ class MqttSocketRelay:
json_message = json.loads(message.data.decode("utf-8")) json_message = json.loads(message.data.decode("utf-8"))
json_message = { json_message = {
"topic": f"{self.topic_prefix}/{json_message['topic']}", "topic": f"{self.topic_prefix}/{json_message['topic']}",
"payload": json_message["payload"], "payload": json_message.get("payload"),
"retain": json_message.get("retain", False), "retain": json_message.get("retain", False),
} }
except Exception as e: except Exception as e: