Move temperature conversions to sensor base class (6/8) (#54476)
* Move temperature conversions to entity base class (6/8) * Fix tests
This commit is contained in:
parent
6de6a5dc14
commit
e558b3463e
64 changed files with 199 additions and 188 deletions
|
@ -492,7 +492,7 @@ class SmartThingsSensor(SmartThingsEntity, SensorEntity):
|
|||
return f"{self._device.device_id}.{self._attribute}"
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
def native_value(self):
|
||||
"""Return the state of the sensor."""
|
||||
return self._device.status.attributes[self._attribute].value
|
||||
|
||||
|
@ -502,7 +502,7 @@ class SmartThingsSensor(SmartThingsEntity, SensorEntity):
|
|||
return self._device_class
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
def native_unit_of_measurement(self):
|
||||
"""Return the unit this state is expressed in."""
|
||||
unit = self._device.status.attributes[self._attribute].unit
|
||||
return UNITS.get(unit, unit) if unit else self._default_unit
|
||||
|
@ -534,7 +534,7 @@ class SmartThingsThreeAxisSensor(SmartThingsEntity, SensorEntity):
|
|||
return f"{self._device.device_id}.{THREE_AXIS_NAMES[self._index]}"
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
def native_value(self):
|
||||
"""Return the state of the sensor."""
|
||||
three_axis = self._device.status.attributes[Attribute.three_axis].value
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue