From 2e98cfb9ab8c73dc398037a1ac8bedaa7cfb2e3b Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Tue, 2 Feb 2021 19:57:08 +0100 Subject: [PATCH] Guard for missing value (#45867) * guard for missing value * update comment --- homeassistant/components/zwave_js/entity.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zwave_js/entity.py b/homeassistant/components/zwave_js/entity.py index 285824ef2f1..b039113270d 100644 --- a/homeassistant/components/zwave_js/entity.py +++ b/homeassistant/components/zwave_js/entity.py @@ -92,7 +92,13 @@ class ZWaveBaseEntity(Entity): @property def available(self) -> bool: """Return entity availability.""" - return self.client.connected and bool(self.info.node.ready) + return ( + self.client.connected + and bool(self.info.node.ready) + # a None value indicates something wrong with the device, + # or the value is simply not yet there (it will arrive later). + and self.info.primary_value.value is not None + ) @callback def _value_changed(self, event_data: dict) -> None: