Fix ESPHome state watching when new state is None (#59528)

This commit is contained in:
Jesse Hills 2021-11-15 04:49:45 +13:00 committed by GitHub
parent 3175bca37d
commit e5129042ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -225,7 +225,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Forward Home Assistant states updates to ESPHome."""
# Only communicate changes to the state or attribute tracked
if (
if event.data.get("new_state") is None or (
event.data.get("old_state") is not None
and "new_state" in event.data
and (