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.
pull/1427/head
Dan Smith 2016-02-27 20:33:35 -08:00 committed by Paulus Schoutsen
parent da2bcb3f27
commit 3790764df9
1 changed files with 3 additions and 3 deletions

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)