NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
use enabled_in_config for switch in HA integration (#8630)
Josh Hawkins7b520e8a9d7c
diff --git a/frigate/comms/dispatcher.py b/frigate/comms/dispatcher.pyindex b7bdb86fa2..010154bef2 100644--- a/frigate/comms/dispatcher.py+++ b/frigate/comms/dispatcher.py@@ -185,6 +185,13 @@ class Dispatcher:ptz_autotracker_settings = self.config.cameras[camera_name].onvif.autotrackingif payload == "ON":+ if not self.config.cameras[+ camera_name+ ].onvif.autotracking.enabled_in_config:+ logger.error(+ "Autotracking must be enabled in the config to be turned on via MQTT."+ )+ returnif not self.ptz_metrics[camera_name]["ptz_autotracker_enabled"].value:logger.info(f"Turning on ptz autotracker for {camera_name}")self.ptz_metrics[camera_name]["ptz_autotracker_enabled"].value = Truediff --git a/frigate/comms/mqtt.py b/frigate/comms/mqtt.pyindex b1b52ad90d..6182c89e37 100644--- a/frigate/comms/mqtt.py+++ b/frigate/comms/mqtt.py@@ -71,7 +71,7 @@ class MqttClient(Communicator): # type: ignore[misc])self.publish(f"{camera_name}/ptz_autotracker/state",- "ON" if camera.onvif.autotracking.enabled else "OFF",+ "ON" if camera.onvif.autotracking.enabled_in_config else "OFF",retain=True,)self.publish(diff --git a/frigate/config.py b/frigate/config.pyindex 777cdc1520..a7ceaeecb9 100644--- a/frigate/config.py+++ b/frigate/config.py@@ -184,6 +184,9 @@ class PtzAutotrackConfig(FrigateBaseModel):default=[],title="Internal value used for PTZ movements based on the speed of your camera's motor.",)+ enabled_in_config: Optional[bool] = Field(+ title="Keep track of original state of autotracking."+ )@validator("movement_weights", pre=True)def validate_weights(cls, v):@@ -1191,6 +1194,9 @@ class FrigateConfig(FrigateBaseModel):# set config pre-valuecamera_config.record.enabled_in_config = camera_config.record.enabledcamera_config.audio.enabled_in_config = camera_config.audio.enabled+ camera_config.onvif.autotracking.enabled_in_config = (+ camera_config.onvif.autotracking.enabled+ )# Add default filtersobject_keys = camera_config.objects.trackdiff --git a/frigate/ptz/autotrack.py b/frigate/ptz/autotrack.pyindex a7352a8f5a..4bca8be47d 100644--- a/frigate/ptz/autotrack.py+++ b/frigate/ptz/autotrack.py@@ -208,7 +208,10 @@ class PtzAutoTracker:continueself.autotracker_init[camera] = False- if camera_config.onvif.autotracking.enabled:+ if (+ camera_config.onvif.autotracking.enabled+ and camera_config.onvif.autotracking.enabled_in_config+ ):self._autotracker_setup(camera_config, camera)def _autotracker_setup(self, camera_config, camera):