Add save clips to Blink services (#84149)

This commit is contained in:
Brent Perdue
2023-06-01 14:06:53 -04:00
committed by GitHub
parent a1a055f618
commit 23ca26ae56
6 changed files with 90 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
"""Support for Blink system camera control."""
from __future__ import annotations
import logging
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
@@ -20,6 +22,8 @@ from .const import (
TYPE_MOTION_DETECTED,
)
_LOGGER = logging.getLogger(__name__)
BINARY_SENSORS_TYPES: tuple[BinarySensorEntityDescription, ...] = (
BinarySensorEntityDescription(
key=TYPE_BATTERY,
@@ -74,8 +78,13 @@ class BlinkBinarySensor(BinarySensorEntity):
def update(self) -> None:
"""Update sensor state."""
self.data.refresh()
state = self._camera.attributes[self.entity_description.key]
_LOGGER.debug(
"'%s' %s = %s",
self._camera.attributes["name"],
self.entity_description.key,
state,
)
if self.entity_description.key == TYPE_BATTERY:
state = state != "ok"
self._attr_is_on = state