Use assignment expressions 35 (#58824)

This commit is contained in:
Marc Mueller 2021-10-31 18:32:17 +01:00 committed by GitHub
parent ab7d8db481
commit 3f1b4906bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 26 additions and 65 deletions

View file

@ -361,9 +361,7 @@ class PwThermostatSensor(SmileSensor):
@callback
def _async_process_data(self):
"""Update the entity."""
data = self._api.get_device_data(self._dev_id)
if not data:
if not (data := self._api.get_device_data(self._dev_id)):
_LOGGER.error("Received no data for device %s", self._entity_name)
self.async_write_ha_state()
return
@ -388,9 +386,7 @@ class PwAuxDeviceSensor(SmileSensor):
@callback
def _async_process_data(self):
"""Update the entity."""
data = self._api.get_device_data(self._dev_id)
if not data:
if not (data := self._api.get_device_data(self._dev_id)):
_LOGGER.error("Received no data for device %s", self._entity_name)
self.async_write_ha_state()
return
@ -434,9 +430,7 @@ class PwPowerSensor(SmileSensor):
@callback
def _async_process_data(self):
"""Update the entity."""
data = self._api.get_device_data(self._dev_id)
if not data:
if not (data := self._api.get_device_data(self._dev_id)):
_LOGGER.error("Received no data for device %s", self._entity_name)
self.async_write_ha_state()
return