Fix noisy error on startup. Make callbacks code consistent.

This commit is contained in:
pavoni 2016-03-06 19:19:07 +00:00
parent b16c17fae5
commit 4e3c8a8697
3 changed files with 14 additions and 10 deletions

View file

@ -90,6 +90,8 @@ class BinarySensorTemplate(BinarySensorDevice):
hass.bus.listen(EVENT_STATE_CHANGED, self._event_listener)
def _event_listener(self, event):
if not hasattr(self, 'hass'):
return
self.update_ha_state(True)
@property