Use assignment expressions 39 (#58829)

This commit is contained in:
Marc Mueller 2021-10-31 18:56:25 +01:00 committed by GitHub
parent 72801867d6
commit e0c0d00833
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 31 additions and 70 deletions

View file

@ -260,8 +260,7 @@ class DSMREntity(SensorEntity):
@property
def native_value(self) -> StateType:
"""Return the state of sensor, if available, translate if needed."""
value = self.get_dsmr_object_attr("value")
if value is None:
if (value := self.get_dsmr_object_attr("value")) is None:
return None
if self.entity_description.key == obis_ref.ELECTRICITY_ACTIVE_TARIFF: