Update MQTT along with enabling motion detection (#3898)

This commit is contained in:
Nicolas Mowen 2022-10-01 08:01:43 -06:00 committed by GitHub
parent a1ae5b67d8
commit f0e836e5b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,6 +84,8 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
f"Turning on motion for {camera_name} due to detection being enabled." f"Turning on motion for {camera_name} due to detection being enabled."
) )
camera_metrics[camera_name]["motion_enabled"].value = True camera_metrics[camera_name]["motion_enabled"].value = True
state_topic = f"{message.topic[:-11]}/motion/state"
client.publish(state_topic, payload, retain=True)
elif payload == "OFF": elif payload == "OFF":
if camera_metrics[camera_name]["detection_enabled"].value: if camera_metrics[camera_name]["detection_enabled"].value:
logger.info(f"Turning off detection for {camera_name} via mqtt") logger.info(f"Turning off detection for {camera_name} via mqtt")