Skip to content

Commit 6635bf5

Browse files
authored
Merge pull request #776 from dermotduffy/rtmp
fix: Remove [old] `rtmp` support
2 parents 4019772 + 60888ed commit 6635bf5

File tree

16 files changed

+42
-170
lines changed

16 files changed

+42
-170
lines changed

custom_components/frigate/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
ATTRIBUTE_LABELS,
4646
CONF_CAMERA_STATIC_IMAGE_HEIGHT,
4747
CONF_ENABLE_WEBRTC,
48+
CONF_RTMP_URL_TEMPLATE,
4849
DOMAIN,
4950
FRIGATE_RELEASES_URL,
5051
FRIGATE_VERSION_ERROR_CUTOFF,
@@ -206,11 +207,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
206207
except FrigateApiClientError as exc:
207208
raise ConfigEntryNotReady from exc
208209

209-
if AwesomeVersion(server_version.split("-")[0]) <= AwesomeVersion(
210+
if AwesomeVersion(server_version.split("-")[0]) < AwesomeVersion(
210211
FRIGATE_VERSION_ERROR_CUTOFF
211212
):
212213
_LOGGER.error(
213-
"Using a Frigate server (%s) with version %s <= %s which is not "
214+
"Using a Frigate server (%s) with version %s < %s which is not "
214215
"compatible -- you must upgrade: %s",
215216
entry.data[CONF_URL],
216217
server_version,
@@ -265,7 +266,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
265266
entity_registry.async_remove(entity_id)
266267

267268
# Remove old options.
268-
OLD_OPTIONS = [CONF_CAMERA_STATIC_IMAGE_HEIGHT, CONF_ENABLE_WEBRTC]
269+
OLD_OPTIONS = [
270+
CONF_CAMERA_STATIC_IMAGE_HEIGHT,
271+
CONF_ENABLE_WEBRTC,
272+
CONF_RTMP_URL_TEMPLATE,
273+
]
269274
if any(option in entry.options for option in OLD_OPTIONS):
270275
new_options = entry.options.copy()
271276
for option in OLD_OPTIONS:

custom_components/frigate/camera.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
ATTR_PTZ_ACTION,
4545
ATTR_PTZ_ARGUMENT,
4646
ATTR_START_TIME,
47-
CONF_RTMP_URL_TEMPLATE,
4847
CONF_RTSP_URL_TEMPLATE,
4948
DEVICE_CLASS_CAMERA,
5049
DOMAIN,
@@ -174,11 +173,7 @@ def __init__(
174173
# from motion camera entities on selectors
175174
self._attr_device_class = DEVICE_CLASS_CAMERA
176175
self._stream_source = None
177-
self._attr_is_streaming = (
178-
self._camera_config.get("rtmp", {}).get("enabled")
179-
or self._cam_name
180-
in self._frigate_config.get("go2rtc", {}).get("streams", {}).keys()
181-
)
176+
self._attr_is_streaming = True
182177
self._attr_is_recording = self._camera_config.get("record", {}).get("enabled")
183178
self._attr_motion_detection_enabled = self._camera_config.get("motion", {}).get(
184179
"enabled"
@@ -210,23 +205,6 @@ def __init__(
210205
self._stream_source = (
211206
f"rtsp://{URL(self._url).host}:8554/{self._cam_name}"
212207
)
213-
elif self._camera_config.get("rtmp", {}).get("enabled"):
214-
streaming_template = config_entry.options.get(
215-
CONF_RTMP_URL_TEMPLATE, ""
216-
).strip()
217-
218-
if streaming_template:
219-
# Can't use homeassistant.helpers.template as it requires hass which
220-
# is not available in the constructor, so use direct jinja2
221-
# template instead. This means templates cannot access HomeAssistant
222-
# state, but rather only the camera config.
223-
self._stream_source = Template(streaming_template).render(
224-
**self._camera_config
225-
)
226-
else:
227-
self._stream_source = (
228-
f"rtmp://{URL(self._url).host}/live/{self._cam_name}"
229-
)
230208

231209
@callback
232210
def _state_message_received(self, msg: ReceiveMessage) -> None:
@@ -287,9 +265,6 @@ def extra_state_attributes(self) -> dict[str, str]:
287265
@property
288266
def supported_features(self) -> CameraEntityFeature:
289267
"""Return supported features of this camera."""
290-
if not self._attr_is_streaming:
291-
return CameraEntityFeature(0)
292-
293268
return CameraEntityFeature.STREAM
294269

295270
async def async_camera_image(
@@ -310,8 +285,6 @@ async def async_camera_image(
310285

311286
async def stream_source(self) -> str | None:
312287
"""Return the source of the stream."""
313-
if not self._attr_is_streaming:
314-
return None
315288
return self._stream_source
316289

317290
async def async_enable_motion_detection(self) -> None:

custom_components/frigate/config_flow.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
CONF_MEDIA_BROWSER_ENABLE,
2121
CONF_NOTIFICATION_PROXY_ENABLE,
2222
CONF_NOTIFICATION_PROXY_EXPIRE_AFTER_SECONDS,
23-
CONF_RTMP_URL_TEMPLATE,
2423
CONF_RTSP_URL_TEMPLATE,
2524
DEFAULT_HOST,
2625
DOMAIN,
@@ -123,16 +122,6 @@ async def async_step_init(
123122
return self.async_abort(reason="only_advanced_options")
124123

125124
schema: dict[Any, Any] = {
126-
# The input URL is not validated as being a URL to allow for the
127-
# possibility the template input won't be a valid URL until after
128-
# it's rendered.
129-
vol.Optional(
130-
CONF_RTMP_URL_TEMPLATE,
131-
default=self._config_entry.options.get(
132-
CONF_RTMP_URL_TEMPLATE,
133-
"",
134-
),
135-
): str,
136125
# The input URL is not validated as being a URL to allow for the
137126
# possibility the template input won't be a valid URL until after
138127
# it's rendered.

custom_components/frigate/const.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Base component constants
44
NAME = "Frigate"
55
DOMAIN = "frigate"
6-
FRIGATE_VERSION_ERROR_CUTOFF = "0.12.1"
6+
FRIGATE_VERSION_ERROR_CUTOFF = "0.12.0"
77
FRIGATE_RELEASES_URL = "https://github.com/blakeblackshear/frigate/releases"
88
FRIGATE_RELEASE_TAG_URL = f"{FRIGATE_RELEASES_URL}/tag"
99

@@ -47,15 +47,17 @@
4747
ATTRIBUTE_LABELS = ["amazon", "face", "fedex", "license_plate", "ups"]
4848

4949
# Configuration and options
50-
CONF_CAMERA_STATIC_IMAGE_HEIGHT = "camera_image_height"
5150
CONF_MEDIA_BROWSER_ENABLE = "media_browser_enable"
5251
CONF_NOTIFICATION_PROXY_ENABLE = "notification_proxy_enable"
52+
CONF_NOTIFICATION_PROXY_EXPIRE_AFTER_SECONDS = "notification_proxy_expire_after_seconds"
5353
CONF_PASSWORD = "password"
5454
CONF_PATH = "path"
55-
CONF_RTMP_URL_TEMPLATE = "rtmp_url_template"
5655
CONF_RTSP_URL_TEMPLATE = "rtsp_url_template"
56+
57+
# Removed options
58+
CONF_CAMERA_STATIC_IMAGE_HEIGHT = "camera_image_height"
5759
CONF_ENABLE_WEBRTC = "enable_webrtc"
58-
CONF_NOTIFICATION_PROXY_EXPIRE_AFTER_SECONDS = "notification_proxy_expire_after_seconds"
60+
CONF_RTMP_URL_TEMPLATE = "rtmp_url_template"
5961

6062
# Defaults
6163
DEFAULT_NAME = DOMAIN

custom_components/frigate/translations/ca.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"config": {
33
"step": {
44
"user": {
5-
"description": "L'URL que utilitzeu per accedir a Frigate (p. ex. 'http://frigate:5000/')\\n\\nSi feu servir HassOS amb el complement, l'URL hauria de ser 'http://ccab4aaf-frigate:5000/' \\n\\nHome Assistant necessita accedir al port 5000 (api) i 1935 (rtmp) per a totes les funcions.\\n\\nLa integració configurarà sensors, càmeres i la funcionalitat del navegador multimèdia.\\n\\nSensors:\\n- Estadístiques per supervisar el rendiment de Frigate\\n- Recompte d'objectes per a totes les zones i càmeres\\n\\nCàmeres:\\n- Càmeres per a la imatge de l'últim objecte detectat per a cada càmera\\n- Entitats de càmera amb suport de transmissió (requereix RTMP)\\n\\nNavegador multimèdia:\\n - Interfície d'usuari enriquida amb miniatures per explorar clips d'esdeveniments\\n- Interfície d'usuari enriquida per navegar per enregistraments les 24 hores al dia, els set dies a la setmana, per mes, dia, càmera, hora\\n\\nAPI:\\n- API de notificació amb punts de connexió públics per a imatges a les notificacions.",
5+
"description": "L'URL que utilitzeu per accedir a Frigate (p. ex. 'http://frigate:5000/')\\n\\nSi feu servir HassOS amb el complement, l'URL hauria de ser 'http://ccab4aaf-frigate:5000/' \\n\\nHome Assistant necessita accedir al port 5000 (api) i 8554/8555 (rtsp, webrtc) per a totes les funcions.\\n\\nLa integració configurarà sensors, càmeres i la funcionalitat del navegador multimèdia.\\n\\nSensors:\\n- Estadístiques per supervisar el rendiment de Frigate\\n- Recompte d'objectes per a totes les zones i càmeres\\n\\nCàmeres:\\n- Càmeres per a la imatge de l'últim objecte detectat per a cada càmera\\n- Entitats de càmera amb suport de transmissió\\n\\nNavegador multimèdia:\\n - Interfície d'usuari enriquida amb miniatures per explorar clips d'esdeveniments\\n- Interfície d'usuari enriquida per navegar per enregistraments les 24 hores al dia, els set dies a la setmana, per mes, dia, càmera, hora\\n\\nAPI:\\n- API de notificació amb punts de connexió públics per a imatges a les notificacions.",
66
"data": {
77
"url": "URL"
88
}
@@ -20,7 +20,6 @@
2020
"step": {
2121
"init": {
2222
"data": {
23-
"rtmp_url_template": "Plantilla de l'URL del RTMP (vegeu la documentació)",
2423
"rtsp_url_template": "Plantilla de l'URL del RTSP (vegeu la documentació)",
2524
"media_browser_enable": "Habiliteu el navegador multimèdia",
2625
"notification_proxy_enable": "Habiliteu el servidor intermediari no autenticat d'esdeveniments de notificacions",

custom_components/frigate/translations/de.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"config": {
33
"step": {
44
"user": {
5-
"description": "URL, die Sie für den Zugriff auf Frigate verwenden (z. B. \"http://frigate:5000/\")\n\nWenn Sie HassOS mit dem Addon verwenden, sollte die URL „http://ccab4aaf-frigate:5000/“ lauten\n\nHome Assistant benötigt für alle Funktionen Zugriff auf Port 5000 (api) und 1935 (rtmp).\n\nDie Integration richtet Sensoren, Kameras und Medienbrowser-Funktionen ein.\n\nSensoren:\n- Statistiken zur Überwachung der Frigate-Leistung\n- Objektzählungen für alle Zonen und Kameras\n\nKameras:\n- Kameras für Bild des zuletzt erkannten Objekts für jede Kamera\n- Kameraeinheiten mit Stream-Unterstützung (erfordert RTMP)\n\nMedienbrowser:\n- Umfangreiche Benutzeroberfläche mit Vorschaubildern zum Durchsuchen von Event-Clips\n- Umfangreiche Benutzeroberfläche zum Durchsuchen von 24/7-Aufzeichnungen nach Monat, Tag, Kamera und Uhrzeit\n\nAPI:\n- Benachrichtigungs-API mit öffentlich zugänglichen Endpunkten für Bilder in Benachrichtigungen",
5+
"description": "URL, die Sie für den Zugriff auf Frigate verwenden (z. B. \"http://frigate:5000/\")\n\nWenn Sie HassOS mit dem Addon verwenden, sollte die URL „http://ccab4aaf-frigate:5000/“ lauten\n\nHome Assistant benötigt für alle Funktionen Zugriff auf Port 5000 (api) und 8554/8555 (rtsp, webrtc).\n\nDie Integration richtet Sensoren, Kameras und Medienbrowser-Funktionen ein.\n\nSensoren:\n- Statistiken zur Überwachung der Frigate-Leistung\n- Objektzählungen für alle Zonen und Kameras\n\nKameras:\n- Kameras für Bild des zuletzt erkannten Objekts für jede Kamera\n- Kameraeinheiten mit Stream-Unterstützung\n\nMedienbrowser:\n- Umfangreiche Benutzeroberfläche mit Vorschaubildern zum Durchsuchen von Event-Clips\n- Umfangreiche Benutzeroberfläche zum Durchsuchen von 24/7-Aufzeichnungen nach Monat, Tag, Kamera und Uhrzeit\n\nAPI:\n- Benachrichtigungs-API mit öffentlich zugänglichen Endpunkten für Bilder in Benachrichtigungen",
66
"data": {
77
"url": "URL"
88
}
@@ -20,7 +20,6 @@
2020
"step": {
2121
"init": {
2222
"data": {
23-
"rtmp_url_template": "RTMP-URL-Vorlage (siehe Dokumentation)",
2423
"rtsp_url_template": "RTSP-URL-Vorlage (siehe Dokumentation)",
2524
"media_browser_enable": "Aktivieren Sie den Medienbrowser",
2625
"notification_proxy_enable": "Aktivieren Sie den Proxy für nicht authentifizierte Benachrichtigungsereignisse",

custom_components/frigate/translations/en.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"config": {
33
"step": {
44
"user": {
5-
"description": "URL you use to access Frigate (ie. `http://frigate:5000/`)\n\nIf you are using HassOS with the addon, the URL should be `http://ccab4aaf-frigate:5000/`\n\nHome Assistant needs access to port 5000 (api) and 1935 (rtmp) for all features.\n\nThe integration will setup sensors, cameras, and media browser functionality.\n\nSensors:\n- Stats to monitor frigate performance\n- Object counts for all zones and cameras\n\nCameras:\n- Cameras for image of the last detected object for each camera\n- Camera entities with stream support (requires RTMP)\n\nMedia Browser:\n- Rich UI with thumbnails for browsing event clips\n- Rich UI for browsing 24/7 recordings by month, day, camera, time\n\nAPI:\n- Notification API with public facing endpoints for images in notifications",
5+
"description": "URL you use to access Frigate (ie. `http://frigate:5000/`)\n\nIf you are using HassOS with the addon, the URL should be `http://ccab4aaf-frigate:5000/`\n\nHome Assistant needs access to port 5000 (api) and 8554/8555 (rtsp, webrtc) for all features.\n\nThe integration will setup sensors, cameras, and media browser functionality.\n\nSensors:\n- Stats to monitor frigate performance\n- Object counts for all zones and cameras\n\nCameras:\n- Cameras for image of the last detected object for each camera\n- Camera entities with stream support\n\nMedia Browser:\n- Rich UI with thumbnails for browsing event clips\n- Rich UI for browsing 24/7 recordings by month, day, camera, time\n\nAPI:\n- Notification API with public facing endpoints for images in notifications",
66
"data": {
77
"url": "URL"
88
}
@@ -20,7 +20,6 @@
2020
"step": {
2121
"init": {
2222
"data": {
23-
"rtmp_url_template": "RTMP URL template (see documentation)",
2423
"rtsp_url_template": "RTSP URL template (see documentation)",
2524
"media_browser_enable": "Enable the media browser",
2625
"notification_proxy_enable": "Enable the unauthenticated notification event proxy",

custom_components/frigate/translations/fr.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"config": {
33
"step": {
44
"user": {
5-
"description": "URL que vous utilisez pour accéder à Frigate (par exemple, `http://frigate:5000/`)\n\nSi vous utilisez HassOS avec l'addon, l'URL devrait être `http://ccab4aaf-frigate:5000/`\n\nHome Assistant a besoin d'accès au port 5000 (api) et 1935 (rtmp) pour toutes les fonctionnalités.\n\nL'intégration configurera des capteurs, des caméras et la fonctionnalité de navigateur multimédia.\n\nCapteurs :\n- Statistiques pour surveiller la performance de Frigate\n- Comptes d'objets pour toutes les zones et caméras\n\nCaméras :\n- Caméras pour l'image du dernier objet détecté pour chaque caméra\n- Entités de caméra avec support de flux (nécessite RTMP)\n\nNavigateur multimédia :\n- Interface riche avec miniatures pour parcourir les clips d'événements\n- Interface riche pour parcourir les enregistrements 24/7 par mois, jour, caméra, heure\n\nAPI :\n- API de notification avec des points de terminaison publics pour les images dans les notifications",
5+
"description": "URL que vous utilisez pour accéder à Frigate (par exemple, `http://frigate:5000/`)\n\nSi vous utilisez HassOS avec l'addon, l'URL devrait être `http://ccab4aaf-frigate:5000/`\n\nHome Assistant a besoin d'accès au port 5000 (api) et 8554/8555 (rtsp, webrtc) pour toutes les fonctionnalités.\n\nL'intégration configurera des capteurs, des caméras et la fonctionnalité de navigateur multimédia.\n\nCapteurs :\n- Statistiques pour surveiller la performance de Frigate\n- Comptes d'objets pour toutes les zones et caméras\n\nCaméras :\n- Caméras pour l'image du dernier objet détecté pour chaque caméra\n- Entités de caméra avec support de flux\n\nNavigateur multimédia :\n- Interface riche avec miniatures pour parcourir les clips d'événements\n- Interface riche pour parcourir les enregistrements 24/7 par mois, jour, caméra, heure\n\nAPI :\n- API de notification avec des points de terminaison publics pour les images dans les notifications",
66
"data": {
77
"url": "URL"
88
}
@@ -20,7 +20,6 @@
2020
"step": {
2121
"init": {
2222
"data": {
23-
"rtmp_url_template": "Modèle d'URL RTMP (voir la documentation)",
2423
"rtsp_url_template": "Modèle d'URL RTSP (voir la documentation)",
2524
"media_browser_enable": "Activer le navigateur multimédia",
2625
"notification_proxy_enable": "Activer le proxy d'événement de notification non authentifié",

custom_components/frigate/translations/pt-BR.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"config": {
33
"step": {
44
"user": {
5-
"description": "URL que você usa para acessar o Frigate (ou seja, `http://frigate:5000/`)\n\nSe você estiver usando HassOS com o complemento, o URL deve ser `http://ccab4aaf-frigate:5000/`\n\nO Home Assistant precisa de acesso à porta 5000 (api) e 1935 (rtmp) para ter todos os recursos.\n\nA integração configurará sensores, câmeras e funcionalidades do navegador de mídia.\n\nSensores:\n- Estatísticas para monitorar o desempenho do frigate \n- Contagem de objetos para todas as zonas e câmeras\n\nCâmeras:\n- Câmeras para imagem do último objeto detectado para cada câmera\n- Entidades da câmera com suporte a stream (requer RTMP)\n\nNavegador de mídia:\n- UI avançada com miniaturas para navegar em clipes de eventos\n- UI avançada para navegar 24 horas por dia, 7 dias por semana e por mês, dia, câmera, hora\n\nAPI:\n- API de notificação com endpoints voltados para o público para imagens em notificações",
5+
"description": "URL que você usa para acessar o Frigate (ou seja, `http://frigate:5000/`)\n\nSe você estiver usando HassOS com o complemento, o URL deve ser `http://ccab4aaf-frigate:5000/`\n\nO Home Assistant precisa de acesso à porta 5000 (api) e 8554/8555 (rtsp, webrtc) para ter todos os recursos.\n\nA integração configurará sensores, câmeras e funcionalidades do navegador de mídia.\n\nSensores:\n- Estatísticas para monitorar o desempenho do frigate \n- Contagem de objetos para todas as zonas e câmeras\n\nCâmeras:\n- Câmeras para imagem do último objeto detectado para cada câmera\n- Entidades da câmera com suporte a stream\n\nNavegador de mídia:\n- UI avançada com miniaturas para navegar em clipes de eventos\n- UI avançada para navegar 24 horas por dia, 7 dias por semana e por mês, dia, câmera, hora\n\nAPI:\n- API de notificação com endpoints voltados para o público para imagens em notificações",
66
"data": {
77
"url": "URL"
88
}
@@ -20,7 +20,6 @@
2020
"step": {
2121
"init": {
2222
"data": {
23-
"rtmp_url_template": "Modelo de URL RTMP (consulte a documentação)",
2423
"rtsp_url_template": "Modelo de URL RTSP (consulte a documentação)",
2524
"notification_proxy_enable": "Habilitar o proxy de evento de notificação não autenticado",
2625
"notification_proxy_expire_after_seconds": "Proibir acesso de notificação não autenticado após segundos (0=nunca)",

0 commit comments

Comments
 (0)