mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 01:38:02 +00:00
Code quality improvements for dsmr
(#82443)
This commit is contained in:
parent
982e75a15f
commit
c899e72029
@ -559,6 +559,7 @@ class DSMREntity(SensorEntity):
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return the state of sensor, if available, translate if needed."""
|
||||
value: StateType
|
||||
if (value := self.get_dsmr_object_attr("value")) is None:
|
||||
return None
|
||||
|
||||
@ -573,10 +574,7 @@ class DSMREntity(SensorEntity):
|
||||
float(value), self._entry.data.get(CONF_PRECISION, DEFAULT_PRECISION)
|
||||
)
|
||||
|
||||
if value is not None:
|
||||
return value
|
||||
|
||||
return None
|
||||
return value
|
||||
|
||||
@property
|
||||
def native_unit_of_measurement(self) -> str | None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user