home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.63k stars 30.78k forks source link

Yeelight color4 is not configured correctly #44540

Closed fallenruby closed 3 years ago

fallenruby commented 3 years ago

The problem

Yeelight Color 1S (color4) is discovered via integration but no device or entities is created. When adding manually the light in configuration.yaml, the light is not available (but entities is created)

The light has a fixed IP and LAN enabled. My other yeelights works without any problem (color1 and color2, via autodiscovery and manually)

Environment

Home Assistant 2020.12.1 on docker

Problem-relevant configuration.yaml

Traceback/Error logs

Additional information

probot-home-assistant[bot] commented 3 years ago

Hey there @rytilahti, @zewelor, @shenxn, mind taking a look at this issue as its been labeled with an integration (yeelight) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

benbrouse commented 3 years ago

I believe that the integration uses python-yeelight module for control. I recently asked for support to be added.
You can see thru this ticket that it was marked done: https://gitlab.com/stavros/python-yeelight/-/issues/60

HTH

rytilahti commented 3 years ago

Yes, the integration is using python-yeelight, could you please test if you can control the bulb without problems when using yeecli (https://pypi.org/project/yeecli/)?

Also, a related discussion on reddit, maybe useful for devs in case the problem is at homeassistant's end: https://www.reddit.com/r/homeassistant/comments/kmfmc9/home_assistant_and_yeelight_color_bulbs_problems/

zewelor commented 3 years ago

It would be good to add debug info. Add this in configure.yaml and paste output

logger:
  default: warn
  logs:
    homeassistant.components.yeelight: debug
    homeassistant.components.yeelight.light: debug
    homeassistant.components.yeelight.sensor: debug
    yeelight: debug
fallenruby commented 3 years ago

I've resolved this by adding the bulb via the HomeKit controller (the code is printed on the bulb). But I think that in this way we can't use the python-yeelight functions (flow, etc etc). Right now the light is always available when it should be. But since I think there's something there, and only with the 1S model, I will fire a VM and test it out some more with the logging requested by @zewelor and with yee-cli as suggested by @rytilahti - but with the command line tool and python scripts used with python-yeelight I've never had problems in the past. I've will give you an update on this soon. Thanks

mattague commented 3 years ago

Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml.

2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning
2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning
2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}

Let me know if this is not what you are looking for.

Silvest89 commented 3 years ago

Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml.

2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning
2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning
2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}

Let me know if this is not what you are looking for.

What firmware are you on?

benbrouse commented 3 years ago

I see the same thing and I'm on firmware 2.0.6_0031. HTH

On Sat, Jan 2, 2021 at 6:33 PM Johnnie Ho notifications@github.com wrote:

Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml.

2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning 2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}

Let me know if this is not what you are looking for.

What firmware are you on?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/44540#issuecomment-753543658, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKHR25I3V5KRNIQ7MJ3SX6UNNANCNFSM4VJ75ATA .

zewelor commented 3 years ago

If thats all from the logs, it looks like lan mode is not active, or light doesn't respond, from whatever reason. There is only request to light, and no response.

Silvest89 commented 3 years ago

I see the same thing and I'm on firmware 2.0.6_0031. HTH On Sat, Jan 2, 2021 at 6:33 PM Johnnie Ho @.***> wrote: Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml. 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning 2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} Let me know if this is not what you are looking for. What firmware are you on? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKHR25I3V5KRNIQ7MJ3SX6UNNANCNFSM4VJ75ATA .

They actually broke LAN Control in 2.06_0031, or well just the get_prop command which the integration is depending on. But in my current implementation (fork of the yeelight-library) I fallback to SSDP for discovery should get_prop fail. Which they broke for color4 only currently in 2.06_0031

My color4 bulb (1S) works fine, though I am using my own fork of python-yeelight. Mainly due to how LAN control is implemented in the yeelight firmwares. (Support max 4 connections, the yeelight library maintains the socket so restarting HA will leave you with dangling connections.) By just opening 5 telnet connections the fifth one would fail.

All my bulbs, ceiling20, ceiling10, color4, bslamp2 have had zero issues, since I decided to fork the python-yeelight lib. Since library is unmaintained atm.

https://gitlab.com/Silvest/python-yeelight-asyncio https://pypi.org/project/yeelight-jh/

The integation depends on the get_prop call for device capabilities etc. And also status updates at intervals. All other commands works when get_prop fails.

I have a few people on the yeelight forums using my fork. And it works fine for them. I am enrolled in the beta firmwares for all yeelight bulbs.

benbrouse commented 3 years ago

I hear what you are saying about the firmware but I had the issue prior to updating the firmware. I wish I had recorded the version numbers. However, it was broke prior to this firmware also.

On Sat, Jan 2, 2021 at 6:41 PM Johnnie Ho notifications@github.com wrote:

I see the same thing and I'm on firmware 2.0.6_0031. HTH … <#m8499351708409528073> On Sat, Jan 2, 2021 at 6:33 PM Johnnie Ho @.***> wrote: Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml. 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning 2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} Let me know if this is not what you are looking for. What firmware are you on? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment) https://github.com/home-assistant/core/issues/44540#issuecomment-753543658>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKHR25I3V5KRNIQ7MJ3SX6UNNANCNFSM4VJ75ATA .

They actually broke LAN Control in 2.06_0031 xD

My color4 bulb (1S) works fine, though I am using my own fork of python-yeelight. Mainly due to how LAN control is implemented in the yeelight firmwares. (Support max 4 connections, the yeelight library maintains the socket so restarting HA will leave you with dangling connections.) By just opening 5 telnet connections the fifth one would fail.

All my bulbs, ceiling20, ceiling10, color4, bslamp2 have had zero issues, since I decided to fork the python-yeelight lib. Since library is unmaintained atm.

https://gitlab.com/Silvest/python-yeelight https://pypi.org/project/yeelight-jh/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/44540#issuecomment-753544257, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKC5QLMLXZZ2XWZ5IZDSX6VK5ANCNFSM4VJ75ATA .

Silvest89 commented 3 years ago

I hear what you are saying about the firmware but I had the issue prior to updating the firmware. I wish I had recorded the version numbers. However, it was broke prior to this firmware also. On Sat, Jan 2, 2021 at 6:41 PM Johnnie Ho @.> wrote: I see the same thing and I'm on firmware 2.0.6_0031. HTH … <#m8499351708409528073> On Sat, Jan 2, 2021 at 6:33 PM Johnnie Ho @.> wrote: Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml. 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning 2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} Let me know if this is not what you are looking for. What firmware are you on? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment) <#44540 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKHR25I3V5KRNIQ7MJ3SX6UNNANCNFSM4VJ75ATA . They actually broke LAN Control in 2.06_0031 xD My color4 bulb (1S) works fine, though I am using my own fork of python-yeelight. Mainly due to how LAN control is implemented in the yeelight firmwares. (Support max 4 connections, the yeelight library maintains the socket so restarting HA will leave you with dangling connections.) By just opening 5 telnet connections the fifth one would fail. All my bulbs, ceiling20, ceiling10, color4, bslamp2 have had zero issues, since I decided to fork the python-yeelight lib. Since library is unmaintained atm. https://gitlab.com/Silvest/python-yeelight https://pypi.org/project/yeelight-jh/ — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKC5QLMLXZZ2XWZ5IZDSX6VK5ANCNFSM4VJ75ATA .

The python-yeelight library also needed a refactor in regaring to connections. It kept sockets open so after a while the the device would become unavailable in HA. This goes for other yeelight bulbs as well not just color4 (It did not properly close sockets if an error occurs, or well it did not ever close sockets) This is also what I addressed in my repo.

That's the reason I updated to 2.06_0031 but later found out the python-yeelight library needed some love as well. And also found out they broke get_prop completely in firmware 2.06_0031.

If you use docker you can easily use my python-yeelight fork and test it.

Silvest89 commented 3 years ago

You can contact me if you need help setting it up.

mattague commented 3 years ago

I hear what you are saying about the firmware but I had the issue prior to updating the firmware. I wish I had recorded the version numbers. However, it was broke prior to this firmware also. On Sat, Jan 2, 2021 at 6:41 PM Johnnie Ho @._> wrote: I see the same thing and I'm on firmware 2.0.6_0031. HTH … <#m8499351708409528073> On Sat, Jan 2, 2021 at 6:33 PM Johnnie Ho @._> wrote: Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml. 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning 2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} Let me know if this is not what you are looking for. What firmware are you on? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment) <#44540 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKHR25I3V5KRNIQ7MJ3SX6UNNANCNFSM4VJ75ATA . They actually broke LAN Control in 2.06_0031 xD My color4 bulb (1S) works fine, though I am using my own fork of python-yeelight. Mainly due to how LAN control is implemented in the yeelight firmwares. (Support max 4 connections, the yeelight library maintains the socket so restarting HA will leave you with dangling connections.) By just opening 5 telnet connections the fifth one would fail. All my bulbs, ceiling20, ceiling10, color4, bslamp2 have had zero issues, since I decided to fork the python-yeelight lib. Since library is unmaintained atm. https://gitlab.com/Silvest/python-yeelight https://pypi.org/project/yeelight-jh/ — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKC5QLMLXZZ2XWZ5IZDSX6VK5ANCNFSM4VJ75ATA .

The python-yeelight library also needed a refactor in regaring to connections. It kept sockets open so after a while the the device would become unavailable in HA. This goes for other yeelight bulbs as well not just color4 (It did not properly close sockets if an error occurs, or well it did not ever close sockets) This is also what I addressed in my repo.

That's the reason I updated to 2.06_0031 but later found out the python-yeelight library needed some love as well. And also found out they broke get_prop completely in firmware 2.06_0031.

If you use docker you can easily use my python-yeelight fork and test it.

You can contact me if you need help setting it up.

is there anyway this could be used when running natively on a raspberry pi? I'm not sure how I would go about it.

Silvest89 commented 3 years ago

