mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +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
|
||||
|
||||
if self._relay == IR_RELAY:
|
||||
self._attr_name = f"{self._doorstation.name} IR"
|
||||
self._attr_name = "IR"
|
||||
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}"
|
||||
|
||||
def press(self) -> None:
|
||||
|
@ -49,7 +49,7 @@ async def async_setup_entry(
|
||||
doorstation_info,
|
||||
device.live_image_url,
|
||||
"live",
|
||||
f"{doorstation.name} Live",
|
||||
"live",
|
||||
doorstation.doorstation_events,
|
||||
_LIVE_INTERVAL,
|
||||
device.rtsp_live_video_url,
|
||||
@ -59,7 +59,7 @@ async def async_setup_entry(
|
||||
doorstation_info,
|
||||
device.history_image_url(1, "doorbell"),
|
||||
"last_ring",
|
||||
f"{doorstation.name} Last Ring",
|
||||
"last_ring",
|
||||
[],
|
||||
_LAST_VISITOR_INTERVAL,
|
||||
),
|
||||
@ -68,7 +68,7 @@ async def async_setup_entry(
|
||||
doorstation_info,
|
||||
device.history_image_url(1, "motionsensor"),
|
||||
"last_motion",
|
||||
f"{doorstation.name} Last Motion",
|
||||
"last_motion",
|
||||
[],
|
||||
_LAST_MOTION_INTERVAL,
|
||||
),
|
||||
@ -85,7 +85,7 @@ class DoorBirdCamera(DoorBirdEntity, Camera):
|
||||
doorstation_info,
|
||||
url,
|
||||
camera_id,
|
||||
name,
|
||||
translation_key,
|
||||
doorstation_events,
|
||||
interval,
|
||||
stream_url=None,
|
||||
@ -94,7 +94,7 @@ class DoorBirdCamera(DoorBirdEntity, Camera):
|
||||
super().__init__(doorstation, doorstation_info)
|
||||
self._url = url
|
||||
self._stream_url = stream_url
|
||||
self._attr_name = name
|
||||
self._attr_translation_key = translation_key
|
||||
self._last_image: bytes | None = None
|
||||
if self._stream_url:
|
||||
self._attr_supported_features = CameraEntityFeature.STREAM
|
||||
|
@ -16,6 +16,8 @@ from .util import get_mac_address_from_doorstation_info
|
||||
class DoorBirdEntity(Entity):
|
||||
"""Base class for doorbird entities."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, doorstation, doorstation_info):
|
||||
"""Initialize the entity."""
|
||||
super().__init__()
|
||||
|
@ -33,5 +33,18 @@
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]",
|
||||
"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