Move temperature conversions to sensor base class (8/8) (#54483)
* Move temperature conversions to entity base class (8/8) * Fix wallbox sensor * Fix tests
This commit is contained in:
parent
e23750b2a4
commit
ae507aeed1
48 changed files with 141 additions and 129 deletions
|
@ -56,12 +56,12 @@ class ZWaveSensor(ZWaveDeviceEntity, SensorEntity):
|
|||
return True
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
def native_value(self):
|
||||
"""Return the state of the sensor."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
def native_unit_of_measurement(self):
|
||||
"""Return the unit of measurement the value is expressed in."""
|
||||
return self._units
|
||||
|
||||
|
@ -70,7 +70,7 @@ class ZWaveMultilevelSensor(ZWaveSensor):
|
|||
"""Representation of a multi level sensor Z-Wave sensor."""
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
def native_value(self):
|
||||
"""Return the state of the sensor."""
|
||||
if self._units in ("C", "F"):
|
||||
return round(self._state, 1)
|
||||
|
@ -87,7 +87,7 @@ class ZWaveMultilevelSensor(ZWaveSensor):
|
|||
return None
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
def native_unit_of_measurement(self):
|
||||
"""Return the unit the value is expressed in."""
|
||||
if self._units == "C":
|
||||
return TEMP_CELSIUS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue