Another connection issue thread with lots of research and will to help and test!

done

Hi, please list which products are you using.

Hello Liufeu,

I have already received the 2.0.6_0031 update 2 weeks ago (27-11-2020). After some monitoring I can say that the bulbs are still going unavailable on Home Assistant. Though they are a little more responsive on the Yeelight app.

I’m looking forward for the beta version with the fix.
Again thank you all for the great research and support.

@liufei

So I’ve updated one of my models to the beta firmwares

ceiling20 2.0.6__0026
color4 2.0.6__0031
bslamp2 2.06__0040

It seems to have gotten worse for bslamp2. Responses all get timeouts (You can still send commands but you won’t ever get a response) Home assistant does get_props response to set bulb’s availability and initial status. Will update later on ceiling20 and color4

My models on older firmwares works fine.
ceiling20 2.06_0020
bslamp2 2.06_0030
I don’t have a another color4 to test

The easiest way to test it in your lab is to use

It uses the same library used in home assistant.

pip install yeecli or pip3 install yeecli

And then for example:

yee --ip=192.168.0.34 status
yee --ip=192.168.0.34 turn off
yee --ip=192.168.0.34 turn on

You will be able to turn bulbs on/off but you will get timeout on response.

Ceiling3, Ceiling4

Hey @liufei,

here now also my reports from the two YLXD42YL (ceiling15), the YLXD50YL (ceiling20) and the YLDL01YL (ceiling10), also again over 24h from 9am-9am.
They all look the same now like the two bedside lamps I already reported. So a few socket errors still every 3.5-4h:

One of the YLXD42YL / ceiling15:

2020-12-04 07:59:45 ERROR (SyncWorker_43) [homeassistant.components.yeelight] Unable to update device 192.168.178.27, [Office] Ceiling Light: A socket error occurred when sending the command.
2020-12-04 11:20:15 ERROR (SyncWorker_14) [homeassistant.components.yeelight] Unable to update device 192.168.178.27, [Office] Ceiling Light: A socket error occurred when sending the command.
2020-12-04 14:40:46 ERROR (SyncWorker_32) [homeassistant.components.yeelight] Unable to update device 192.168.178.27, [Office] Ceiling Light: A socket error occurred when sending the command.
2020-12-04 18:01:16 ERROR (SyncWorker_38) [homeassistant.components.yeelight] Unable to update device 192.168.178.27, [Office] Ceiling Light: A socket error occurred when sending the command.
2020-12-04 21:22:17 ERROR (SyncWorker_12) [homeassistant.components.yeelight] Unable to update device 192.168.178.27, [Office] Ceiling Light: A socket error occurred when sending the command.
2020-12-04 23:45:18 ERROR (SyncWorker_30) [homeassistant.components.yeelight] Unable to update device 192.168.178.27, [Office] Ceiling Light: Bulb closed the connection.
2020-12-05 03:05:48 ERROR (SyncWorker_43) [homeassistant.components.yeelight] Unable to update device 192.168.178.27, [Office] Ceiling Light: A socket error occurred when sending the command.
2020-12-05 06:26:19 ERROR (SyncWorker_20) [homeassistant.components.yeelight] Unable to update device 192.168.178.27, [Office] Ceiling Light: A socket error occurred when sending the command.

Please note, that the one “Bulb closed the connection.” was me hitting the light switch.

YLXD50YL / ceiling20:

2020-12-04 09:40:15 ERROR (SyncWorker_7) [homeassistant.components.yeelight] Unable to update device 192.168.178.24, [Living Room] Ceiling Light: A socket error occurred when sending the command.
2020-12-04 13:00:45 ERROR (SyncWorker_3) [homeassistant.components.yeelight] Unable to update device 192.168.178.24, [Living Room] Ceiling Light: A socket error occurred when sending the command.
2020-12-04 16:21:16 ERROR (SyncWorker_29) [homeassistant.components.yeelight] Unable to update device 192.168.178.24, [Living Room] Ceiling Light: A socket error occurred when sending the command.
2020-12-04 18:58:16 ERROR (SyncWorker_0) [homeassistant.components.yeelight] Unable to update device 192.168.178.24, [Living Room] Ceiling Light: Bulb closed the connection.
2020-12-04 19:41:47 ERROR (SyncWorker_7) [homeassistant.components.yeelight] Unable to update device 192.168.178.24, [Living Room] Ceiling Light: A socket error occurred when sending the command.
2020-12-04 23:02:17 ERROR (SyncWorker_49) [homeassistant.components.yeelight] Unable to update device 192.168.178.24, [Living Room] Ceiling Light: A socket error occurred when sending the command.
2020-12-05 02:22:48 ERROR (SyncWorker_18) [homeassistant.components.yeelight] Unable to update device 192.168.178.24, [Living Room] Ceiling Light: A socket error occurred when sending the command.
2020-12-05 05:43:18 ERROR (SyncWorker_17) [homeassistant.components.yeelight] Unable to update device 192.168.178.24, [Living Room] Ceiling Light: A socket error occurred when sending the command.
2020-12-05 09:03:49 ERROR (SyncWorker_45) [homeassistant.components.yeelight] Unable to update device 192.168.178.24, [Living Room] Ceiling Light: A socket error occurred when sending the command.

YLDL01YL / ceiling10:

2020-12-04 07:47:15 ERROR (SyncWorker_26) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: A socket error occurred when sending the command.
2020-12-04 11:07:45 ERROR (SyncWorker_42) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: A socket error occurred when sending the command.
2020-12-04 11:32:20 ERROR (SyncWorker_25) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: Bulb closed the connection.
2020-12-04 11:35:50 ERROR (SyncWorker_40) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: Bulb closed the connection.
2020-12-04 12:03:15 ERROR (SyncWorker_48) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: A socket error occurred when sending the command.
2020-12-04 12:35:45 ERROR (SyncWorker_23) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: Bulb closed the connection.
2020-12-04 15:56:46 ERROR (SyncWorker_12) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: A socket error occurred when sending the command.
2020-12-04 18:42:51 ERROR (SyncWorker_24) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: Bulb closed the connection.
2020-12-04 22:04:47 ERROR (SyncWorker_23) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: A socket error occurred when sending the command.
2020-12-05 01:25:18 ERROR (SyncWorker_49) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: A socket error occurred when sending the command.
2020-12-05 04:45:48 ERROR (SyncWorker_34) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: A socket error occurred when sending the command.
2020-12-05 08:06:19 ERROR (SyncWorker_20) [homeassistant.components.yeelight] Unable to update device 192.168.178.60, [Dining  Room] Pendant Light: A socket error occurred when sending the command.

So I’m still curious about these errors every 3.5-4h, which still smell a bit. I’m now doing a test again with allowing internet again with the beta and see if these also happen every-3.5.4h.

Hope this is somehow helpful!

Also: Is the fix for the issue of the color2 bulbs getting completely unresponsive also on the way?

Greetings,

Andy!

@liufei
I did some more testing as well. All models with the new beta firmware stops responding to even telnet requests. You can use telnet to turn it off/on but you won’t get any response.

So this is not a home assistant issue.

Easily to test just by doing a few requests ,with telnet

Not trying! Actually doing it. Check documentation socket() and documentation on Yeelight. You will see the library does not work as per documentation in this case

Same goes for your fix. You can’t expect to close a socket and then start reading on a new socket for the response.

I have forked the python yeelight library and refactored the socket handling to use asyncio. My HA instance now uses this.

@liufei The ceiling20 and bslamp2 lights seems to be working with the latest beta firmware are still up. Will keep everyone updated.

As for color4 even without using home-assistant with telnet

Trying 172.*.*.*...
Connected to 172.*.*.*.
Escape character is '^]'.
Connection closed by foreign host.

Bulb just closes the connection. I have to power off and on the light for it to work for a short time again

1 个赞

Hi @liufei …I am using 3 mi smart bulbs - yeelink.light.color3 . I am using the Singapore server. The problem still persists. problem is only with the colour3 bulbs. Whenever the router resets the bulbs go offline and cannot connect to the wifi automatically. My mi id is 5354206260 .Plz tell me if u need any more info. Thx

Can you also share your implementation / fork?

Well, could be that you’re right. Not denying it.
But working around Get_prop with ssdp discovery and closing socket actually solved all of my issues.

For now, I’m applying the rule: “If it works, leave it”
I’ve had 0 issues since my first post.

Regarding your problem with Telnet connection.
You probably leave more than 4 connections open. This is what makes the bulb refuse new connection.
Just read the documenation.

best regards,
Thomas

All my bulbs work fine after refactoring the library in regards to socket handling. Except for color4 (YL Bulb 1S) on the latest firmware I guess the fix is in .32. And you are right that the library socket handling is not really optimized well. Both the library and the firmware should handle it better.

I shouldn’t have updated my firmware :stuck_out_tongue: My other lights are still keeping their old firmware which works perfectly =]

Since this thread is getting real attention from Yeelight software team, can we please address/fix the HomeKit brightness bug?

Using color4 (1S bulbs) and after updating firmware a bit ago, changing brightness in HomeKit does not achieve the same brightness as doing it in Yeelight app. I think the issue is HomeKit mapping is stuck to “Color” of Yeelight app, and cannot switch to the “White” mode like in Yeelight app.

To reproduce the bug:

  1. Open light in Yeelight App. Switch to max brightness in “White” tab. Look at brightness amount.
  2. Switch to “Color” tab.
  3. Open light in HomeKit. Switch on max brightness on white. Look at brightness amount (will be more dim than Yeelight App).
  4. Open Yeelight App and switch to “White” tab and see it jump in brightness.

I have been doing some more debugging and it might be that get_prop just breaks the whole connectivity. (not 100% yet).

@tomb92 I use SSDP as well. Works fine. The only downside is that using SSDP doesn’t give all bulb data. What the get_prop can do as well is get background/ambilight data. Which basically means that you won’t be able to control them through HA.

Though it is a good workaround until get_prop / overal connectivity works properly

hello friends, I am one more victim of this problem of connection with the lamp, it has been two weeks since my colored lamp v2 no longer connects to wi-fi, I have done all the processes like dns exchange etc. I hope you solve this problem soon, sorry for the English, I’m from Brazil. thank you all

@silvest: Again: Can you share your fork, please, so I/we can test it, too?

My first try at python

Build package:
https://pypi.org/manage/project/yeelight-jh/releases/

@liufei
I think the get_prop is broken and maybe causes the socket to hang and stay open (maybe an uncaught exception/error in the firmware) My color4 does not get any reponse from get_prop. Other commands work fine

1 个赞

Could you please add me to the whitelist, I have a 1S

MI: 1738436076 (mainland china)

@liufei More testing on my color4 bulb get_prop is broken zero response

Trying 172.*.*.*...
Connected to 172.*.*.*.
Escape character is '^]'.
{"id": 0, "method": "get_prop", "params": ["power"]}
{"id":1,"method":"set_power","params":["on", "smooth", 500]}
{"method":"props","params":{"power":"on"}}
{"id":2,"method":"set_power","params":["off", "smooth", 500]}
{"method":"props","params":{"power":"off"}}
{"id": 3, "method": "get_prop", "params": ["power"]}
^]
telnet> q
Connection closed.