mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
parent
97e8258288
commit
89e02b6956
@ -216,7 +216,9 @@ CAMERAS_SCHEMA = vol.Schema(vol.All(
|
||||
},
|
||||
'objects': OBJECTS_SCHEMA,
|
||||
vol.Optional('motion', default={}): MOTION_SCHEMA,
|
||||
vol.Optional('detect', default={}): DETECT_SCHEMA
|
||||
vol.Optional('detect', default={}): DETECT_SCHEMA.extend({
|
||||
vol.Optional('enabled', default=True): bool
|
||||
})
|
||||
}
|
||||
}, vol.Msg(ensure_zones_and_cameras_have_different_names, msg='Zones cannot share names with cameras'))
|
||||
)
|
||||
@ -737,14 +739,20 @@ class MotionConfig():
|
||||
|
||||
class DetectConfig():
|
||||
def __init__(self, global_config, config, camera_fps):
|
||||
self._enabled = config['enabled']
|
||||
self._max_disappeared = config.get('max_disappeared', global_config.get('max_disappeared', camera_fps*2))
|
||||
|
||||
@property
|
||||
def enabled(self):
|
||||
return self._enabled
|
||||
|
||||
@property
|
||||
def max_disappeared(self):
|
||||
return self._max_disappeared
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
'enabled': self.enabled,
|
||||
'max_disappeared': self._max_disappeared,
|
||||
}
|
||||
|
||||
|
@ -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}")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user