Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion homeassistant/components/light/yeelight.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@

_LOGGER = logging.getLogger(__name__)

LEGACY_DEVICE_TYPE_MAP = {
'color1': 'rgb',
'mono1': 'white',
'strip1': 'strip',
'bslamp1': 'bedside',
'ceiling1': 'ceiling',
}

CONF_TRANSITION = 'transition'
DEFAULT_TRANSITION = 350

Expand Down Expand Up @@ -122,8 +130,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
if discovery_info is not None:
_LOGGER.debug("Adding autodetected %s", discovery_info['hostname'])

device_type = discovery_info['device_type']
device_type = LEGACY_DEVICE_TYPE_MAP.get(device_type, device_type)

# Not using hostname, as it seems to vary.
name = "yeelight_%s_%s" % (discovery_info['device_type'],
name = "yeelight_%s_%s" % (device_type,
discovery_info['properties']['mac'])
device = {'name': name, 'ipaddr': discovery_info['host']}

Expand Down