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.
This commit is contained in:
Dan Smith 2016-02-27 20:33:35 -08:00
parent 5a126736e4
commit 2b4be33a3d

View File

@ -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)