Synology sensor quick return if attr is null ()

* 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
pull/21877/head
Mike Megally 2019-03-08 16:35:38 -08:00 committed by Paulus Schoutsen
parent 0f189809a9
commit d8ac761bb6
1 changed files with 3 additions and 0 deletions
homeassistant/components/sensor

View File

@ -230,6 +230,9 @@ class SynoNasStorageSensor(SynoNasSensor):
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