Fix max_value access for number platform in Overkiz (#73479)

Fix wrong property name
This commit is contained in:
Thibaut 2022-06-14 15:17:40 +02:00 committed by GitHub
parent 04c60d2183
commit e08465fe8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,7 +134,7 @@ class OverkizNumber(OverkizDescriptiveEntity, NumberEntity):
"""Return the entity value to represent the entity state."""
if state := self.device.states.get(self.entity_description.key):
if self.entity_description.inverted:
return self._attr_max_value - cast(float, state.value)
return self.max_value - cast(float, state.value)
return cast(float, state.value)
@ -143,7 +143,7 @@ class OverkizNumber(OverkizDescriptiveEntity, NumberEntity):
async def async_set_value(self, value: float) -> None:
"""Set new value."""
if self.entity_description.inverted:
value = self._attr_max_value - value
value = self.max_value - value
await self.executor.async_execute_command(
self.entity_description.command, value