From 5a126736e40b001ceb262403d5d76b341386ba4b Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sat, 27 Feb 2016 20:11:32 -0800 Subject: [PATCH 1/2] Fix static configured wemo devices The new wemo code was pulling 'static' from the global config instead of the wemo component config. --- homeassistant/components/wemo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/wemo.py b/homeassistant/components/wemo.py index 9dc144266a8..e7fb426fe37 100644 --- a/homeassistant/components/wemo.py +++ b/homeassistant/components/wemo.py @@ -77,7 +77,8 @@ def setup(hass, config): devices = [(device.host, device) for device in pywemo.discover_devices()] # Add static devices from the config file - devices.extend((address, None) for address in config.get('static', [])) + devices.extend((address, None) + for address in config['wemo'].get('static', [])) for address, device in devices: port = pywemo.ouimeaux_device.probe_wemo(address) From 2b4be33a3d51bfb483fa122b3da2e5050a628f5e Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sat, 27 Feb 2016 20:33:35 -0800 Subject: [PATCH 2/2] Fix wemo known device tracking The wemo component was tracking devices by mac to avoid adding duplicates, but this means we'd never be able to load more than one static wemo, since they all have mac=None. This changes the code to track by url, which has to be unique per wemo anyway, and which we also have for even static wemos. --- homeassistant/components/wemo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/wemo.py b/homeassistant/components/wemo.py index e7fb426fe37..0427815c6e1 100644 --- a/homeassistant/components/wemo.py +++ b/homeassistant/components/wemo.py @@ -58,12 +58,12 @@ def setup(hass, config): def discovery_dispatch(service, discovery_info): """Dispatcher for WeMo discovery events.""" # name, model, location, mac - _, model_name, _, mac = discovery_info + _, model_name, url, _ = discovery_info # Only register a device once - if mac in KNOWN_DEVICES: + if url in KNOWN_DEVICES: return - KNOWN_DEVICES.append(mac) + KNOWN_DEVICES.append(url) service = WEMO_MODEL_DISPATCH.get(model_name) or DISCOVER_SWITCHES component = WEMO_SERVICE_DISPATCH.get(service)