Update Insight parameters using the subscription data. (#6782)

* Update Insight parameters using the subscription dta.

* Minor refactor.

* Tidy.
pull/6815/head
Greg Dowling 2017-03-27 11:43:43 +01:00 committed by Pascal Vizeli
parent f242ad26ca
commit c53de19246
3 changed files with 9 additions and 10 deletions

View File

@ -61,16 +61,14 @@ class WemoSwitch(SwitchDevice):
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 @@ class WemoSwitch(SwitchDevice):
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)

View File

@ -14,7 +14,7 @@ from homeassistant.helpers import config_validation as cv
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
REQUIREMENTS = ['pywemo==0.4.13']
REQUIREMENTS = ['pywemo==0.4.15']
DOMAIN = 'wemo'

View File

@ -647,7 +647,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