Add subscription update for Wemo switches, fix bug in Insight switches, fix wemo motion bug, fix wemo discovery (#7135)

* Fix wemo discovery.

* Bump wemo version, add subscription_update for basic switch, fix bug with turning insight switches off.

* Fix missed callback change for wemo motion.

* Regress netdisco changes.
This commit is contained in:
Greg Dowling 2017-04-18 17:11:08 +01:00 committed by Paulus Schoutsen
parent de71fee0a0
commit bbad15f853
3 changed files with 14 additions and 8 deletions

View File

@ -40,12 +40,14 @@ class WemoBinarySensor(BinarySensorDevice):
wemo.SUBSCRIPTION_REGISTRY.register(self.wemo) wemo.SUBSCRIPTION_REGISTRY.register(self.wemo)
wemo.SUBSCRIPTION_REGISTRY.on(self.wemo, None, self._update_callback) 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.""" """Called by the Wemo device callback to update state."""
_LOGGER.info( _LOGGER.info(
'Subscription update for %s', 'Subscription update for %s',
_device) _device)
self.update() updated = self.wemo.subscription_update(_type, _params)
self._update(force_update=(not updated))
if not hasattr(self, 'hass'): if not hasattr(self, 'hass'):
return return
self.schedule_update_ha_state() self.schedule_update_ha_state()
@ -72,7 +74,11 @@ class WemoBinarySensor(BinarySensorDevice):
def update(self): def update(self):
"""Update WeMo state.""" """Update WeMo state."""
self._update(force_update=True)
def _update(self, force_update=True):
try: try:
self._state = self.wemo.get_state(True) self._state = self.wemo.get_state(force_update)
except AttributeError: except AttributeError as err:
_LOGGER.warning('Could not update status for %s', self.name) _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 from homeassistant.const import EVENT_HOMEASSISTANT_STOP
REQUIREMENTS = ['pywemo==0.4.17'] REQUIREMENTS = ['pywemo==0.4.18']
DOMAIN = 'wemo' DOMAIN = 'wemo'

View File

@ -672,7 +672,7 @@ pyvera==0.2.26
pywebpush==0.6.1 pywebpush==0.6.1
# homeassistant.components.wemo # homeassistant.components.wemo
pywemo==0.4.17 pywemo==0.4.18
# homeassistant.components.zabbix # homeassistant.components.zabbix
pyzabbix==0.7.4 pyzabbix==0.7.4