Migrate NumberEntity r-t to native_value (#73485)

This commit is contained in:
Erik Montnemery 2022-06-15 10:56:41 +02:00 committed by GitHub
parent 4ace2c4d3a
commit e05e79e53d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 47 deletions

View file

@ -46,16 +46,16 @@ class ScreenLogicNumber(ScreenlogicEntity, NumberEntity):
"""Initialize of the entity."""
super().__init__(coordinator, data_key, enabled)
self._body_type = SUPPORTED_SCG_NUMBERS.index(self._data_key)
self._attr_max_value = SCG.LIMIT_FOR_BODY[self._body_type]
self._attr_native_max_value = SCG.LIMIT_FOR_BODY[self._body_type]
self._attr_name = f"{self.gateway_name} {self.sensor['name']}"
self._attr_unit_of_measurement = self.sensor["unit"]
self._attr_native_unit_of_measurement = self.sensor["unit"]
@property
def value(self) -> float:
def native_value(self) -> float:
"""Return the current value."""
return self.sensor["value"]
async def async_set_value(self, value: float) -> None:
async def async_set_native_value(self, value: float) -> None:
"""Update the current value."""
# Need to set both levels at the same time, so we gather
# both existing level values and override the one that changed.