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:
Erik Montnemery 2021-08-11 21:17:16 +02:00 committed by GitHub
parent e23750b2a4
commit ae507aeed1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 141 additions and 129 deletions

View file

@ -30,11 +30,11 @@ class WithingsHealthSensor(BaseWithingsSensor, SensorEntity):
"""Implementation of a Withings sensor."""
@property
def state(self) -> None | str | int | float:
def native_value(self) -> None | str | int | float:
"""Return the state of the entity."""
return self._state_data
@property
def unit_of_measurement(self) -> str:
def native_unit_of_measurement(self) -> str:
"""Return the unit of measurement of this entity, if any."""
return self._attribute.unit_of_measurement