From d974cd4606279694640373f94850c33fc5d67669 Mon Sep 17 00:00:00 2001 From: Steven Looman Date: Tue, 23 Jun 2020 01:39:57 +0200 Subject: [PATCH] Prevent upnp to use None values (#36803) --- homeassistant/components/upnp/sensor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/upnp/sensor.py b/homeassistant/components/upnp/sensor.py index 29bdf7429ab..aea0ec40460 100644 --- a/homeassistant/components/upnp/sensor.py +++ b/homeassistant/components/upnp/sensor.py @@ -198,6 +198,8 @@ class RawUpnpSensor(UpnpSensor): """Return the state of the device.""" device_value_key = self._sensor_type["device_value_key"] value = self._coordinator.data[device_value_key] + if value is None: + return None return format(value, "d") @@ -235,6 +237,8 @@ class DerivedUpnpSensor(UpnpSensor): # Can't calculate any derivative if we have only one value. device_value_key = self._sensor_type["device_value_key"] current_value = self._coordinator.data[device_value_key] + if current_value is None: + return None current_timestamp = self._coordinator.data[TIMESTAMP] if self._last_value is None or self._has_overflowed(current_value): self._last_value = current_value