mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-02 13:24:53 +03:00
publish camera state when changing profiles
This commit is contained in:
parent
eeeec2db86
commit
56679a041b
@ -352,7 +352,9 @@ class FrigateApp:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def init_profile_manager(self) -> None:
|
def init_profile_manager(self) -> None:
|
||||||
self.profile_manager = ProfileManager(self.config, self.inter_config_updater)
|
self.profile_manager = ProfileManager(
|
||||||
|
self.config, self.inter_config_updater, self.dispatcher
|
||||||
|
)
|
||||||
self.dispatcher.profile_manager = self.profile_manager
|
self.dispatcher.profile_manager = self.profile_manager
|
||||||
|
|
||||||
persisted = ProfileManager.load_persisted_profile()
|
persisted = ProfileManager.load_persisted_profile()
|
||||||
|
|||||||
@ -42,11 +42,13 @@ class ProfileManager:
|
|||||||
self,
|
self,
|
||||||
config,
|
config,
|
||||||
config_updater: CameraConfigUpdatePublisher,
|
config_updater: CameraConfigUpdatePublisher,
|
||||||
|
dispatcher=None,
|
||||||
):
|
):
|
||||||
from frigate.config.config import FrigateConfig
|
from frigate.config.config import FrigateConfig
|
||||||
|
|
||||||
self.config: FrigateConfig = config
|
self.config: FrigateConfig = config
|
||||||
self.config_updater = config_updater
|
self.config_updater = config_updater
|
||||||
|
self.dispatcher = dispatcher
|
||||||
self._base_configs: dict[str, dict[str, dict]] = {}
|
self._base_configs: dict[str, dict[str, dict]] = {}
|
||||||
self._base_api_configs: dict[str, dict[str, dict]] = {}
|
self._base_api_configs: dict[str, dict[str, dict]] = {}
|
||||||
self._base_enabled: dict[str, bool] = {}
|
self._base_enabled: dict[str, bool] = {}
|
||||||
@ -266,6 +268,12 @@ class ProfileManager:
|
|||||||
),
|
),
|
||||||
cam_config.enabled,
|
cam_config.enabled,
|
||||||
)
|
)
|
||||||
|
if self.dispatcher is not None:
|
||||||
|
self.dispatcher.publish(
|
||||||
|
f"{cam_name}/enabled/state",
|
||||||
|
"ON" if cam_config.enabled else "OFF",
|
||||||
|
retain=True,
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if section == "zones":
|
if section == "zones":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user