mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Prevent upnp to use None values (#36803)
This commit is contained in:
parent
247df5874b
commit
d974cd4606
@ -198,6 +198,8 @@ class RawUpnpSensor(UpnpSensor):
|
|||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
device_value_key = self._sensor_type["device_value_key"]
|
device_value_key = self._sensor_type["device_value_key"]
|
||||||
value = self._coordinator.data[device_value_key]
|
value = self._coordinator.data[device_value_key]
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
return format(value, "d")
|
return format(value, "d")
|
||||||
|
|
||||||
|
|
||||||
@ -235,6 +237,8 @@ class DerivedUpnpSensor(UpnpSensor):
|
|||||||
# Can't calculate any derivative if we have only one value.
|
# Can't calculate any derivative if we have only one value.
|
||||||
device_value_key = self._sensor_type["device_value_key"]
|
device_value_key = self._sensor_type["device_value_key"]
|
||||||
current_value = self._coordinator.data[device_value_key]
|
current_value = self._coordinator.data[device_value_key]
|
||||||
|
if current_value is None:
|
||||||
|
return None
|
||||||
current_timestamp = self._coordinator.data[TIMESTAMP]
|
current_timestamp = self._coordinator.data[TIMESTAMP]
|
||||||
if self._last_value is None or self._has_overflowed(current_value):
|
if self._last_value is None or self._has_overflowed(current_value):
|
||||||
self._last_value = current_value
|
self._last_value = current_value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user