Use assignment expressions 31 (#58715)
This commit is contained in:
parent
f7dea3aa1d
commit
a48ddcadd4
26 changed files with 27 additions and 58 deletions
|
@ -124,8 +124,7 @@ class IntegrationSensor(RestoreEntity, SensorEntity):
|
|||
async def async_added_to_hass(self):
|
||||
"""Handle entity which will be added."""
|
||||
await super().async_added_to_hass()
|
||||
state = await self.async_get_last_state()
|
||||
if state:
|
||||
if state := await self.async_get_last_state():
|
||||
try:
|
||||
self._state = Decimal(state.state)
|
||||
except (DecimalException, ValueError) as err:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue