Compare commits

..

No commits in common. "fa3c7a44d2c27a868d28fc276783d2c0e0de6e6d" and "78bc11d7e0a01eeef1363778c88ccbaeae7052dc" have entirely different histories.

3 changed files with 24 additions and 4 deletions

View File

@ -283,6 +283,17 @@ Topic to activate or deactivate a [profile](/configuration/profiles). Publish a
Topic with the currently active profile name. Published value is the profile name or `none` if no profile is active. This topic is retained. Topic with the currently active profile name. Published value is the profile name or `none` if no profile is active. This topic is retained.
### `frigate/profiles/available`
Topic with a JSON array of all available profile definitions. Published on startup as a retained message.
```json
[
{ "name": "away", "friendly_name": "Away" },
{ "name": "home", "friendly_name": "Home" }
]
```
### `frigate/notifications/set` ### `frigate/notifications/set`
Topic to turn notifications on and off. Expected values are `ON` and `OFF`. Topic to turn notifications on and off. Expected values are `ON` and `OFF`.

View File

@ -29,13 +29,11 @@ from frigate.api import (
review, review,
) )
from frigate.api.auth import get_jwt_secret, limiter, require_admin_by_default from frigate.api.auth import get_jwt_secret, limiter, require_admin_by_default
from frigate.comms.dispatcher import Dispatcher
from frigate.comms.event_metadata_updater import ( from frigate.comms.event_metadata_updater import (
EventMetadataPublisher, EventMetadataPublisher,
) )
from frigate.config import FrigateConfig from frigate.config import FrigateConfig
from frigate.config.camera.updater import CameraConfigUpdatePublisher from frigate.config.camera.updater import CameraConfigUpdatePublisher
from frigate.config.profile_manager import ProfileManager
from frigate.debug_replay import DebugReplayManager from frigate.debug_replay import DebugReplayManager
from frigate.embeddings import EmbeddingsContext from frigate.embeddings import EmbeddingsContext
from frigate.genai import GenAIClientManager from frigate.genai import GenAIClientManager
@ -71,8 +69,8 @@ def create_fastapi_app(
event_metadata_updater: EventMetadataPublisher, event_metadata_updater: EventMetadataPublisher,
config_publisher: CameraConfigUpdatePublisher, config_publisher: CameraConfigUpdatePublisher,
replay_manager: DebugReplayManager, replay_manager: DebugReplayManager,
dispatcher: Optional[Dispatcher] = None, dispatcher=None,
profile_manager: Optional[ProfileManager] = None, profile_manager=None,
enforce_default_admin: bool = True, enforce_default_admin: bool = True,
): ):
logger.info("Starting FastAPI app") logger.info("Starting FastAPI app")

View File

@ -1,3 +1,4 @@
import json
import logging import logging
import threading import threading
from typing import Any, Callable from typing import Any, Callable
@ -168,6 +169,16 @@ class MqttClient(Communicator):
self.config.active_profile or "none", self.config.active_profile or "none",
retain=True, retain=True,
) )
available_profiles = [
{"name": name, "friendly_name": defn.friendly_name}
for name, defn in sorted(self.config.profiles.items())
]
self.publish(
"profiles/available",
json.dumps(available_profiles),
retain=True,
)
self.publish("available", "online", retain=True) self.publish("available", "online", retain=True)
def on_mqtt_command( def on_mqtt_command(