From d3210ada1dc4b6cf36b1f1f3d79ba4b6028e4a59 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 29 Jun 2021 15:07:31 +0200 Subject: [PATCH] Allow None value return type for Number entity state value (#52302) --- homeassistant/components/number/__init__.py | 4 ++-- homeassistant/components/zwave_js/number.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/number/__init__.py b/homeassistant/components/number/__init__.py index 4b1049e36a2..cbfdea7fa11 100644 --- a/homeassistant/components/number/__init__.py +++ b/homeassistant/components/number/__init__.py @@ -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 diff --git a/homeassistant/components/zwave_js/number.py b/homeassistant/components/zwave_js/number.py index 808fd346be1..2a3c9820a69 100644 --- a/homeassistant/components/zwave_js/number.py +++ b/homeassistant/components/zwave_js/number.py @@ -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