192.168.1.204 is the client
192.168.1.184 is the bulb
The bulb was restarted at around 60 seconds into the pcap.
The bulb seems to behaving correctly until 4232s, which is the last time a request gets a response.
The bulb does not respond to the next request at 4268s, (and 4299s, 4330s, 4361s, …).
The Yeelight bulb II (192.168.0.215) with the latest firmware which I added to the home assistant disconnected after around 20 hours. I checked the telnet connection and that was also not connected.
Below logs from hass shows, even the yeelight_1 color bulb was also disconnected a few times.
I have a yeelight color bulb 2 not plugged in for last few months which still have the old firmware, I will plug in the bulb and see if that disconnects as well.
2019-09-23 17:04:35 ERROR (SyncWorker_4) [homeassistant.components.yeelight] Unable to update device 192.168.0.215, Hallway: Bulb closed the connection.
2019-09-23 17:05:06 ERROR (SyncWorker_18) [homeassistant.components.yeelight] Unable to update device 192.168.0.55, yeelight_color1_286c07aea54f: Bulb closed the connection.
2019-09-23 17:19:33 ERROR (SyncWorker_10) [homeassistant.components.yeelight] Unable to update device 192.168.0.215, Hallway: Bulb closed the connection.
2019-09-23 17:34:24 ERROR (SyncWorker_15) [homeassistant.components.yeelight] Unable to update device 192.168.0.215, Hallway: Bulb closed the connection.
2019-09-23 17:54:17 ERROR (SyncWorker_6) [homeassistant.components.yeelight] Unable to update device 192.168.0.215, Hallway: Bulb closed the connection.
2019-09-23 17:54:17 ERROR (SyncWorker_6) [homeassistant.components.yeelight] Unable to update device 192.168.0.55, yeelight_color1_286c07aea54f: Bulb closed the connection.
2019-09-23 18:09:42 ERROR (SyncWorker_11) [homeassistant.components.yeelight] Unable to update device 192.168.0.215, Hallway: Bulb closed the connection.
2019-09-23 18:24:33 ERROR (SyncWorker_2) [homeassistant.components.yeelight] Unable to update device 192.168.0.215, Hallway: Bulb closed the connection.
EDIT : Just found that my internet connection was down between 16:50 and 18:20~25, would that have affected the connectivity between server and bulbs on same LAN
Yes, the python-yeelight library times out after waiting 5 seconds for the receive. I wouldn’t expect this to be the issue, as most responses are sent in around 10-100 milliseconds. The slowest response I have seen is 0.5 seconds. Just in case, I tried changing the timeout to 30 seconds, and I see the same behavior. Request sent, request acknowledged, no response, timeout after 30 seconds.
After the light gets in this “mode”, the requests are executed, so a toggle will work, but no response will be sent regardless of the request.
I have 4 lights stuck in this “mode”, if any yeelight staff want remote access to them, I can forward the ports.
Thanks for your pcap, it provides very useful information for debugging.
BTW, did the bulb have internet connection when it stopped responding to the request?
From your HA log, seems the bulb initiate the close action, which is different from what @qcrist 's pcap shows. Could anyone familiar with HA confirms that this log DOES mean the connection is closed by bulb instead of HA?
The “Bulb closed the connection.” message is given in the yeelight library (which is used by HA) whenever an error occurs on the socket. This INCLUDES timeouts.
This should be the same problem as the one shown in my pcap, which is the bulb not sending the expected response message.
You may want to try to catch the exception and log it / pass it onward inside the response, simply to see what sort of socket error is being received: socket — Low-level networking interface — Python 3.12.5 documentation - the OSError has several properties containing information given out by the OS.
>>> b.toggle()
The error is: timed out <===
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<decorator-gen-9>", line 2, in toggle
File "/home/qcrist/venv3/lib/python3.6/site-packages/yeelight/main.py", line 1 14, in _command
result = self.send_command(method, params).get("result", [])
File "/home/qcrist/venv3/lib/python3.6/site-packages/yeelight/main.py", line 4 42, in send_command
raise BulbException(response["error"])
yeelight.main.BulbException: Bulb closed the connection.
The bulb’s TCP stack actually received the “get_prop” command and acknowledged it, but somehow, the “get_prop” response is not sent out. So the problem is either:
a. Application layer didn’t receive the message from TCP stack.
b. Application layer has some issue handling this message.
Since you can still “toggle” the bulb under this “mode”, it’s highly possible that case B is the root cause. We will check our code and see what’s the problem. Thanks for your help!
It has been 24 hours and all 3 bulbs (yeelight 1, yeelight II with old fw and Yee II with latest ) have not shown any disconnections, the telnet session to the yeelight bulb 2 with latest firmware is still up.
Only disconnections I had were during the time when I had no internet, I wonder that when there is an issue connecting to Yeelight servers the application gets busy with retries which causes either slow or no response on the lan.
If I don’t get any timeouts in next 24 hours I will block internet access for one of the bulb and see what happens.
It has been 48 hours and all 3 bulbs (yeelight 1, yeelight II with old fw and Yee II with latest ) have not shown any disconnections, the telnet session to the yeelight bulb 2 with latest firmware is still up.
I will block internet connection for yeelight bulb II with old firmmware and see if that starts disconnecting.