mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Fix WeMo incorrect mapping of device type during discovery (#19691)
This commit is contained in:
parent
87a0118082
commit
ada0f7cf65
@ -20,8 +20,8 @@ REQUIREMENTS = ['pywemo==0.4.34']
|
|||||||
|
|
||||||
DOMAIN = 'wemo'
|
DOMAIN = 'wemo'
|
||||||
|
|
||||||
# Mapping from Wemo model_name to component.
|
# Mapping from Wemo device type to Home Assistant component type.
|
||||||
WEMO_MODEL_DISPATCH = {
|
WEMO_DEVICE_TYPE_DISPATCH = {
|
||||||
'Bridge': 'light',
|
'Bridge': 'light',
|
||||||
'CoffeeMaker': 'switch',
|
'CoffeeMaker': 'switch',
|
||||||
'Dimmer': 'light',
|
'Dimmer': 'light',
|
||||||
@ -30,8 +30,7 @@ WEMO_MODEL_DISPATCH = {
|
|||||||
'LightSwitch': 'switch',
|
'LightSwitch': 'switch',
|
||||||
'Maker': 'switch',
|
'Maker': 'switch',
|
||||||
'Motion': 'binary_sensor',
|
'Motion': 'binary_sensor',
|
||||||
'Sensor': 'binary_sensor',
|
'Switch': 'switch'
|
||||||
'Socket': 'switch'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBSCRIPTION_REGISTRY = None
|
SUBSCRIPTION_REGISTRY = None
|
||||||
@ -110,7 +109,7 @@ def setup(hass, config):
|
|||||||
def discovery_dispatch(service, discovery_info):
|
def discovery_dispatch(service, discovery_info):
|
||||||
"""Dispatcher for incoming WeMo discovery events."""
|
"""Dispatcher for incoming WeMo discovery events."""
|
||||||
# name, model, location, mac
|
# name, model, location, mac
|
||||||
model_name = discovery_info.get('model_name')
|
device_type = discovery_info.get('device_type')
|
||||||
serial = discovery_info.get('serial')
|
serial = discovery_info.get('serial')
|
||||||
|
|
||||||
# Only register a device once
|
# Only register a device once
|
||||||
@ -122,7 +121,7 @@ def setup(hass, config):
|
|||||||
_LOGGER.debug('Discovered unique WeMo device: %s', serial)
|
_LOGGER.debug('Discovered unique WeMo device: %s', serial)
|
||||||
KNOWN_DEVICES.append(serial)
|
KNOWN_DEVICES.append(serial)
|
||||||
|
|
||||||
component = WEMO_MODEL_DISPATCH.get(model_name, 'switch')
|
component = WEMO_DEVICE_TYPE_DISPATCH.get(device_type, 'switch')
|
||||||
|
|
||||||
discovery.load_platform(hass, component, DOMAIN,
|
discovery.load_platform(hass, component, DOMAIN,
|
||||||
discovery_info, config)
|
discovery_info, config)
|
||||||
@ -166,7 +165,7 @@ def setup(hass, config):
|
|||||||
device.host, device.port)
|
device.host, device.port)
|
||||||
|
|
||||||
discovery_info = {
|
discovery_info = {
|
||||||
'model_name': device.model_name,
|
'device_type': device.__class__.__name__,
|
||||||
'serial': device.serialnumber,
|
'serial': device.serialnumber,
|
||||||
'mac_address': device.mac,
|
'mac_address': device.mac,
|
||||||
'ssdp_description': url,
|
'ssdp_description': url,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user