diff --git a/custom_components/frigate/camera.py b/custom_components/frigate/camera.py index 7eadd477..e6e86497 100644 --- a/custom_components/frigate/camera.py +++ b/custom_components/frigate/camera.py @@ -69,7 +69,8 @@ def __init__( self._cam_name = cam_name self._camera_config = camera_config self._url = config_entry.data[CONF_URL] - self._stream_enabled = self._camera_config["rtmp"]["enabled"] + self._attr_is_streaming = self._camera_config.get("rtmp", {}).get("enabled") + self._attr_is_recording = self._camera_config.get("record", {}).get("enabled") streaming_template = config_entry.options.get( CONF_RTMP_URL_TEMPLATE, "" @@ -116,7 +117,7 @@ def device_info(self) -> dict[str, Any]: @property def supported_features(self) -> int: """Return supported features of this camera.""" - if not self._stream_enabled: + if not self._attr_is_streaming: return 0 return cast(int, SUPPORT_STREAM) @@ -138,7 +139,7 @@ async def async_camera_image( async def stream_source(self) -> str | None: """Return the source of the stream.""" - if not self._stream_enabled: + if not self._attr_is_streaming: return None return self._stream_source diff --git a/tests/test_camera.py b/tests/test_camera.py index 44fb8f5a..d381254a 100644 --- a/tests/test_camera.py +++ b/tests/test_camera.py @@ -38,7 +38,7 @@ async def test_frigate_camera_setup( entity_state = hass.states.get(TEST_CAMERA_FRONT_DOOR_ENTITY_ID) assert entity_state - assert entity_state.state == "idle" + assert entity_state.state == "streaming" assert entity_state.attributes["supported_features"] == 2 source = await async_get_stream_source(hass, TEST_CAMERA_FRONT_DOOR_ENTITY_ID)