add detection enable to config

fixes #482
This commit is contained in:
Blake Blackshear
2021-01-15 21:53:40 -06:00
parent 97e8258288
commit 89e02b6956
2 changed files with 13 additions and 1 deletions

View File

@@ -65,14 +65,18 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
camera_name = message.topic.split('/')[-3]
command = message.topic.split('/')[-1]
detect_settings = config.cameras[camera_name].detect
if payload == 'ON':
if not camera_metrics[camera_name]["detection_enabled"].value:
logger.info(f"Turning on detection for {camera_name} via mqtt")
camera_metrics[camera_name]["detection_enabled"].value = True
detect_settings._enabled = True
elif payload == 'OFF':
if camera_metrics[camera_name]["detection_enabled"].value:
logger.info(f"Turning off detection for {camera_name} via mqtt")
camera_metrics[camera_name]["detection_enabled"].value = False
detect_settings._enabled = False
else:
logger.warning(f"Received unsupported value at {message.topic}: {payload}")