Allow None value return type for Number entity state value (#52302)

pull/52304/head
Franck Nijhof 2021-06-29 15:07:31 +02:00 committed by GitHub
parent 6131ed09f0
commit d3210ada1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -108,12 +108,12 @@ class NumberEntity(Entity):
@property
@final
def state(self) -> float:
def state(self) -> float | None:
"""Return the entity state."""
return self.value
@property
def value(self) -> float:
def value(self) -> float | None:
"""Return the entity value to represent the entity state."""
return self._attr_value

View File

@ -71,7 +71,7 @@ class ZwaveNumberEntity(ZWaveBaseEntity, NumberEntity):
return float(self.info.primary_value.metadata.max)
@property
def value(self) -> float | None: # type: ignore
def value(self) -> float | None:
"""Return the entity value."""
if self.info.primary_value.value is None:
return None