Skip to content

Commit

Permalink
Synology sensor quick return if attr is null (#21709)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
cmsimike authored and balloob committed Mar 9, 2019
1 parent 0f18980 commit d8ac761
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/sensor/synologydsm.py
Expand Up @@ -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

Expand Down

0 comments on commit d8ac761

Please sign in to comment.