mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Use shorthand attributes in push camera (#145273)
* Use shorthand attributes in push camera * Improve
This commit is contained in:
parent
c8183bd35a
commit
f9000ae08c
@ -61,7 +61,7 @@ async def async_setup_platform(
|
||||
if PUSH_CAMERA_DATA not in hass.data:
|
||||
hass.data[PUSH_CAMERA_DATA] = {}
|
||||
|
||||
webhook_id = config.get(CONF_WEBHOOK_ID)
|
||||
webhook_id = config[CONF_WEBHOOK_ID]
|
||||
|
||||
cameras = [
|
||||
PushCamera(
|
||||
@ -101,16 +101,27 @@ async def handle_webhook(
|
||||
class PushCamera(Camera):
|
||||
"""The representation of a Push camera."""
|
||||
|
||||
def __init__(self, hass, name, buffer_size, timeout, image_field, webhook_id):
|
||||
_attr_motion_detection_enabled = False
|
||||
name: str
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
name: str,
|
||||
buffer_size: int,
|
||||
timeout: timedelta,
|
||||
image_field: str,
|
||||
webhook_id: str,
|
||||
) -> None:
|
||||
"""Initialize push camera component."""
|
||||
super().__init__()
|
||||
self._name = name
|
||||
self._attr_name = name
|
||||
self._last_trip = None
|
||||
self._filename = None
|
||||
self._expired_listener = None
|
||||
self._timeout = timeout
|
||||
self.queue = deque([], buffer_size)
|
||||
self._current_image = None
|
||||
self.queue: deque[bytes] = deque([], buffer_size)
|
||||
self._current_image: bytes | None = None
|
||||
self._image_field = image_field
|
||||
self.webhook_id = webhook_id
|
||||
self.webhook_url = webhook.async_generate_url(hass, webhook_id)
|
||||
@ -171,16 +182,6 @@ class PushCamera(Camera):
|
||||
|
||||
return self._current_image
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of this camera."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def motion_detection_enabled(self):
|
||||
"""Camera Motion Detection Status."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user