Allow None value return type for Number entity state value (#52302)
parent
6131ed09f0
commit
d3210ada1d
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue