diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py index 97c0fb3d386620..e78190bf444d70 100644 --- a/homeassistant/components/switch/wemo.py +++ b/homeassistant/components/switch/wemo.py @@ -61,16 +61,14 @@ def __init__(self, device): wemo.SUBSCRIPTION_REGISTRY.register(self.wemo) wemo.SUBSCRIPTION_REGISTRY.on(self.wemo, None, self._update_callback) - def _update_callback(self, _device, _params): + def _update_callback(self, _device, _type, _params): """Called by the Wemo device callback to update state.""" _LOGGER.info( 'Subscription update for %s', _device) - if self._model_name == 'CoffeeMaker': - self.wemo.subscription_callback(_params) - self._update(force_update=False) - else: - self.update() + updated = self.wemo.subscription_update(_type, _params) + self._update(force_update=(not updated)) + if not hasattr(self, 'hass'): return self.schedule_update_ha_state() @@ -219,5 +217,6 @@ def _update(self, force_update=True): self.maker_params = self.wemo.maker_params elif self._model_name == 'CoffeeMaker': self.coffeemaker_mode = self.wemo.mode - except AttributeError: - _LOGGER.warning('Could not update status for %s', self.name) + except AttributeError as err: + _LOGGER.warning('Could not update status for %s (%s)', + self.name, err) diff --git a/homeassistant/components/wemo.py b/homeassistant/components/wemo.py index c121c58470bd5a..7cec1707211a6b 100644 --- a/homeassistant/components/wemo.py +++ b/homeassistant/components/wemo.py @@ -14,7 +14,7 @@ from homeassistant.const import EVENT_HOMEASSISTANT_STOP -REQUIREMENTS = ['pywemo==0.4.13'] +REQUIREMENTS = ['pywemo==0.4.15'] DOMAIN = 'wemo' diff --git a/requirements_all.txt b/requirements_all.txt index ef14d3641367a6..abaf1268adf931 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -644,7 +644,7 @@ pyvera==0.2.24 pywebpush==0.6.1 # homeassistant.components.wemo -pywemo==0.4.13 +pywemo==0.4.15 # homeassistant.components.zabbix pyzabbix==0.7.4