I hear what you are saying about the firmware but I had the issue prior to updating the firmware. I wish I had recorded the version numbers. However, it was broke prior to this firmware also. On Sat, Jan 2, 2021 at 6:41 PM Johnnie Ho @._> wrote: I see the same thing and I'm on firmware 2.0.6_0031. HTH … <#m8499351708409528073> On Sat, Jan 2, 2021 at 6:33 PM Johnnie Ho @._> wrote: Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml. 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning 2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} Let me know if this is not what you are looking for. What firmware are you on? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment) <#44540 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKHR25I3V5KRNIQ7MJ3SX6UNNANCNFSM4VJ75ATA . They actually broke LAN Control in 2.06_0031 xD My color4 bulb (1S) works fine, though I am using my own fork of python-yeelight. Mainly due to how LAN control is implemented in the yeelight firmwares. (Support max 4 connections, the yeelight library maintains the socket so restarting HA will leave you with dangling connections.) By just opening 5 telnet connections the fifth one would fail. All my bulbs, ceiling20, ceiling10, color4, bslamp2 have had zero issues, since I decided to fork the python-yeelight lib. Since library is unmaintained atm. https://gitlab.com/Silvest/python-yeelight https://pypi.org/project/yeelight-jh/ — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKC5QLMLXZZ2XWZ5IZDSX6VK5ANCNFSM4VJ75ATA .

The python-yeelight library also needed a refactor in regaring to connections. It kept sockets open so after a while the the device would become unavailable in HA. This goes for other yeelight bulbs as well not just color4 (It did not properly close sockets if an error occurs, or well it did not ever close sockets) This is also what I addressed in my repo. That's the reason I updated to 2.06_0031 but later found out the python-yeelight library needed some love as well. And also found out they broke get_prop completely in firmware 2.06_0031. If you use docker you can easily use my python-yeelight fork and test it.

You can contact me if you need help setting it up.

is there anyway this could be used when running natively on a raspberry pi? I'm not sure how I would go about it.

You can mount the yeelight integration as a custom component and update the manifest.json to use my yeelight library instead.

So copy all files from https://github.com/home-assistant/core/tree/dev/homeassistant/components/yeelight

Put it into a folder such as yeelight_v2 Update the manifests.json


{
  "domain": "yeelight_v2",
  "name": "YeelightV2",
  "documentation": "https://www.home-assistant.io/integrations/yeelight",
  "requirements": [
    "yeelight-jh==0.11.2"
  ],
  "codeowners": [
    "@rytilahti",
    "@zewelor",
    "@shenxn"
  ],
  "config_flow": true
}

Create folder called custom_components in your root directory (where your configuration.yaml is) and copy the yeelight_v2 folder to custom_components.

Affter that update your configuration.yaml Uncomment yeelight: <-- This is important. If you use both, the original python-yeelight library will be used instead of mine. And use yeelight_v2:

Example:

yeelight_v2: 
  devices:
    192.168.1.1:
       name: Bed Room Light
fallenruby commented 3 years ago

Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml.

2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning
2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning
2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}

Same things that I get with the logger

The integation depends on the get_prop call for device capabilities etc. And also status updates at intervals. All other commands works when get_prop fails.

And that's it, since with yee-cli you can directly turn on/off by sending the command and not asking for device proprieties before as the integration does (rightly).

Silvest89 commented 3 years ago

Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml.

2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning
2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25
2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning
2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}
2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}

Same things that I get with the logger

The integation depends on the get_prop call for device capabilities etc. And also status updates at intervals. All other commands works when get_prop fails.

And that's it, since with yee-cli you can directly turn on/off by sending the command and not asking for device proprieties before as the integration does (rightly).

Yep, because the HA Integration is dependant of the get_prop to get the bulb statuses it also does it at regular intervals. However the python-yeelight implementation never actually closes sockets. This can cause the bulbs to show unavailable because sockets do not get closes and you will reach the firmware max 4 connections limit. To be less dependant of the firmware implementation.

2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']}

This just means it's stuck at waiting for response from the get_prop You can easily telnet into the bulb and see that get_prop does not give a response. It's either connection limit reached or that get_prop is broken and therefor you have to power cycle your bulb. The get_prop calls happens at regular intervals which means you will be forced to power cycle your bulb since sockets don't get closed....

I make sure to always close the socket. It's better this way since we don't and cannot maintain the yeelight firmware. For ex. each restart of HA will leave connections open. Errors throwed will leave connections open. They just never get properly closed in the python library.

Hence I just did a fork and after some extensive testing. All my bulbs now work correctly. I fallback on SSDP for when get_prop call fails. Which they do in some of the latest beta firmware, (currently only color4 get_prop is completely broken)

bingo6 commented 3 years ago

I hear what you are saying about the firmware but I had the issue prior to updating the firmware. I wish I had recorded the version numbers. However, it was broke prior to this firmware also. On Sat, Jan 2, 2021 at 6:41 PM Johnnie Ho @._> wrote: I see the same thing and I'm on firmware 2.0.6_0031. HTH … <#m8499351708409528073> On Sat, Jan 2, 2021 at 6:33 PM Johnnie Ho @._> wrote: Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml. 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning 2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} Let me know if this is not what you are looking for. What firmware are you on? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment) <#44540 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKHR25I3V5KRNIQ7MJ3SX6UNNANCNFSM4VJ75ATA . They actually broke LAN Control in 2.06_0031 xD My color4 bulb (1S) works fine, though I am using my own fork of python-yeelight. Mainly due to how LAN control is implemented in the yeelight firmwares. (Support max 4 connections, the yeelight library maintains the socket so restarting HA will leave you with dangling connections.) By just opening 5 telnet connections the fifth one would fail. All my bulbs, ceiling20, ceiling10, color4, bslamp2 have had zero issues, since I decided to fork the python-yeelight lib. Since library is unmaintained atm. https://gitlab.com/Silvest/python-yeelight https://pypi.org/project/yeelight-jh/ — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKC5QLMLXZZ2XWZ5IZDSX6VK5ANCNFSM4VJ75ATA .

