mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-03 12:07:40 +03:00
Birdseye config updates
This commit is contained in:
parent
9a340ee5fa
commit
8dec3418c9
@ -485,6 +485,10 @@ class Dispatcher:
|
|||||||
logger.info(f"Turning off snapshots for {camera_name}")
|
logger.info(f"Turning off snapshots for {camera_name}")
|
||||||
snapshots_settings.enabled = False
|
snapshots_settings.enabled = False
|
||||||
|
|
||||||
|
self.config_updater.publish_update(
|
||||||
|
CameraConfigUpdateTopic(CameraConfigUpdateEnum.snapshots, camera_name),
|
||||||
|
snapshots_settings,
|
||||||
|
)
|
||||||
self.publish(f"{camera_name}/snapshots/state", payload, retain=True)
|
self.publish(f"{camera_name}/snapshots/state", payload, retain=True)
|
||||||
|
|
||||||
def _on_ptz_command(self, camera_name: str, payload: str) -> None:
|
def _on_ptz_command(self, camera_name: str, payload: str) -> None:
|
||||||
@ -519,7 +523,10 @@ class Dispatcher:
|
|||||||
logger.info(f"Turning off birdseye for {camera_name}")
|
logger.info(f"Turning off birdseye for {camera_name}")
|
||||||
birdseye_settings.enabled = False
|
birdseye_settings.enabled = False
|
||||||
|
|
||||||
self.config_updater.publish(f"config/birdseye/{camera_name}", birdseye_settings)
|
self.config_updater.publish_update(
|
||||||
|
CameraConfigUpdateTopic(CameraConfigUpdateEnum.birdseye, camera_name),
|
||||||
|
birdseye_settings,
|
||||||
|
)
|
||||||
self.publish(f"{camera_name}/birdseye/state", payload, retain=True)
|
self.publish(f"{camera_name}/birdseye/state", payload, retain=True)
|
||||||
|
|
||||||
def _on_birdseye_mode_command(self, camera_name: str, payload: str) -> None:
|
def _on_birdseye_mode_command(self, camera_name: str, payload: str) -> None:
|
||||||
@ -540,7 +547,10 @@ class Dispatcher:
|
|||||||
f"Setting birdseye mode for {camera_name} to {birdseye_settings.mode}"
|
f"Setting birdseye mode for {camera_name} to {birdseye_settings.mode}"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.config_updater.publish(f"config/birdseye/{camera_name}", birdseye_settings)
|
self.config_updater.publish_update(
|
||||||
|
CameraConfigUpdateTopic(CameraConfigUpdateEnum.birdseye, camera_name),
|
||||||
|
birdseye_settings,
|
||||||
|
)
|
||||||
self.publish(f"{camera_name}/birdseye_mode/state", payload, retain=True)
|
self.publish(f"{camera_name}/birdseye_mode/state", payload, retain=True)
|
||||||
|
|
||||||
def _on_camera_notification_command(self, camera_name: str, payload: str) -> None:
|
def _on_camera_notification_command(self, camera_name: str, payload: str) -> None:
|
||||||
|
|||||||
@ -15,7 +15,6 @@ from typing import Any, Optional
|
|||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from frigate.comms.config_updater import ConfigSubscriber
|
|
||||||
from frigate.config import BirdseyeModeEnum, FfmpegConfig, FrigateConfig
|
from frigate.config import BirdseyeModeEnum, FfmpegConfig, FrigateConfig
|
||||||
from frigate.const import BASE_DIR, BIRDSEYE_PIPE, INSTALL_DIR
|
from frigate.const import BASE_DIR, BIRDSEYE_PIPE, INSTALL_DIR
|
||||||
from frigate.util.image import (
|
from frigate.util.image import (
|
||||||
@ -754,7 +753,6 @@ class Birdseye:
|
|||||||
"birdseye", self.converter, websocket_server, stop_event
|
"birdseye", self.converter, websocket_server, stop_event
|
||||||
)
|
)
|
||||||
self.birdseye_manager = BirdsEyeFrameManager(config, stop_event)
|
self.birdseye_manager = BirdsEyeFrameManager(config, stop_event)
|
||||||
self.birdseye_subscriber = ConfigSubscriber("config/birdseye/")
|
|
||||||
self.frame_manager = SharedMemoryFrameManager()
|
self.frame_manager = SharedMemoryFrameManager()
|
||||||
self.stop_event = stop_event
|
self.stop_event = stop_event
|
||||||
|
|
||||||
@ -791,20 +789,6 @@ class Birdseye:
|
|||||||
frame_time: float,
|
frame_time: float,
|
||||||
frame: np.ndarray,
|
frame: np.ndarray,
|
||||||
) -> None:
|
) -> None:
|
||||||
# check if there is an updated config
|
|
||||||
while True:
|
|
||||||
(
|
|
||||||
updated_birdseye_topic,
|
|
||||||
updated_birdseye_config,
|
|
||||||
) = self.birdseye_subscriber.check_for_update()
|
|
||||||
|
|
||||||
if not updated_birdseye_topic:
|
|
||||||
break
|
|
||||||
|
|
||||||
if updated_birdseye_config:
|
|
||||||
camera_name = updated_birdseye_topic.rpartition("/")[-1]
|
|
||||||
self.config.cameras[camera_name].birdseye = updated_birdseye_config
|
|
||||||
|
|
||||||
if self.birdseye_manager.update(
|
if self.birdseye_manager.update(
|
||||||
camera,
|
camera,
|
||||||
len([o for o in current_tracked_objects if not o["stationary"]]),
|
len([o for o in current_tracked_objects if not o["stationary"]]),
|
||||||
@ -815,6 +799,5 @@ class Birdseye:
|
|||||||
self.__send_new_frame()
|
self.__send_new_frame()
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
self.birdseye_subscriber.stop()
|
|
||||||
self.converter.join()
|
self.converter.join()
|
||||||
self.broadcaster.join()
|
self.broadcaster.join()
|
||||||
|
|||||||
@ -103,7 +103,12 @@ def output_frames(
|
|||||||
|
|
||||||
detection_subscriber = DetectionSubscriber(DetectionTypeEnum.video)
|
detection_subscriber = DetectionSubscriber(DetectionTypeEnum.video)
|
||||||
config_subscriber = CameraConfigUpdateSubscriber(
|
config_subscriber = CameraConfigUpdateSubscriber(
|
||||||
config.cameras, [CameraConfigUpdateEnum.enabled, CameraConfigUpdateEnum.record]
|
config.cameras,
|
||||||
|
[
|
||||||
|
CameraConfigUpdateEnum.birdseye,
|
||||||
|
CameraConfigUpdateEnum.enabled,
|
||||||
|
CameraConfigUpdateEnum.record,
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
jsmpeg_cameras: dict[str, JsmpegCamera] = {}
|
jsmpeg_cameras: dict[str, JsmpegCamera] = {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user