From d8ac761bb6aee7a998e883f9005a648728a13bf4 Mon Sep 17 00:00:00 2001 From: Mike Megally Date: Fri, 8 Mar 2019 16:35:38 -0800 Subject: [PATCH] Synology sensor quick return if attr is null (#21709) * Quick return if attr is null There are some case where attr is null. Returning null doesn't change anything (in my case this is mapped to a volume that doesn't exist, not sure what others are seeing). If you have confirmed you hass instance for C instead of F you do not see this error. * update == to is * whitespace --- homeassistant/components/sensor/synologydsm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homeassistant/components/sensor/synologydsm.py b/homeassistant/components/sensor/synologydsm.py index 2b443738230802..0d5a253483f9ac 100644 --- a/homeassistant/components/sensor/synologydsm.py +++ b/homeassistant/components/sensor/synologydsm.py @@ -230,6 +230,9 @@ def state(self): attr = getattr( self._api.storage, self.var_id)(self.monitor_device) + if attr is None: + return None + if self._api.temp_unit == TEMP_CELSIUS: return attr