Skip to content

Commit

Permalink
Improve autodiscovered yeelights model detection
Browse files Browse the repository at this point in the history
  • Loading branch information
zewelor committed Jun 21, 2019
1 parent 0bdbf00 commit e790fb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions homeassistant/components/yeelight/__init__.py
Expand Up @@ -122,14 +122,11 @@ def setup(hass, config):
def device_discovered(_, info):
_LOGGER.debug("Adding autodetected %s", info['hostname'])

device_type = info['device_type']

name = "yeelight_%s_%s" % (device_type,
name = "yeelight_%s_%s" % (info['device_type'],
info['properties']['mac'])
ipaddr = info[CONF_HOST]
device_config = DEVICE_SCHEMA({
CONF_NAME: name,
CONF_MODEL: device_type
})

_setup_device(hass, config, ipaddr, device_config)
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/yeelight/light.py
Expand Up @@ -178,7 +178,9 @@ def _lights_setup_helper(klass):
_lights_setup_helper(YeelightWithAmbientLight)
_lights_setup_helper(YeelightAmbientLight)
else:
_LOGGER.error("Cannot determine device type for %s, %s",
_lights_setup_helper(YeelightGenericLight)
_LOGGER.warn("Cannot determine device type for %s, %s\n"
"Falling back to white only",
device.ipaddr, device.name)

hass.data[data_key] += lights
Expand Down

0 comments on commit e790fb1

Please sign in to comment.