Address yale review comments (#124810)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
J. Nick Koston 2024-08-28 09:00:52 -10:00 committed by GitHub
parent 2900fa733d
commit 70488ffd15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 267 additions and 283 deletions

View file

@ -63,22 +63,17 @@ async def async_setup_entry(
) -> None:
"""Set up the yale event platform."""
data = config_entry.runtime_data
entities: list[YaleEventEntity] = []
for lock in data.locks:
detail = data.get_device_detail(lock.device_id)
if detail.doorbell:
entities.extend(
YaleEventEntity(data, lock, description)
for description in TYPES_DOORBELL
)
for doorbell in data.doorbells:
entities.extend(
YaleEventEntity(data, doorbell, description)
for description in TYPES_DOORBELL + TYPES_VIDEO_DOORBELL
)
entities: list[YaleEventEntity] = [
YaleEventEntity(data, lock, description)
for description in TYPES_DOORBELL
for lock in data.locks
if (detail := data.get_device_detail(lock.device_id)) and detail.doorbell
]
entities.extend(
YaleEventEntity(data, doorbell, description)
for description in TYPES_DOORBELL + TYPES_VIDEO_DOORBELL
for doorbell in data.doorbells
)
async_add_entities(entities)
@ -86,7 +81,6 @@ class YaleEventEntity(YaleDescriptionEntity, EventEntity):
"""An yale event entity."""
entity_description: YaleEventEntityDescription
_attr_has_entity_name = True
_last_activity: Activity | None = None
@callback