Handle Shelly get name on uninitialized device (#53917)

This commit is contained in:
Paulus Schoutsen 2021-08-03 11:16:00 -07:00 committed by GitHub
parent df03cce471
commit 71375be54d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,7 +29,7 @@ def async_describe_events(
def async_describe_shelly_click_event(event: EventType) -> dict[str, str]:
"""Describe shelly.click logbook event."""
wrapper = get_device_wrapper(hass, event.data[ATTR_DEVICE_ID])
if wrapper:
if wrapper and wrapper.device.initialized:
device_name = get_device_name(wrapper.device)
else:
device_name = event.data[ATTR_DEVICE]