Protect against last_comms being None (#149366)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
RogerSelwyn
2025-09-26 20:36:22 +00:00
committed by Franck Nijhof
co-authored by Joost Lekkerkerker
parent 6aaddad56b
commit 750e849f09
+4 -4
View File
@@ -77,10 +77,10 @@ class GeniusDevice(GeniusEntity):
async def async_update(self) -> None:
"""Update an entity's state data."""
if "_state" in self._device.data: # only via v3 API
self._last_comms = dt_util.utc_from_timestamp(
self._device.data["_state"]["lastComms"]
)
if (state := self._device.data.get("_state")) and (
last_comms := state.get("lastComms")
) is not None: # only via v3 API
self._last_comms = dt_util.utc_from_timestamp(last_comms)
class GeniusZone(GeniusEntity):