Use assignment expressions 32 (#58716)
This commit is contained in:
parent
a48ddcadd4
commit
887d04be60
16 changed files with 27 additions and 45 deletions
|
@ -102,8 +102,7 @@ class IncidentsSensor(RestoreEntity, SensorEntity):
|
|||
"""Run when about to be added to hass."""
|
||||
await super().async_added_to_hass()
|
||||
|
||||
state = await self.async_get_last_state()
|
||||
if state:
|
||||
if state := await self.async_get_last_state():
|
||||
self._state = state.state
|
||||
self._state_attributes = state.attributes
|
||||
if "id" in self._state_attributes:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue