mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Simplify update state call, shutdown properly.
This commit is contained in:
parent
3f151428b7
commit
4feef3dd0d
@ -27,6 +27,11 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
if _WEMO_SUBSCRIPTION_REGISTRY is None:
|
if _WEMO_SUBSCRIPTION_REGISTRY is None:
|
||||||
_WEMO_SUBSCRIPTION_REGISTRY = pywemo.SubscriptionRegistry()
|
_WEMO_SUBSCRIPTION_REGISTRY = pywemo.SubscriptionRegistry()
|
||||||
_WEMO_SUBSCRIPTION_REGISTRY.start()
|
_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:
|
if discovery_info is not None:
|
||||||
location = discovery_info[2]
|
location = discovery_info[2]
|
||||||
@ -63,8 +68,7 @@ class WemoSwitch(SwitchDevice):
|
|||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
'Subscription update for %s, sevice=%s params=%s',
|
'Subscription update for %s, sevice=%s params=%s',
|
||||||
self.name, _device, _params)
|
self.name, _device, _params)
|
||||||
self.update()
|
self.update_ha_state(True)
|
||||||
self.update_ha_state()
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
|
@ -174,7 +174,7 @@ hikvision==0.4
|
|||||||
orvibo==1.1.0
|
orvibo==1.1.0
|
||||||
|
|
||||||
# homeassistant.components.switch.wemo
|
# homeassistant.components.switch.wemo
|
||||||
pywemo==0.3.3
|
pywemo==0.3.4
|
||||||
|
|
||||||
# homeassistant.components.thermostat.heatmiser
|
# homeassistant.components.thermostat.heatmiser
|
||||||
heatmiserV3==0.9.1
|
heatmiserV3==0.9.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user