1 """Support for August doorbell camera."""
3 from __future__
import annotations
7 from aiohttp
import ClientSession
8 from yalexs.activity
import ActivityType
9 from yalexs.doorbell
import Doorbell
10 from yalexs.util
import update_doorbell_image_from_activity
17 from .
import AugustConfigEntry, AugustData
18 from .const
import DEFAULT_NAME, DEFAULT_TIMEOUT
19 from .entity
import AugustEntity
21 _LOGGER = logging.getLogger(__name__)
26 config_entry: AugustConfigEntry,
27 async_add_entities: AddEntitiesCallback,
29 """Set up August cameras."""
30 data = config_entry.runtime_data
34 session = aiohttp_client.async_create_clientsession(hass)
37 for doorbell
in data.doorbells
42 """An implementation of an August security camera."""
44 _attr_translation_key =
"camera"
45 _attr_motion_detection_enabled =
True
46 _attr_brand = DEFAULT_NAME
47 _image_url: str |
None =
None
48 _image_content: bytes |
None =
None
51 self, data: AugustData, device: Doorbell, session: ClientSession, timeout: int
53 """Initialize an August security camera."""
54 super().
__init__(data, device,
"camera")
61 """Return true if the device is recording."""
62 return self.
_device_device.has_subscription
66 _LOGGER.debug(
"async_update called %s", self.
_detail_detail.device_name)
72 """Get the latest state of the sensor."""
73 if doorbell_activity := self.
_get_latest_get_latest(
74 {ActivityType.DOORBELL_MOTION, ActivityType.DOORBELL_IMAGE_CAPTURE}
76 update_doorbell_image_from_activity(self.
_detail_detail, doorbell_activity)
79 self, width: int |
None =
None, height: int |
None =
None
81 """Return bytes of camera image."""
None __init__(self, AugustData data, Doorbell device, ClientSession session, int timeout)
None _update_from_data(self)
bytes|None async_camera_image(self, int|None width=None, int|None height=None)
DoorbellDetail|LockDetail _detail(self)
Activity|None _get_latest(self, set[ActivityType] activity_types)
None _update_from_data(self)
None async_setup_entry(HomeAssistant hass, AugustConfigEntry config_entry, AddEntitiesCallback async_add_entities)