Handle startup race condition.

This commit is contained in:
pavoni 2016-03-14 10:29:12 +00:00
parent 399fda079f
commit fe2adff017
2 changed files with 6 additions and 0 deletions

View file

@ -45,6 +45,9 @@ class WemoBinarySensor(BinarySensorDevice):
_LOGGER.info(
'Subscription update for %s',
_device)
if not hasattr(self, 'hass'):
self.update()
return
self.update_ha_state(True)
@property

View file

@ -63,6 +63,9 @@ class WemoSwitch(SwitchDevice):
_LOGGER.info(
'Subscription update for %s',
_device)
if not hasattr(self, 'hass'):
self.update()
return
self.update_ha_state(True)
@property