mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Migrate Doorbird to has entity name (#98161)
This commit is contained in:
parent
914baaa2ba
commit
24add3f766
@ -85,9 +85,9 @@ class DoorBirdButton(DoorBirdEntity, ButtonEntity):
|
|||||||
self.entity_description = entity_description
|
self.entity_description = entity_description
|
||||||
|
|
||||||
if self._relay == IR_RELAY:
|
if self._relay == IR_RELAY:
|
||||||
self._attr_name = f"{self._doorstation.name} IR"
|
self._attr_name = "IR"
|
||||||
else:
|
else:
|
||||||
self._attr_name = f"{self._doorstation.name} Relay {self._relay}"
|
self._attr_name = f"Relay {self._relay}"
|
||||||
self._attr_unique_id = f"{self._mac_addr}_{self._relay}"
|
self._attr_unique_id = f"{self._mac_addr}_{self._relay}"
|
||||||
|
|
||||||
def press(self) -> None:
|
def press(self) -> None:
|
||||||
|
@ -49,7 +49,7 @@ async def async_setup_entry(
|
|||||||
doorstation_info,
|
doorstation_info,
|
||||||
device.live_image_url,
|
device.live_image_url,
|
||||||
"live",
|
"live",
|
||||||
f"{doorstation.name} Live",
|
"live",
|
||||||
doorstation.doorstation_events,
|
doorstation.doorstation_events,
|
||||||
_LIVE_INTERVAL,
|
_LIVE_INTERVAL,
|
||||||
device.rtsp_live_video_url,
|
device.rtsp_live_video_url,
|
||||||
@ -59,7 +59,7 @@ async def async_setup_entry(
|
|||||||
doorstation_info,
|
doorstation_info,
|
||||||
device.history_image_url(1, "doorbell"),
|
device.history_image_url(1, "doorbell"),
|
||||||
"last_ring",
|
"last_ring",
|
||||||
f"{doorstation.name} Last Ring",
|
"last_ring",
|
||||||
[],
|
[],
|
||||||
_LAST_VISITOR_INTERVAL,
|
_LAST_VISITOR_INTERVAL,
|
||||||
),
|
),
|
||||||
@ -68,7 +68,7 @@ async def async_setup_entry(
|
|||||||
doorstation_info,
|
doorstation_info,
|
||||||
device.history_image_url(1, "motionsensor"),
|
device.history_image_url(1, "motionsensor"),
|
||||||
"last_motion",
|
"last_motion",
|
||||||
f"{doorstation.name} Last Motion",
|
"last_motion",
|
||||||
[],
|
[],
|
||||||
_LAST_MOTION_INTERVAL,
|
_LAST_MOTION_INTERVAL,
|
||||||
),
|
),
|
||||||
@ -85,7 +85,7 @@ class DoorBirdCamera(DoorBirdEntity, Camera):
|
|||||||
doorstation_info,
|
doorstation_info,
|
||||||
url,
|
url,
|
||||||
camera_id,
|
camera_id,
|
||||||
name,
|
translation_key,
|
||||||
doorstation_events,
|
doorstation_events,
|
||||||
interval,
|
interval,
|
||||||
stream_url=None,
|
stream_url=None,
|
||||||
@ -94,7 +94,7 @@ class DoorBirdCamera(DoorBirdEntity, Camera):
|
|||||||
super().__init__(doorstation, doorstation_info)
|
super().__init__(doorstation, doorstation_info)
|
||||||
self._url = url
|
self._url = url
|
||||||
self._stream_url = stream_url
|
self._stream_url = stream_url
|
||||||
self._attr_name = name
|
self._attr_translation_key = translation_key
|
||||||
self._last_image: bytes | None = None
|
self._last_image: bytes | None = None
|
||||||
if self._stream_url:
|
if self._stream_url:
|
||||||
self._attr_supported_features = CameraEntityFeature.STREAM
|
self._attr_supported_features = CameraEntityFeature.STREAM
|
||||||
|
@ -16,6 +16,8 @@ from .util import get_mac_address_from_doorstation_info
|
|||||||
class DoorBirdEntity(Entity):
|
class DoorBirdEntity(Entity):
|
||||||
"""Base class for doorbird entities."""
|
"""Base class for doorbird entities."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(self, doorstation, doorstation_info):
|
def __init__(self, doorstation, doorstation_info):
|
||||||
"""Initialize the entity."""
|
"""Initialize the entity."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -33,5 +33,18 @@
|
|||||||
"unknown": "[%key:common::config_flow::error::unknown%]",
|
"unknown": "[%key:common::config_flow::error::unknown%]",
|
||||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"entity": {
|
||||||
|
"camera": {
|
||||||
|
"live": {
|
||||||
|
"name": "live"
|
||||||
|
},
|
||||||
|
"last_ring": {
|
||||||
|
"name": "Last ring"
|
||||||
|
},
|
||||||
|
"last_motion": {
|
||||||
|
"name": "Last motion"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user