mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
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:
parent
de71fee0a0
commit
bbad15f853
@ -40,12 +40,14 @@ class WemoBinarySensor(BinarySensorDevice):
|
||||
wemo.SUBSCRIPTION_REGISTRY.register(self.wemo)
|
||||
wemo.SUBSCRIPTION_REGISTRY.on(self.wemo, None, self._update_callback)
|
||||
|
||||
def _update_callback(self, _device, _params):
|
||||
"""Called by the wemo device callback to update state."""
|
||||
def _update_callback(self, _device, _type, _params):
|
||||
"""Called by the Wemo device callback to update state."""
|
||||
_LOGGER.info(
|
||||
'Subscription update for %s',
|
||||
_device)
|
||||
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()
|
||||
@ -72,7 +74,11 @@ class WemoBinarySensor(BinarySensorDevice):
|
||||
|
||||
def update(self):
|
||||
"""Update WeMo state."""
|
||||
self._update(force_update=True)
|
||||
|
||||
def _update(self, force_update=True):
|
||||
try:
|
||||
self._state = self.wemo.get_state(True)
|
||||
except AttributeError:
|
||||
_LOGGER.warning('Could not update status for %s', self.name)
|
||||
self._state = self.wemo.get_state(force_update)
|
||||
except AttributeError as err:
|
||||
_LOGGER.warning('Could not update status for %s (%s)',
|
||||
self.name, err)
|
||||
|
@ -14,7 +14,7 @@ from homeassistant.helpers import config_validation as cv
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
|
||||
REQUIREMENTS = ['pywemo==0.4.17']
|
||||
REQUIREMENTS = ['pywemo==0.4.18']
|
||||
|
||||
DOMAIN = 'wemo'
|
||||
|
||||
|
@ -672,7 +672,7 @@ pyvera==0.2.26
|
||||
pywebpush==0.6.1
|
||||
|
||||
# homeassistant.components.wemo
|
||||
pywemo==0.4.17
|
||||
pywemo==0.4.18
|
||||
|
||||
# homeassistant.components.zabbix
|
||||
pyzabbix==0.7.4
|
||||
|
Loading…
x
Reference in New Issue
Block a user