Use assignment expressions 06 (#57786)

This commit is contained in:
Marc Mueller 2021-10-17 20:05:11 +02:00 committed by GitHub
parent d5116810d4
commit 2a8eaf0e0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 35 additions and 69 deletions

View file

@ -218,8 +218,7 @@ class FidoSensor(SensorEntity):
async def async_update(self):
"""Get the latest data from Fido and update the state."""
await self.fido_data.async_update()
sensor_type = self.entity_description.key
if sensor_type == "balance":
if (sensor_type := self.entity_description.key) == "balance":
if self.fido_data.data.get(sensor_type) is not None:
self._attr_native_value = round(self.fido_data.data[sensor_type], 2)
else: