Use assignment expressions 17 (#57963)
Co-authored-by: Tobias Sauerwein <cgtobi@users.noreply.github.com>
This commit is contained in:
parent
326a302c22
commit
9a58bfdf41
15 changed files with 30 additions and 56 deletions
|
@ -305,12 +305,12 @@ class RfxtrxSensor(RfxtrxEntity, SensorEntity):
|
|||
"""Restore device state."""
|
||||
await super().async_added_to_hass()
|
||||
|
||||
if self._event is None:
|
||||
old_state = await self.async_get_last_state()
|
||||
if old_state is not None:
|
||||
event = old_state.attributes.get(ATTR_EVENT)
|
||||
if event:
|
||||
self._apply_event(get_rfx_object(event))
|
||||
if (
|
||||
self._event is None
|
||||
and (old_state := await self.async_get_last_state()) is not None
|
||||
and (event := old_state.attributes.get(ATTR_EVENT))
|
||||
):
|
||||
self._apply_event(get_rfx_object(event))
|
||||
|
||||
@property
|
||||
def native_value(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue