Skip to content

Commit

Permalink
Merge pull request #27 from prairiesnpr/master
Browse files Browse the repository at this point in the history
Snapshot camera state based on image
  • Loading branch information
blakeblackshear authored Feb 4, 2021
2 parents cecc1ae + 8c95c7d commit b7b094f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion custom_components/frigate/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)

from .const import (
DOMAIN, NAME, VERSION
DOMAIN, NAME, VERSION, STATE_DETECTED, STATE_IDLE
)

_LOGGER: logging.Logger = logging.getLogger(__package__)
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions custom_components/frigate/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@
{ISSUE_URL}
-------------------------------------------------------------------
"""

# States
STATE_DETECTED = "active"
STATE_IDLE = "idle"

0 comments on commit b7b094f

Please sign in to comment.