If no weather advisories were issued, state should return 0 instead Unknown (#4029)

* If no weather advisories were issued, state should return 0 instead Unknown

* Updated to keep on the same if statement

* Revert "Updated to keep on the same if statement"

This reverts commit 0e6a94aa0f.
This commit is contained in:
Marcelo Moreira de Mello 2016-10-26 01:49:51 -04:00 committed by Paulus Schoutsen
parent 961c02f72a
commit 1f468fc94d

View file

@ -117,8 +117,11 @@ class WUndergroundSensor(Entity):
else:
return self.rest.data[self._condition]
if self.rest.alerts and self._condition == 'alerts':
return len(self.rest.alerts)
if self._condition == 'alerts':
if self.rest.alerts:
return len(self.rest.alerts)
else:
return 0
return STATE_UNKNOWN
@property