Allow None value return type for Number entity state value (#52302)
This commit is contained in:
parent
6131ed09f0
commit
d3210ada1d
2 changed files with 3 additions and 3 deletions
|
@ -108,12 +108,12 @@ class NumberEntity(Entity):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@final
|
@final
|
||||||
def state(self) -> float:
|
def state(self) -> float | None:
|
||||||
"""Return the entity state."""
|
"""Return the entity state."""
|
||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def value(self) -> float:
|
def value(self) -> float | None:
|
||||||
"""Return the entity value to represent the entity state."""
|
"""Return the entity value to represent the entity state."""
|
||||||
return self._attr_value
|
return self._attr_value
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ZwaveNumberEntity(ZWaveBaseEntity, NumberEntity):
|
||||||
return float(self.info.primary_value.metadata.max)
|
return float(self.info.primary_value.metadata.max)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def value(self) -> float | None: # type: ignore
|
def value(self) -> float | None:
|
||||||
"""Return the entity value."""
|
"""Return the entity value."""
|
||||||
if self.info.primary_value.value is None:
|
if self.info.primary_value.value is None:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Reference in a new issue