Fix exception in doorbird logbook during startup (#74649)
* Fix exception in doorbird logbook during startup Fixes ``` 2022-07-07 16:50:33.203 ERROR (MainThread) [homeassistant.helpers.integration_platform] Error processing platform doorbird.logbook Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/integration_platform.py", line 51, in _async_process_single_integration_platform_component await integration_platform.process_platform(hass, component_name, platform) File "/usr/src/homeassistant/homeassistant/components/logbook/__init__.py", line 159, in _process_logbook_platform platform.async_describe_events(hass, _async_describe_event) File "/usr/src/homeassistant/homeassistant/components/doorbird/logbook.py", line 43, in async_describe_events door_station = data[DOOR_STATION] KeyError: door_station ``` * py39
This commit is contained in:
parent
d3db4da11a
commit
ff877b8144
1 changed files with 9 additions and 5 deletions
|
@ -1,4 +1,7 @@
|
|||
"""Describe logbook events."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.logbook.const import (
|
||||
LOGBOOK_ENTRY_ENTITY_ID,
|
||||
|
@ -28,12 +31,13 @@ def async_describe_events(hass, async_describe_event):
|
|||
].get(doorbird_event, event.data.get(ATTR_ENTITY_ID)),
|
||||
}
|
||||
|
||||
domain_data = hass.data[DOMAIN]
|
||||
domain_data: dict[str, Any] = hass.data[DOMAIN]
|
||||
|
||||
for config_entry_id in domain_data:
|
||||
door_station = domain_data[config_entry_id][DOOR_STATION]
|
||||
|
||||
for event in door_station.doorstation_events:
|
||||
for data in domain_data.values():
|
||||
if DOOR_STATION not in data:
|
||||
# We need to skip door_station_event_entity_ids
|
||||
continue
|
||||
for event in data[DOOR_STATION].doorstation_events:
|
||||
async_describe_event(
|
||||
DOMAIN, f"{DOMAIN}_{event}", async_describe_logbook_event
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue