Simplify update state call, shutdown properly.

This commit is contained in:
pavoni 2015-12-27 23:09:39 +00:00
parent 3f151428b7
commit 4feef3dd0d
2 changed files with 7 additions and 3 deletions

View File

@ -27,6 +27,11 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
if _WEMO_SUBSCRIPTION_REGISTRY is None:
_WEMO_SUBSCRIPTION_REGISTRY = pywemo.SubscriptionRegistry()
_WEMO_SUBSCRIPTION_REGISTRY.start()
def stop_wemo(event):
""" Shutdown Wemo subscriptions and subscription thread on exit"""
_WEMO_SUBSCRIPTION_REGISTRY.stop()
hass.bus.listen_once(hass.EVENT_HOMEASSISTANT_STOP, stop_wemo)
if discovery_info is not None:
location = discovery_info[2]
@ -63,8 +68,7 @@ class WemoSwitch(SwitchDevice):
_LOGGER.info(
'Subscription update for %s, sevice=%s params=%s',
self.name, _device, _params)
self.update()
self.update_ha_state()
self.update_ha_state(True)
@property
def should_poll(self):

View File

@ -174,7 +174,7 @@ hikvision==0.4
orvibo==1.1.0
# homeassistant.components.switch.wemo
pywemo==0.3.3
pywemo==0.3.4
# homeassistant.components.thermostat.heatmiser
heatmiserV3==0.9.1