The python-yeelight library also needed a refactor in regaring to connections. It kept sockets open so after a while the the device would become unavailable in HA. This goes for other yeelight bulbs as well not just color4 (It did not properly close sockets if an error occurs, or well it did not ever close sockets) This is also what I addressed in my repo. That's the reason I updated to 2.06_0031 but later found out the python-yeelight library needed some love as well. And also found out they broke get_prop completely in firmware 2.06_0031. If you use docker you can easily use my python-yeelight fork and test it.

You can contact me if you need help setting it up.

is there anyway this could be used when running natively on a raspberry pi? I'm not sure how I would go about it.

You can mount the yeelight integration as a custom component and update the manifest.json to use my yeelight library instead.

So copy all files from https://github.com/home-assistant/core/tree/dev/homeassistant/components/yeelight

Put it into a folder such as yeelight_v2 Update the manifests.json


{
  "domain": "yeelight_v2",
  "name": "YeelightV2",
  "documentation": "https://www.home-assistant.io/integrations/yeelight",
  "requirements": [
    "yeelight-jh==0.11.2"
  ],
  "codeowners": [
    "@rytilahti",
    "@zewelor",
    "@shenxn"
  ],
  "config_flow": true
}

Create folder called custom_components in your root directory (where your configuration.yaml is) and copy the yeelight_v2 folder to custom_components.

Affter that update your configuration.yaml Uncomment yeelight: <-- This is important. If you use both, the original python-yeelight library will be used instead of mine. And use yeelight_v2:

Example:

yeelight_v2: 
  devices:
    192.168.1.1:
       name: Bed Room Light

Thanks! Works great :-)

Silvest89 commented 3 years ago

I hear what you are saying about the firmware but I had the issue prior to updating the firmware. I wish I had recorded the version numbers. However, it was broke prior to this firmware also. On Sat, Jan 2, 2021 at 6:41 PM Johnnie Ho @._> wrote: I see the same thing and I'm on firmware 2.0.6_0031. HTH … <#m8499351708409528073> On Sat, Jan 2, 2021 at 6:33 PM Johnnie Ho @._> wrote: Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml. 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning 2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} Let me know if this is not what you are looking for. What firmware are you on? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment) <#44540 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKHR25I3V5KRNIQ7MJ3SX6UNNANCNFSM4VJ75ATA . They actually broke LAN Control in 2.06_0031 xD My color4 bulb (1S) works fine, though I am using my own fork of python-yeelight. Mainly due to how LAN control is implemented in the yeelight firmwares. (Support max 4 connections, the yeelight library maintains the socket so restarting HA will leave you with dangling connections.) By just opening 5 telnet connections the fifth one would fail. All my bulbs, ceiling20, ceiling10, color4, bslamp2 have had zero issues, since I decided to fork the python-yeelight lib. Since library is unmaintained atm. https://gitlab.com/Silvest/python-yeelight https://pypi.org/project/yeelight-jh/ — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKC5QLMLXZZ2XWZ5IZDSX6VK5ANCNFSM4VJ75ATA .

The python-yeelight library also needed a refactor in regaring to connections. It kept sockets open so after a while the the device would become unavailable in HA. This goes for other yeelight bulbs as well not just color4 (It did not properly close sockets if an error occurs, or well it did not ever close sockets) This is also what I addressed in my repo. That's the reason I updated to 2.06_0031 but later found out the python-yeelight library needed some love as well. And also found out they broke get_prop completely in firmware 2.06_0031. If you use docker you can easily use my python-yeelight fork and test it.

You can contact me if you need help setting it up.

is there anyway this could be used when running natively on a raspberry pi? I'm not sure how I would go about it.

You can mount the yeelight integration as a custom component and update the manifest.json to use my yeelight library instead. So copy all files from https://github.com/home-assistant/core/tree/dev/homeassistant/components/yeelight Put it into a folder such as yeelight_v2 Update the manifests.json


{
  "domain": "yeelight_v2",
  "name": "YeelightV2",
  "documentation": "https://www.home-assistant.io/integrations/yeelight",
  "requirements": [
    "yeelight-jh==0.11.2"
  ],
  "codeowners": [
    "@rytilahti",
    "@zewelor",
    "@shenxn"
  ],
  "config_flow": true
}

Create folder called custom_components in your root directory (where your configuration.yaml is) and copy the yeelight_v2 folder to custom_components. Affter that update your configuration.yaml Uncomment yeelight: <-- This is important. If you use both, the original python-yeelight library will be used instead of mine. And use yeelight_v2: Example:

yeelight_v2: 
  devices:
    192.168.1.1:
       name: Bed Room Light

Thanks! Works great :-)

That's good to hear! I am in the process of having this merged in the original library (merge requests open) so whenever that's all done I'll open up a pull request for HA to have the library updated.

TheIronShadow commented 3 years ago

@Silvest89 Thanks for making a fork. I only have an issue that it won't pick up my light with your fork. I have copied all files from Yeelight to a folder in custom_components called "yeelight_v2" I have changed the manifest.json to what you said I have added the config in the configuration.yaml with the yeelight_v2 domain

Do you have any solution for my problem. You can also DM me if that is even possible on github?

