mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Allow None value return type for Number entity state value (#52302)
This commit is contained in:
parent
6131ed09f0
commit
d3210ada1d
@ -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…
x
Reference in New Issue
Block a user