diff --git a/custom_components/frigate/camera.py b/custom_components/frigate/camera.py index b2532854..d501a5da 100644 --- a/custom_components/frigate/camera.py +++ b/custom_components/frigate/camera.py @@ -15,7 +15,7 @@ ) from .const import ( - DOMAIN, NAME, VERSION + DOMAIN, NAME, VERSION, STATE_DETECTED, STATE_IDLE ) _LOGGER: logging.Logger = logging.getLogger(__package__) @@ -200,3 +200,10 @@ async def async_camera_image(self): @property def available(self) -> bool: return self._available + + @property + def state(self): + """Return the camera state.""" + if self._last_image is None: + return STATE_IDLE + return STATE_DETECTED diff --git a/custom_components/frigate/const.py b/custom_components/frigate/const.py index 4e6b2af1..c11f1141 100644 --- a/custom_components/frigate/const.py +++ b/custom_components/frigate/const.py @@ -41,3 +41,7 @@ {ISSUE_URL} ------------------------------------------------------------------- """ + +# States +STATE_DETECTED = "active" +STATE_IDLE = "idle"