mattague commented 3 years ago

Yeah, it isn't generating devices or entities in my setup either, following your directions exactly. I only have 2 color4 bulbs from yeelight.

jerkovicl commented 3 years ago

Doesn't generate device or entitiy for me aswell I only have lightstrip

TheIronShadow commented 3 years ago

I hear what you are saying about the firmware but I had the issue prior to updating the firmware. I wish I had recorded the version numbers. However, it was broke prior to this firmware also. On Sat, Jan 2, 2021 at 6:41 PM Johnnie Ho @._> wrote: I see the same thing and I'm on firmware 2.0.6_0031. HTH … <#m8499351708409528073> On Sat, Jan 2, 2021 at 6:33 PM Johnnie Ho @._> wrote: Not the original commentor, but I am having this issue as well. This is what the log outputs when I add that into the config.yaml. 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Start scanning 2021-01-02 17:13:31 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight scanning 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.15 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Yeelight discovered at 192.168.1.25 2021-01-02 17:13:34 DEBUG (MainThread) [homeassistant.components.yeelight] Stop scanning 2021-01-02 17:13:34 DEBUG (SyncWorker_6) [yeelight.main] Bulb<192.168.1.15:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-02 17:13:34 DEBUG (SyncWorker_4) [yeelight.main] Bulb<192.168.1.25:55443, type=BulbType.Unknown> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} Let me know if this is not what you are looking for. What firmware are you on? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment) <#44540 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKHR25I3V5KRNIQ7MJ3SX6UNNANCNFSM4VJ75ATA . They actually broke LAN Control in 2.06_0031 xD My color4 bulb (1S) works fine, though I am using my own fork of python-yeelight. Mainly due to how LAN control is implemented in the yeelight firmwares. (Support max 4 connections, the yeelight library maintains the socket so restarting HA will leave you with dangling connections.) By just opening 5 telnet connections the fifth one would fail. All my bulbs, ceiling20, ceiling10, color4, bslamp2 have had zero issues, since I decided to fork the python-yeelight lib. Since library is unmaintained atm. https://gitlab.com/Silvest/python-yeelight https://pypi.org/project/yeelight-jh/ — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#44540 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUURKC5QLMLXZZ2XWZ5IZDSX6VK5ANCNFSM4VJ75ATA .

The python-yeelight library also needed a refactor in regaring to connections. It kept sockets open so after a while the the device would become unavailable in HA. This goes for other yeelight bulbs as well not just color4 (It did not properly close sockets if an error occurs, or well it did not ever close sockets) This is also what I addressed in my repo. That's the reason I updated to 2.06_0031 but later found out the python-yeelight library needed some love as well. And also found out they broke get_prop completely in firmware 2.06_0031. If you use docker you can easily use my python-yeelight fork and test it.

You can contact me if you need help setting it up.

is there anyway this could be used when running natively on a raspberry pi? I'm not sure how I would go about it.

You can mount the yeelight integration as a custom component and update the manifest.json to use my yeelight library instead.

So copy all files from https://github.com/home-assistant/core/tree/dev/homeassistant/components/yeelight

Put it into a folder such as yeelight_v2 Update the manifests.json


{
  "domain": "yeelight_v2",
  "name": "YeelightV2",
  "documentation": "https://www.home-assistant.io/integrations/yeelight",
  "requirements": [
    "yeelight-jh==0.11.2"
  ],
  "codeowners": [
    "@rytilahti",
    "@zewelor",
    "@shenxn"
  ],
  "config_flow": true
}

Create folder called custom_components in your root directory (where your configuration.yaml is) and copy the yeelight_v2 folder to custom_components.

Affter that update your configuration.yaml Uncomment yeelight: <-- This is important. If you use both, the original python-yeelight library will be used instead of mine. And use yeelight_v2:

Example:

yeelight_v2: 
  devices:
    192.168.1.1:
       name: Bed Room Light

Could you help us with this issue?

sdemmery commented 3 years ago

Doesn't generate device or entitiy for me aswell I only have lightstrip

Same issue here, this latest yeelight update has been driving me nuts found hope here & have the python library working well. Implemented as per instructions as custom component & seems to register in log but no entities show up in HA. Im running color(1s) bulbs. @Silvest89 any chance of helping us out you have done some excellent work here we are all stuck now :-(

Silvest89 commented 3 years ago

Doesn't generate device or entitiy for me aswell I only have lightstrip

Same issue here, this latest yeelight update has been driving me nuts found hope here & have the python library working well. Implemented as per instructions as custom component & seems to register in log but no entities show up in HA. Im running color(1s) bulbs. @Silvest89 any chance of helping us out you have done some excellent work here we are all stuck now :-(

I am sorry for the late reply! Anyway I forgot to mention. Besides updating the domain and name in the manifest.json also update it in the init.py, this should fix your problem ;]

DOMAIN = "yeelight_v2"
DATA_YEELIGHT = DOMAIN
DATA_UPDATED = "yeelight_{}_data_updated"
DEVICE_INITIALIZED = "yeelight_{}_device_initialized"

DEFAULT_NAME = "YeelightV2"
sdemmery commented 3 years ago

Doesn't generate device or entitiy for me aswell I only have lightstrip

Same issue here, this latest yeelight update has been driving me nuts found hope here & have the python library working well. Implemented as per instructions as custom component & seems to register in log but no entities show up in HA. Im running color(1s) bulbs. @Silvest89 any chance of helping us out you have done some excellent work here we are all stuck now :-(

I am sorry for the late reply! Anyway I forgot to mention. Besides updating the domain and name in the manifest.json also update it in the init.py, this should fix your problem ;]

DOMAIN = "yeelight_v2"
DATA_YEELIGHT = DOMAIN
DATA_UPDATED = "yeelight_{}_data_updated"
DEVICE_INITIALIZED = "yeelight_{}_device_initialized"

DEFAULT_NAME = "YeelightV2"

No problem at all with the delay you are the one helping here & we all appreciate it very much, also following over on the Yeelight forum but cant post over there as the verify email to new account never arrives :-( Have also played with your Python Library outside of HA great work there, will come in useful at some point for me.

Feels a lot closer now with your above fix have a very active yeelight_v2 log, but alas still not working. Heres the log entry if it helps point me in the right direction.

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/yeelight/main.py", line 537, in get_a_prop reader, writer = await asyncio.wait_for(asyncio.open_connection( File "/usr/local/lib/python3.8/asyncio/tasks.py", line 494, in wait_for return fut.result() File "/usr/local/lib/python3.8/asyncio/streams.py", line 52, in openconnection transport, = await loop.create_connection( File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection raise exceptions[0] File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 496, in sock_connect return await fut File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('10.0.0.45', 55443) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/yeelight/main.py", line 552, in get_a_prop raise BulbException(e) yeelight.main.BulbException: [Errno 113] Connect call failed ('10.0.0.45', 55443) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 130, in async_init result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 213, in _async_handle_step result: Dict = await getattr(flow, method)(user_input) File "/config/custom_components/yeelight_v2/config_flow.py", line 115, in async_step_import await self._async_try_connect(host) File "/config/custom_components/yeelight_v2/config_flow.py", line 151, in _async_try_connect await self.hass.async_add_executor_job(bulb.get_properties) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.8/site-packages/yeelight/main.py", line 506, in get_properties response = asyncio.run(self.get_a_prop("get_prop", requested_properties)) File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/usr/local/lib/python3.8/site-packages/yeelight/main.py", line 554, in get_a_prop writer.close() UnboundLocalError: local variable 'writer' referenced before assignment

sdemmery commented 3 years ago

looking again at my log about is this correct /usr/local/lib/python3.8/site-packages/yeelight/main.py" should this not be looking for your library? Also there is a bulb on 10.0.0.45 that was off when i rebooted by I have an additional 4 that did not appear in HA

Thankfully all my automations still run as i do them separately in nodered using a yeelight pluggin so the bulbs are connected to the network (fixed IPs) & working just not seeing them in HA :-(

My config below configuration.yaml yeelight_v2: devices: 10.0.0.42: name: Lounge Bulb 10.0.0.45: name: Hallway Bulb 10.0.0.46: name: Landing Bulb 10.0.0.47: name: Top Landing Bulb 10.0.0.48: name: Bedroom 3 Bulb

manifest { "domain": "yeelight_v2", "name": "YeelightV2", "documentation": "https://www.home-assistant.io/integrations/yeelight", "requirements": [ "yeelight-jh==0.11.2" ], "codeowners": [ "@rytilahti", "@zewelor", "@shenxn" ], "config_flow": true }

init.py DOMAIN = "yeelight_v2" DATA_YEELIGHT = DOMAIN DATAUPDATED = "yeelight{}_data_updated" DEVICEINITIALIZED = "yeelight{}_device_initialized"

DEFAULT_NAME = "YeelightV2" DEFAULT_TRANSITION = 350

I have 2 instances of HA one on a RPi running supervisor install & the other on a synology NAS under docker. Both doing the same. Entities not showing up.

Thanks again for your help

Silvest89 commented 3 years ago

@sdemmery I've created a repo containing the integration (easier for issues tracking), and embedded the yeelight library which I will maintain instead of the external one, this should prevent conflicts with the default yeelight library already in HA.

https://github.com/Silvest89/yeelight_v2

Remove the old yeelight_v2 folder Go to custom_components

git clone --recursive git@github.com:Silvest89/yeelight_v2.git
Restart HA

The logger settings:

logger:
  default: critical
  logs:
    custom_components.yeelight_v2: debug
    custom_components.yeelight_v2.python_yeelight.yeelight.main: debug

I will be working on integrating the miio protocol (much more stable, over UDP, so connectionless) and you don't even need LAN control for it to be enabled. Though you'd have to know how to extract tokens ;]

sdemmery commented 3 years ago

@Silvest89 do you need to alter some permissions on you repo?

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'github.com,140.82.121.4' (RSA) to the list of known hosts. git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

milo protocol sounds like a good plan.

Silvest89 commented 3 years ago

@sdemmery Try ssh -T git@github.com If this fails it means you havent properly added your pub key in github

As an alternative you can also use HTTPS instead of ssh though I'd recommend ssh (since the submodules are configured to pull using ssh as well) Else you'd have to manually pull in those respective repositories

git clone --recursive https://github.com/Silvest89/yeelight_v2.git
sdemmery commented 3 years ago

Sorry not to up too speed with github. Have added my public key & can connect (see below but still same error :-)) ssh -T git@github Hi sdemmery! You've successfully authenticated, but GitHub does not provide shell access.

MacBook-Pro:temp stuart$ git clone git@github.com:Silvest89/yeelight_v2.git Cloning into 'yeelight_v2'... git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Almost certainly my fault Ha!

Silvest89 commented 3 years ago

@sdemmery haha well I have troubleshooted it a bit. It all comes down that you need to use HTTPS instead Using SSH on a repo with is not your own for which you don't have WRITE access causes this.

I've pushed a commit and made sure the submodules are pulled using HTTPS as well. And tested it on a computer with no ssh keys.

Anyway this should do it (HTTPS):

git clone --recursive https://github.com/Silvest89/yeelight_v2.git
sdemmery commented 3 years ago

Oh Wow! Im back in business. working great now @Silvest89. Thanks so much for your effort. Looking forward to see where you go with this next. I have 5 Yeelight bulbs & to be honest regretted the day I bought them, have been super flakey, compounded with bad updates has made them difficult to live with. Maybe this can change now. :-)

sdemmery commented 3 years ago

I spoke to soon, they show up now but I have to power cycle them to get them to show up then in a few minutes they go greyed out again. Heres one of the logs 5 bulbs (all doing the same)

Whats also happening is its killing my node red automations, the bulbs once in this state wont connect to the nodered yeelight plugin so disabling yeelight_v2 for now :-(

2021-01-17 17:20:26 DEBUG (MainThread) [custom_components.yeelight_v2] Importing configured 10.0.0.42 2021-01-17 17:20:26 DEBUG (MainThread) [custom_components.yeelight_v2] Importing configured 10.0.0.45 2021-01-17 17:20:26 DEBUG (MainThread) [custom_components.yeelight_v2] Importing configured 10.0.0.46 2021-01-17 17:20:26 DEBUG (MainThread) [custom_components.yeelight_v2] Importing configured 10.0.0.47 2021-01-17 17:20:26 DEBUG (MainThread) [custom_components.yeelight_v2] Importing configured 10.0.0.48 2021-01-17 17:20:27 DEBUG (SyncWorker_6) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Bulb<10.0.0.45:55443, type=-1> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-17 17:20:27 DEBUG (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Bulb<10.0.0.46:55443, type=-1> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-17 17:20:27 DEBUG (SyncWorker_0) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Bulb<10.0.0.47:55443, type=-1> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-17 17:20:27 DEBUG (SyncWorker_2) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Bulb<10.0.0.42:55443, type=-1> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-17 17:20:27 DEBUG (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Bulb<10.0.0.48:55443, type=-1> > {'id': 0, 'method': 'get_prop', 'params': ['power', 'main_power', 'bright', 'ct', 'rgb', 'hue', 'sat', 'color_mode', 'flowing', 'bg_power', 'bg_lmode', 'bg_flowing', 'bg_ct', 'bg_bright', 'bg_hue', 'bg_sat', 'bg_rgb', 'nl_br', 'active_mode']} 2021-01-17 17:20:27 DEBUG (SyncWorker_3) [custom_components.yeelight_v2.python_yeelight.yeelight.main] Bulb<10.0.0.48:55443, type=1> < {'id': 0, 'result': ['on', '', '100', '3000', '16711680', '359', '100', '2', '0', '', '', '', '', '', '', '', '', '', '']} 2021-01-17 17:20:27 DEBUG (SyncWorker_3) [custom_components.yeelight_v2] Device 10.0.0.48, Bedroom 3 Bulb capabilities: {'id': '0x00000000078f9fbb', 'model': 'color4', 'fw_ver': '31', 'support': 'get_prop set_default set_power toggle set_bright set_scene cron_add cron_get cron_del start_cf stop_cf set_ct_abx adjust_ct set_name set_adjust adjust_bright adjust_color set_rgb set_hsv set_music udp_new udp_keep_alive chroma', 'power': 'on', 'bright': '100', 'color_mode': '2', 'ct': '3000', 'rgb': '16711680', 'hue': '359', 'sat': '100', 'name': ''} 2021-01-17 17:20:30 ERROR (SyncWorker_2) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-17 17:20:30 ERROR (SyncWorker_0) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-17 17:20:30 ERROR (SyncWorker_6) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out 2021-01-17 17:20:30 ERROR (SyncWorker_1) [custom_components.yeelight_v2.python_yeelight.yeelight.main] timed out

sdemmery commented 3 years ago

that update is giving me fatal: not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Silvest89 commented 3 years ago

@sdemmery You need to do it in the yeelight_v2 root of the folder

git submodule update --recursive --remote

remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 4 (delta 3), reused 4 (delta 3), pack-reused 0
Unpacking objects: 100% (4/4), 399 bytes | 99.00 KiB/s, done.
From https://github.com/Silvest89/python-yeelight
   7fbb762..9ebb357  master     -> origin/master
Submodule path 'python_yeelight': checked out '9ebb35767e232d276ab9d23e5ba65addfb4baca6'

Or you can always remove yeelight_v2 and redo :P

git clone --recursive https://github.com/Silvest89/yeelight_v2.git
sdemmery commented 3 years ago

ah yes of course apologies i thought i was in the yeelight_v2 folder was only at custom_components. Well 5mins in & looking good! All bulbs now showing in lovelace, none seem to have dropped out & my Nodered automations work. Amazing! @Silvest89 Your "The Man" 🥇

Silvest89 commented 3 years ago

ah yes of course apologies i thought i was in the yeelight_v2 folder was only at custom_components. Well 5mins in & looking good! All bulbs now showing in lovelace, none seem to have dropped out & my Nodered automations work. Amazing! @Silvest89 Your "The Man"

Well a lot can still happen, post any issues on the repo issue tracker.

The next big thing is the miio protocol it uses the same way xiaomi/yeelight communicates with the bulb. So bye bye buggy LAN Control. The downside is that it's requires you to extract the tokens used for authentication. I already have an initial implementation though.

As explained here : https://python-miio.readthedocs.io/en/latest/yeelight.html#yeelight-token-extraction

TLDR Android token extraction:

adb backup -noapk com.yeelight.cherry -f backup.ab

miio-extract-tokens /tmp/yeelight.ab --password a

Unable to find miio database file apps/com.xiaomi.smarthome/db/miio2.db: "filename 'apps/com.xiaomi.smarthome/db/miio2.db' not found"
INFO:miio.extract_tokens:Trying to read apps/com.yeelight.cherry/sp/miot.xml
INFO:miio.extract_tokens:Reading tokens from Yeelight Android DB
Yeelight Color Bulb
        Model: yeelink.light.color1
        IP address: 192.168.xx.xx
        Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        MAC: F0:B4:29:xx:xx:xx
Mi Bedside Lamp
        Model: yeelink.light.bslamp1
        IP address: 192.168.xx.xx
        Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        MAC: 7C:49:EB:xx:xx:xx
dennyha commented 3 years ago

Hi there @Silvest89, I was wondering if you could help me get this up and running (I am very new to HA). I have a fresh install of HA Core running on Synology Docker and I uninstalled the original Yeelight integration. I have installed HACS, I created a yeelight_v2 folder in the custom_components folder and ran: @ _git clone --recursive git@github.com:Silvest89/yeelightv2.git

The files downloaded succesfully and I reloaded HA but I am not having any luck finding anything. I even entered the following into my configuration.yaml:

_yeelight_v2: devices: 192.168.1.71: name: "Desk_Lamp" ssdpfallback: True //recommended default value is False

Upon checking this configuration before reloading HA I got the following error message:

_Component error: yeelight_v2 - Integration 'yeelightv2' not found.

Have I missed a step out somewhere here? Any help would be much appreciated.

Regards

Silvest89 commented 3 years ago

@dennyha You should execute this in custom_components, this will create a yeelight_v2 folder for you already

git clone --recursive git@github.com:Silvest89/yeelight_v2.git

Your tree (folder structure) probably looks like this now:

configuration.yaml
custom_components
   yeelight_v2
       yeelight_v2

Configuration.yaml

yeelight_v2:
  devices:
    192.168.1.71:
      name: "Desk_Lamp"
      ssdp_fallback: True
dennyha commented 3 years ago

Doh! I should have looked. Thanks for this. Right I have it loaded but unfortuantely I have no entities showing ... any idea why?

Silvest89 commented 3 years ago

@dennyha Can you go to my git and open an issue, with the logs? You can check the readme for how to enable the logs for the custom integration.

Anyway I just fixed a bug in regards to your problem. Can you delete the folder and re-do

git clone --recursive git@github.com:Silvest89/yeelight_v2.git
dennyha commented 3 years ago

Please ignore my problem, stupidly my ip was out by a digit. Grrrr. Working great, thank you so much.

JoshSald commented 3 years ago

@Silvest89 I appreciate the work you've put into this! I finally have my lights showing up as entities. One issue I'm having though is that they become unavailable sometimes. I've had this issue in the past with the original Yeelight integration. Would you happen to know what the issue is?

Edit: It's an issue when adding custom effects it seems. Works fine if they're commented out :/

dennyha commented 3 years ago

Just to keep you up to date, all is working fine apart from when I restart HA. I need to power cycle the bulb to get it to come back.

makolink commented 3 years ago

@Silvest89 Thank you for your work on this - I was about to give up on Yeelight but your repo has fixed the stability problems I was experiencing with these bulbs. yeelink.light.color3 with firmware v2.0.6_0035 yeelink.light.color4 with firmware v2.0.6_0031 Both working and appearing in Home Assistant 2021.1.5 Much appreciated!

dennyha commented 3 years ago

Further update, bulb was working fine but then ran into more issues requiring a power cycle. I have now implemented miio token and it works perfectly.

P1e1t1e1r1 commented 3 years ago

@Silvest89 Thanks for your effort, this fixed my color4 bulbs and ended some frustration! However I'm not able to get the entities night and background lights for my ceiling20 light to show up, only the main light?

devices: 192.168.50.130: name: Office light model: ceiling20 ssdp_fallback: true

zatarra77 commented 3 years ago

Thank you for sharing your good job, @Silvest89

I was able to integrate your custom component (I keep using the original one for my older bulb and yours for my new strip6) I have to report that there is a delay from 3 to 6 seconds after launching a command from HA (turning on/off, change color, etc)

Today, I've text to you on yeelight forum but I was unable to integrate it (older component without the merge of the yeelight library)

zatarra77 commented 3 years ago

Latest news: I was able to extract my token and use the miio protocol.... Now all commands are very fast! Only the reading of the status remains slow... for example, if I turn off the strip from the button, Home Assistant needs about 5-10 seconds to update the status