Move temperature conversions to sensor base class (4/8) (#54472)

* Move temperature conversions to entity base class (4/8)

* Fix litterrobot sensor

* Fix tests
This commit is contained in:
Erik Montnemery 2021-08-11 21:17:47 +02:00 committed by GitHub
parent ae507aeed1
commit 2720ba2753
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 195 additions and 183 deletions

View file

@ -93,12 +93,12 @@ class LcnVariableSensor(LcnEntity, SensorEntity):
await self.device_connection.cancel_status_request_handler(self.variable)
@property
def state(self) -> str | None:
def native_value(self) -> str | None:
"""Return the state of the entity."""
return self._value
@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 cast(str, self.unit.value)
@ -145,7 +145,7 @@ class LcnLedLogicSensor(LcnEntity, SensorEntity):
await self.device_connection.cancel_status_request_handler(self.source)
@property
def state(self) -> str | None:
def native_value(self) -> str | None:
"""Return the state of the entity."""
return self._value