Core: Duplication of Yeelight in 0.63

Created on 12 Feb 2018  路  22Comments  路  Source: home-assistant/core

Home Assistant release (hass --version): 0.63.0

Python release (python3 --version): 3.5.3

Component/platform: Yeelight/discovery

Description of problem: When the discovery component and the Yeelight component are both declared in configuration.yaml, the light appears twice in the UI, once with the name as per the Yeelight component and once with yeelight_rgb_xxxxxxxxxx

Expected: The light to only appear once.

Problem-relevant configuration.yaml entries and steps to reproduce:

discovery:

light:
  - platform: yeelight
    devices:
        192.168.1.101:
            name: Living Room Lamp

image

Most helpful comment

discovery:
  ignore:
    - yeelight

Works for me, its hide the light not declared

All 22 comments

I'm no Home Assistant expert, but I would claim that this is intended behaviour. If you want to assign a custom name to the light bulb, it can be done inside customize.yaml. That being said, it would be difficult to change this behaviour, because the discovery of the light bulbs and setting up of the platform, happens in different threads, asynchronously.

The Yeelight component page certainly suggests a friendly name can be declared in the manner I have described above. In addition, this was working correctly (only one instance of the light - the one with the friendly name) in 0.62. This duplication only appeared with upgrade to 0.63.

For me the same issue after upgrading to 0.63.1.
I changed the way to set the friendly name via customize.yaml as @fattdev wrote. This works as intended.

Setting a friendly name as described in Yeelight component cause the issue.
Before, I added the lights with their friendly names to my lights group, now I'm using the full entity name.

I see. So the ability to add a friendly name as described here is either broken or obsolete and should be removed?

I understand. Though it seems to be a low priority issue to fix.

Agreed

I've just done a bit more testing and it seems that the "name" value is _Required_ rather than _Optional_ when declaring the yeelight component. So if you want to change any of the default settings (e.g. _transition time_), you have to declare a name, which then results in the light appearing twice (once from discovery:, once from light: platform: yeelight).

When I include the following code:

light:
  - platform: yeelight
    devices:
      192.168.1.101:
#        name: LR light
        transition: 1000

I get the following error:

2018-02-14 11:38:01 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform yeelight
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 84, in async_setup
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/yeelight.py", line 136, in setup_platform
    _LOGGER.debug("Adding configured %s", device_config[CONF_NAME])
KeyError: 'name'

I suggest, then, that this is not working as intended.

@Brazen00 Yes, I would agree in that case, Will look at it as soon as possible.

Just for reference: Put this in your customize.yaml to change the name of a Yeelight Bulb:

```
light.yeelight_rgb_xxxxxxxxxxxxx:
friendly_name: Awesome Light
````

This issue is still happening... T_T

Yes, having the same issue here. Even after setting a friendly name in customisation.yaml, i can see light_yeelight

I am also experiencing this problem.

Still an issue in 0.73 :)

discovery:
  ignore:
    - yeelight

Works for me, its hide the light not declared

The same problem here.
Only with yeelight bulbs (colour and white) and not with ceiling yeelights.

I tryied the:
discovery: ignore: - yeelight
but didn't work out.

Uyuhu

Same problem again here, 3 lights all duplicated.

The problem is that there is no way currently to get an unique id except via discovery, so the way to solve this is either to trust the discovery or configure it to ignore yeelight's as shown above.

@rytilahti Why is this a problem and what do you mean "trust"?
I'm currently using 4 Yeelights, entered all in customize.yaml and never see any dublicated entries

@mokshmridul The name is customize.yaml not customisation.yaml

@highground88 Read my comment here, this will fix your duplicated entries

@rytilahti Why is this a problem and what do you mean "trust"?
I'm currently using 4 Yeelights, entered all in customize.yaml and never see any dublicated entries

@mokshmridul The name is customize.yaml not customisation.yaml

@highground88 Read my comment here, this will fix your duplicated entries

Thanks for that. The spelling of the file was a typo, the actual changes were made in the correct file.

I managed to resolve this issue by adding the following lines to me configuration.yaml file
````#Discover some devices automatically
discovery:
ignore:
- yeelight

@pattyland by trusting I meant that you do not configure anything in your configuration file, but let the automatic discovery handle it. There is really nothing we can do in homeassistant's end to fix this properly, only way would be to try to ask if yeelight developers are willing to include an api call to request the information they deliver during the discovery process (e.g. on https://forum.yeelight.com/), so I'm closing this for now.

discovery:
  ignore:
    - yeelight

Works for me, its hide the light not declared

This worked for me too! Initially it gave an error because I was adding the entire text to the end of the file. This resulted in the term discovery being defined twice as it was already defined somewhere else in the file. Adding the ignore: -yeelight to the place where discovery was defined (i.e. avoiding duplicate definition of discovery) solved the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aweb-01 picture aweb-01  路  3Comments

kirichkov picture kirichkov  路  3Comments

MartinHjelmare picture MartinHjelmare  路  3Comments

sibbl picture sibbl  路  3Comments

piitaya picture piitaya  路  3Comments