publish camera state when changing profiles

This commit is contained in:
Josh Hawkins 2026-03-16 13:41:30 -05:00
parent eeeec2db86
commit 56679a041b
2 changed files with 11 additions and 1 deletions

View File

@ -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()

View File

@ -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":