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
|
@ -147,8 +147,7 @@ class StatisticsSensor(SensorEntity):
|
|||
@callback
|
||||
def async_stats_sensor_state_listener(event):
|
||||
"""Handle the sensor state changes."""
|
||||
new_state = event.data.get("new_state")
|
||||
if new_state is None:
|
||||
if (new_state := event.data.get("new_state")) is None:
|
||||
return
|
||||
|
||||
self._unit_of_measurement = new_state.attributes.get(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue