Core: Yeelight Color bulbs FW 2.0.6_0051 become "unavailable" in HA

Created on 24 Aug 2019  Â·  51Comments  Â·  Source: home-assistant/core

Home Assistant release with the issue:

arch x86_64
dev false
docker false
hassio false
os_name Linux
python_version 3.6.7
timezone Europe/Lisbon
version 0.97.2
virtualenv true

Last working Home Assistant release (if known):
0.97.2

Operating environment (Hass.io/Docker/Windows/etc.):

Component/platform:

yeelight

Description of problem:
After upgrading the firmware of my two Yeelight Color bulbs to version 2.0.6_0051, HA is showing a notification about 2 new Homekit devices.
I have ignored the notification and didn’t setup the integration, but now these bulbs are “unavailable” in HA, although they can be accessed and controlled from Mi Home and Yeelight applications.

Upon restart, sometimes (not always!) HA shows the bulbs during a few minutes, but then they become “unavailable”.
Power cycling the bulbs always bring them back in HA, but after some time (sometimes minutes, sometimes a few hours) they become "unavailable" again.
Seems that something changed in this new firmware that is causing problems in HA’s Yeelight component.
I have other Yeelight lamps (different model) that are working fine.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

yeelight:
  devices:
    192.168.110.111:
      name: Bedroom 3 Right Lamp
      model: color2
    192.168.110.125:
      name: Bedroom 3 Left Lamp
      model: color2

Traceback (if applicable):

2019-08-22 13:43:40 ERROR (SyncWorker_6) [homeassistant.components.yeelight] Unable to update device 192.168.110.125, Bedroom 3 Left Lamp: Bulb closed the connection.
2019-08-22 14:00:15 ERROR (SyncWorker_3) [homeassistant.components.yeelight] Unable to update device 192.168.110.125, Bedroom 3 Left Lamp: Bulb closed the connection.
2019-08-22 14:28:20 ERROR (SyncWorker_2) [homeassistant.components.yeelight] Unable to turn the bulb off: 192.168.110.111, Bedroom 3 Right Lamp: Bulb closed the connection.

2019-08-22 14:28:25 ERROR (SyncWorker_2) [homeassistant.components.yeelight] Unable to update device 192.168.110.111, Bedroom 3 Right Lamp: Bulb closed the connection.
2019-08-22 14:28:28 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140258754912552] 'NoneType' object has no attribute 'close'
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/yeelight/main.py", line 410, in send_command
    data = self._socket.recv(16 * 1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 128, in handle_call_service
    connection.context(msg),
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 210, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 334, in entity_service_call
    future.result()  # pop exception if have
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 356, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/yeelight/light.py", line 598, in turn_off
    self.device.turn_off(duration=duration, light_type=self.light_type)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/yeelight/__init__.py", line 269, in turn_off
    self.bulb.turn_off(duration=duration, light_type=light_type)
  File "<decorator-gen-8>", line 2, in turn_off
  File "/srv/homeassistant/lib/python3.6/site-packages/yeelight/main.py", line 114, in _command
    result = self.send_command(method, params).get("result", [])
  File "/srv/homeassistant/lib/python3.6/site-packages/yeelight/main.py", line 413, in send_command
    self.__socket.close()
AttributeError: 'NoneType' object has no attribute 'close'
2019-08-22 14:28:30 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/yeelight/main.py", line 410, in send_command
    data = self._socket.recv(16 * 1024)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/yeelight/__init__.py", line 151, in update
    device.update()
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/yeelight/__init__.py", line 300, in update
    self._update_properties()
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/yeelight/__init__.py", line 281, in _update_properties
    self.bulb.get_properties(UPDATE_REQUEST_PROPERTIES)
  File "/srv/homeassistant/lib/python3.6/site-packages/yeelight/main.py", line 359, in get_properties
    response = self.send_command("get_prop", requested_properties)
  File "/srv/homeassistant/lib/python3.6/site-packages/yeelight/main.py", line 413, in send_command
    self.__socket.close()
AttributeError: 'NoneType' object has no attribute 'close'

2019-08-22 14:29:06 ERROR (SyncWorker_7) [homeassistant.components.yeelight] Unable to update device 192.168.110.125, Bedroom 3 Left Lamp: Bulb closed the connection.

Additional information:
Port 55443 is open:

Starting Nmap 7.60 ( https://nmap.org ) at 2019-08-24 14:49 WEST
Nmap scan report for 192.168.110.125
Host is up (-0.083s latency).

PORT      STATE SERVICE
55443/tcp open  unknown
MAC Address: 7C:49:EB:B3:xx:xx (Unknown)

Using yeecli to control the bulbs (turn on/turn off) apparently fail with the errors shown below.
However, despite the errors, commands are executed correctly and the bulb is turned on and then off.

pmcouto@pmcesph1:~$ yee --ip=192.168.110.125 turn on
Turning the bulb on...
Traceback (most recent call last):
  File "/home/pmcouto/.local/bin/yee", line 11, in <module>
    sys.exit(cli())
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pmcouto/.local/lib/python2.7/site-packages/yeecli/cli.py", line 160, in turn
    bulb.turn_on()
  File "<decorator-gen-7>", line 2, in turn_on
  File "/home/pmcouto/.local/lib/python2.7/site-packages/yeelight/main.py", line 114, in _command
    result = self.send_command(method, params).get("result", [])
  File "/home/pmcouto/.local/lib/python2.7/site-packages/yeelight/main.py", line 441, in send_command
    raise BulbException(response["error"])
yeelight.main.BulbException: Bulb closed the connection.

--------------------------------------------------------------------------------------------------

pmcouto@pmcesph1:~$ yee --ip=192.168.110.125 turn off
Turning the bulb off...
Traceback (most recent call last):
  File "/home/pmcouto/.local/bin/yee", line 11, in <module>
    sys.exit(cli())
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pmcouto/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pmcouto/.local/lib/python2.7/site-packages/yeecli/cli.py", line 162, in turn
    bulb.turn_off()
  File "<decorator-gen-8>", line 2, in turn_off
  File "/home/pmcouto/.local/lib/python2.7/site-packages/yeelight/main.py", line 114, in _command
    result = self.send_command(method, params).get("result", [])
  File "/home/pmcouto/.local/lib/python2.7/site-packages/yeelight/main.py", line 441, in send_command
    raise BulbException(response["error"])
yeelight.main.BulbException: Bulb closed the connection.
yeelight

Most helpful comment

I'm from Yeelight and we are investigating the issue, sorry for the late response.

All 51 comments

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

Looks like problem with python-yeelight lib itself, and/or handling misbehaving firmware by it. I would suggest to repost this issue here https://gitlab.com/stavros/python-yeelight/issues

it's a problem with python-yeelight or then yeelight have broken the software bulbside, which is really frustrating..

This issue has been reported here: https://gitlab.com/stavros/python-yeelight/issues/37

If anyone can help debug, please let me know, as I'm hesitant to potentially break my bulbs by upgrading, in case it's a bug (or intentional breakage)...

And it's been made known to upstream, if not directly then at least indirectly: https://forum.yeelight.com/t/topic/12894

@rytilahti My post. Let's just hope that yeelight will acknowledge the problem and do something about it in a timely manner.

I'm from Yeelight and we are investigating the issue, sorry for the late response.

I'm not famliliar with HA and from all the comments I believe HA uses python-yeelight internally to communicate with Yeelight bulb, so I installed python-yeelight and tested with the latest firmware. However, I didn't see any issue, or at least turn on, turn off and toggle works well.

I also installed the latest HA in my VirtualBox but struggling with the debugging method, any help would be appreciated.

image

Hi weiwei and thanks for chiming in. Looks like sometimes the bulb responds with a (potentially static?) error message with incorrect message id, maybe that can help to pinpoint the problem: https://gitlab.com/stavros/python-yeelight/issues/37#note_210818830 ?

I have checked that thread also and use the exact commands to test, but everything works quite well.
The good news is that I have successfully setup Home-Assistant and can now reproduce the availability issue now, so please stay tuned for my updates.

@rytilahti I've been debugging with weiwei today and I'm testing a new firmware overnight. Looks promising so far.

Hi @vvpossible

Thanks for your support.

You may easily reproduce the issue with the following steps:

-Open a telnet session to :55443
-Send command {"id":1,"method":"set_power","params":["on", "smooth", 500]}

The bulb correctly executes the command and turns on, but it doesn’t respond with {"id":1, "result":["ok"]} as expected.

If you need additional information, please let me know.

Hi @daned33 ,

You posted your comment while I was writing mine. :-)

That’s excellent news!
I’ll be waiting for an update.

Hello. Any further progress on this? Thanks.

@rytilahti I've been debugging with weiwei today and I'm testing a new firmware overnight. Looks promising so far.

The last update from weiwei is that it is a problem in Home Assistant and has been reported with no response yet from the hass community:

quote from weiwei's post:
Currently there are two issues here:

HA has trouble discovering bulbs with new firmware.
HA occasionally shows disconnect/unavailable for bulbs.
Regarding the first issue, it should be caused by HA’s discovery mechanism since new firmware didn’t change anything related to discovery and we believe HA didn’t handle devices that support Homekit as well as LAN control properly. This issue has been reported to HA community and so far no response yet.
https://github.com/home-assistant/home-assistant/issues/26574

Reposting my comments from yeelight forum

Using the python yeelight library ( https://yeelight.readthedocs.io/en/latest/ ) I have no issues discovering the devices and no issues in connecting the bulbs running new firmware using telnet and sending commands. This shows the discovery function of the bulb works and bulbs are responding to commands using telnet. It seems hass is unable to handle the bulbs with multiple discovery protocols as Weiwei's post suggested.

The output of discovery and telnet below.(192.168.0.55 is old version 1 color bulb, rest are all v2 color bulbs with the latest firmware)


output of discovery and telnet

```user@server~$ python
Python 2.7.16 (default, Jul 9 2019, 16:43:02)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from yeelight import discover_bulbs
bulbs = discover_bulbs()
for i in bulbs:
... print(i["ip"], i["port"])
...
(u'192.168.0.55', 55443)
(u'192.168.0.218', 55443)
(u'192.168.0.56', 55443)
(u'192.168.0.244', 55443)
(u'192.168.0.57', 55443)
(u'192.168.0.58', 55443)
(u'192.168.0.212', 55443)
(u'192.168.0.215', 55443)

user@server~$ telnet 192.168.0.55 55443
Trying 192.168.0.55...
Connected to 192.168.0.55.
Escape character is '^]'.
{"id":1,"method":"get_prop","params":["power", "name", "bright"]}
{"id":1, "result":["on","","1"]}
^]q

telnet> q
Connection closed.
user@server~$ telnet 192.168.0.218 55443
Trying 192.168.0.218...
Connected to 192.168.0.218.
Escape character is '^]'.
{"id":1,"method":"get_prop","params":["power", "name", "bright"]}
{"id":1,"result":["off","","100"]}
^Q]
{"id":0, "error":{"code":-1, "message":"invalid command"}}
^]q

telnet> q
Connection closed.
user@server~$ telnet 192.168.0.56 55443
Trying 192.168.0.56...
Connected to 192.168.0.56.
Escape character is '^]'.
{"id":1,"method":"get_prop","params":["power", "name", "bright"]}
{"id":1,"result":["off","","100"]}
^]q

telnet> q
Connection closed.
user@server~$ telnet 192.168.0.244 55443
Trying 192.168.0.244...
Connected to 192.168.0.244.
Escape character is '^]'.
{"id":1,"method":"get_prop","params":["power", "name", "bright"]}
{"id":1,"result":["off","","100"]}
^]q


telnet> q
Connection closed.
user@server~$ telnet 192.168.0.215 55443
Trying 192.168.0.215...
Connected to 192.168.0.215.
Escape character is '^]'.
{"id":1,"method":"get_prop","params":["power", "name", "bright"]}
{"id":1,"result":["off","","21"]}
^]q

telnet> q
Connection closed.```

@rytilahti @zewelor Can you have another look at this please? There is mounting evidence from the Yeelight forum (https://forum.yeelight.com/t/topic/12894) that this could be an issue in Home Assistant. Thank you.

Seeing the same here. I'm not getting any bulb discovery via python yeelight and commands (that @vvpossible ran) I'm seeing the same as @pmcouto

>>> from yeelight import Bulb
>>> b = Bulb("192.168.1.140")
>>> b.turn_on()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<decorator-gen-7>", line 2, in turn_on
  File "/usr/local/lib/python2.7/site-packages/yeelight/main.py", line 114, in _command
    result = self.send_command(method, params).get("result", [])
  File "/usr/local/lib/python2.7/site-packages/yeelight/main.py", line 441, in send_command
    raise BulbException(response["error"])
yeelight.main.BulbException: Bulb closed the connection.
>>>

That is interesting, running same as above I don't see any problem and my bulbs are running the latest homekit version and are not appearing in the hass. I have not tried adding them statically yet to see if they become unavailable at some point, but I think disconnects/timeout could be due to some conflict where hass see same entity with two different protocols and try to re-connect or re-discover (i have no idea what is in the code it is just what I think it is and could be totally wrong).
Also, I can't find a way to disable homekit, can anyone help in testing yeelight with homekit fully disabled ?

```:~$ python
Python 2.7.16 (default, Jul 9 2019, 16:43:02)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from yeelight import Bulb
b = Bulb("192.168.0.218")
b.turn_on()
u'ok'
b.turn_off()
u'ok'
b2 = Bulb("192.168.0.215")
b2.turn_on()
u'ok'
b2.turn_off()
u'ok'
b3 = Bulb("192.168.0.56")
b3.turn_on()
u'ok'
b3.turn_off()
u'ok'

```

Below is the library and version I have, what version of the library and python you (@alexanderturner ) used to test?
:~$ pip show yeelight Name: yeelight Version: 0.5.0 Summary: A Python library for controlling YeeLight RGB bulbs. Home-page: https://gitlab.com/stavros/python-yeelight Author: Stavros Korokithakis Author-email: [email protected] License: UNKNOWN Location: /usr/local/lib/python2.7/dist-packages Requires: future, enum-compat Required-by:

Very strange @ayounas - I'm running

 pip show yeelight                                                                                           Sun Sep 22 22:59:24 2019
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Name: yeelight
Version: 0.5.0

with Python 2.7.16. What Yeelight server are you connected to? Perhaps we're getting different streams of code? I'm Singapore.

The discovery is a separate issue from this one, so please keep that in its own issue.
Looking at the forum posting and the PCAP contained within, it looks like the bulb may stop responding to requests on a long-lived connection, ergo

@alexanderturner The server you are connected should not cause issues with the LAN functionality. However, python3 is what is used by homeassistant, so you should not use python2 for testing either. The suggestion I gave in the linked forum posting (add some more logging for the socket.error) could be helpful to figure out what sort of socket error is being received.

Hey guys - I've now got this sorted pushing to the latest firmware from Yeelight (beta list)

I was not following this, so I'm not sure about details. Did any one tested if turning off homekit discovery, fixed that issues ? I was wondering maybe yeelights, with new fw enabling homekit, gets discovered by homekit component and yeelight component. Then bulb gets 2 connections from the same ip and drops one ( for example one from yeelight component ).

@zewelor I tried disabling homekit discovery in my config. didn't help.

@zewelor I tried disabling homekit discovery in my config. didn't help.

@daned33 How exactly did you disable homekit? Did you add it to

discovery:
  ignore:

or did you remove / comment out default_config:

AFAIK there's no way to disable Homekit except via the second option.

Comment: I tested this myself (disabling Homekit discovery) and bulbs still become unavailable after 24+ hours of availability.

A new firmware will be available soon for our bulbs apparently:

https://forum.yeelight.com/t/topic/12894/372

This issue should be fixed, since version 2.0.6_0065 works again (at least for me).
@pmcouto Did your try the update?

The new firmware only became available for me about one week ago.
I’ve upgraded my bulbs and, since then, everything is OK.
I don’t want to speak too soon, but it seems the problem is fixed. :-)

Does anyone know what the status of ct2 bulbs are? I didn't upgrade my color2 bulbs, but I did upgrade one of my white ones (to 2.0.6_0041), and it's now exhibiting the same symptoms as the colors did in in 2.0.6_0051, from what I understand. It doesn't respond to mDNS, but is announcing via SSDP. That said, HA doesn't see it at all.

Hi @vvpossible

Thanks for your support.

You may easily reproduce the issue with the following steps:

-Open a telnet session to :55443
-Send command {"id":1,"method":"set_power","params":["on", "smooth", 500]}

The bulb correctly executes the command and turns on, but it doesn’t respond with {"id":1, "result":["ok"]} as expected.

If you need additional information, please let me know.

@pmcouto, did you figure out what the issue was? I am having the same issue with one of my yeelight bulbs. I have 5 of them and all of them are working fine and replying with the correct message except one, which is not replaying to the telnet command as you mentioned. Actually it´s strange, but it is replaying to the On command, but it is not replying to the Off command, so HA shows the "Bulb closed the connection" error every time it turns off the light

Afaik the problem was the firmware. An update by yeelight resolved it.

Unfortunately the firmware of my bulb is updated (with the same versions as the other bulbs 2.0.6_0065)

Hi,

Latest Yeelight firmware for the bulbs resolves this issue – You just need to update to the latest FW.

From: elbueno222 notifications@github.com
Sent: Tuesday, 28 January, 2020 11:45
To: home-assistant/home-assistant home-assistant@noreply.github.com
Cc: pmcouto pedro.couto@mail.telepac.pt; Mention mention@noreply.github.com
Subject: Re: [home-assistant/home-assistant] Yeelight Color bulbs FW 2.0.6_0051 become "unavailable" in HA (#26186)

Hi @vvpossible https://github.com/vvpossible

Thanks for your support.

You may easily reproduce the issue with the following steps:

-Open a telnet session to :55443
-Send command {"id":1,"method":"set_power","params":["on", "smooth", 500]}

The bulb correctly executes the command and turns on, but it doesn’t respond with {"id":1, "result":["ok"]} as expected.

If you need additional information, please let me know.

@pmcouto https://github.com/pmcouto , did you figure out what the issue was? I am having the same issue with one of my yeelight bulbs. I have 5 of them and all of them are working fine and replying with the correct message except one, which is not replaying to the telnet command as you mentioned. Actually it´s strange, but it is replaying to the On command, but it is not replying to the Off command, so HA shows the "Bulb closed the connection" error every time it turns off the light

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/home-assistant/home-assistant/issues/26186?email_source=notifications&email_token=AM7EA26ZJAOXT5UK7MCHHPTRAALCXA5CNFSM4IPGVNEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKDAAEI#issuecomment-579207185 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AM7EA2Z6KFTO6C63G6FB7WLRAALCXANCNFSM4IPGVNEA . https://github.com/notifications/beacon/AM7EA25W5KSPZGT5O75CDSLRAALCXA5CNFSM4IPGVNEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKDAAEI.gif

A poor WiFi connection can also cause some problems.

From: elbueno222 notifications@github.com
Sent: Tuesday, 28 January, 2020 11:56
To: home-assistant/home-assistant home-assistant@noreply.github.com
Cc: pmcouto pedro.couto@mail.telepac.pt; Mention mention@noreply.github.com
Subject: Re: [home-assistant/home-assistant] Yeelight Color bulbs FW 2.0.6_0051 become "unavailable" in HA (#26186)

Unfortunately the firmware of my bulb is updated (with the same versions as the other bulbs 2.0.6_0065)

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/home-assistant/home-assistant/issues/26186?email_source=notifications&email_token=AM7EA27ZPK6VMZS46XLPYZ3RAAMNPA5CNFSM4IPGVNEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKDA5UY#issuecomment-579210963 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AM7EA27U5XAPT6G7VMBGJ2TRAAMNPANCNFSM4IPGVNEA . https://github.com/notifications/beacon/AM7EA27FN4JYMZIKKYERZTLRAAMNPA5CNFSM4IPGVNEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKDA5UY.gif

I also thought about that, but the bulb causing the issue actually turns on and off when requested so it is receiving the messages, the issue is that it doesn´t respond with the required message so HA is showing the error again and again, which is pretty annoying

I also thought about that, but the bulb causing the issue actually turns on and off when requested so it is receiving the messages, the issue is that it doesn´t respond with the required message so HA is showing the error again and again, which is pretty annoying

My problem is solved, I just had to switch the power off and the on again, and the bulb started to send the responses.

I have a stable internet connection (since I am always able to use the Yeelight app) with 3 bulbs each running the version 65 firmware. However I'm still experiencing random intervals of unavailability.

I'm getting this error as well (I wrote the yeelight/yeecli library). I have two bulbs, one is on a very old firmware version and works perfectly, the other is new and regularly fails with that error after a few hours of operation. The bulb just stops responding, and the library keeps waiting for a response until the timeout.

If I send an extra newline, I still don't get the "ok" response, I get a blank response and then an "invalid command" for the second line. This tells me that the bulb thinks it sent a response but didn't really. Hopefully a firmware update will fix this (I'm not sure if I can roll back to earlier firmware, which worked fine).

Just constant throughout the day:

2020-08-27 04:48:49 ERROR (SyncWorker_14) [homeassistant.components.yeelight] Unable to update device 192.168.1.8, Living Room B: A socket error occurred when sending the command. 2020-08-27 04:48:49 ERROR (SyncWorker_14) [homeassistant.components.yeelight] Unable to update device 192.168.1.14, Hall A: A socket error occurred when sending the command. 2020-08-27 04:48:49 ERROR (SyncWorker_14) [homeassistant.components.yeelight] Unable to update device 192.168.1.12, Bedroom Ceiling: A socket error occurred when sending the command. 2020-08-27 04:48:49 ERROR (SyncWorker_14) [homeassistant.components.yeelight] Unable to update device 192.168.1.11, Hall B: A socket error occurred when sending the command. 2020-08-27 04:48:50 ERROR (SyncWorker_14) [homeassistant.components.yeelight] Unable to update device 192.168.1.16, Living Room A: A socket error occurred when sending the command. 2020-08-27 04:48:50 ERROR (SyncWorker_14) [homeassistant.components.yeelight] Unable to update device 192.168.1.13, Office Strip: A socket error occurred when sending the command. 2020-08-27 04:48:50 ERROR (SyncWorker_14) [homeassistant.components.yeelight] Unable to update device 192.168.1.15, Office Ceiling: A socket error occurred when sending the command. 2020-08-27 04:52:19 ERROR (SyncWorker_44) [homeassistant.components.yeelight] Unable to update device 192.168.1.12, Bedroom Ceiling: A socket error occurred when sending the command. 2020-08-27 04:52:19 ERROR (SyncWorker_44) [homeassistant.components.yeelight] Unable to update device 192.168.1.16, Living Room A: A socket error occurred when sending the command. 2020-08-27 04:53:54 ERROR (SyncWorker_25) [homeassistant.components.yeelight] Unable to update device 192.168.1.8, Living Room B: Bulb closed the connection.

Is this just something we have to deal with?

@jjbrunton I have 5 Yeelight color bulbs and from the day I updated the firmware (back in January) I haven´t had any more issue or errors in Home Assistant, so there has to be something wrong in your setup, do your bulbs have the latest firmware installed (2.0.6_0065)?

@jjbrunton

I have >15 Yeelight bulbs and lamps running latest firmware and I have no issues.
“A socket error occurred when sending the command” usually means WiFi connectivity issues (poor signal, RF interference, etc.).

@pmcouto It's just not the case, unfortunately. I wrote a small C# script that would ping the bulbs and found they responded 99% of the time.

It's incredibly predictable in terms of reconnecting as well. Basically, when they drop >50% of the bulbs in the apartment will drop (2 bedroom flat so it's not like it's a big space) then the socket error will happen. Exactly 30 seconds later the bulbs will become available again.

All bulbs are reporting < 50dBm signal to the router, I've tried multiple routers (even tried a Ubiquiti AP) so how is it that the network is to blame? Short of hardwiring it in (which obviously isn't possible), I'm not sure what else can be done.

@elbueno222 - I have no firmware updates available and I can't see an easy way to see in the app what version the bulbs are running but I assume they are the latest available.

@jjbrunton the socket problem you mention went away for me after a firmware update. If you're having the same issue the rest of us are, it's a bulb bug, not a client bug.

In the Yeelight app, click the bottom right button and then "Firmware Update" to see the firmware of the bulbs with issues:

image

@elbueno222 - Cheers, they are all running the latest reported:

1.4.2_0076

@elbueno222 - Cheers, they are all running the latest reported:

1.4.2_0076

They must be different bulbs that the ones discussed on this thread (as you can see in the title the original firmware with issues was 2.0.6_0051 and the issue was corrected in 2.0.6_0065), are they color bulbs? Anyway as skorokithakis commented we had the same issue before and it was fixed with a firmware update, so I would say you won´t be able to fix it unless you contact Yelight and they update the firmware for your bulbs (as they did for ours: https://forum.yeelight.com/t/topic/12894/372)

I'm facing this problem with 1.4.2_0076 so RGBv1 and 2.0.6._0065 (RGBv2) too, total 8 bulbs are affected (2 x RGBv1 and 6xRGBv2). Everything was rock stable for months and now I have to power toggle bulbs couple times a day...

I face exactly the same issue, though for me the latest firmware seems to be 2.0.6_0030 (color 1s bulb). Still, since I updated to that I have this issue - the bulb can still be pinged and is on the network but does not respond to TCP commands, Home Assistant, or YeeCLI.

I'm not famliliar with HA and from all the comments I believe HA uses python-yeelight internally to communicate with Yeelight bulb, so I installed python-yeelight and tested with the latest firmware. However, I didn't see any issue, or at least turn on, turn off and toggle works well.

I also installed the latest HA in my VirtualBox but struggling with the debugging method, any help would be appreciated.

image

>>> from yeelight import Bulb
>>> bulb = Bulb("192.168.1.12")
>>> bulb.toggle()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<decorator-gen-9>", line 2, in toggle
  File "/usr/local/lib/python3.7/dist-packages/yeelight/main.py", line 126, in _command
    result = self.send_command(method, params).get("result", [])
  File "/usr/local/lib/python3.7/dist-packages/yeelight/main.py", line 545, in send_command
    raise BulbException(response["error"])
yeelight.main.BulbException: Bulb closed the connection.
>>> bulb.toggle()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<decorator-gen-9>", line 2, in toggle
  File "/usr/local/lib/python3.7/dist-packages/yeelight/main.py", line 126, in _command
    result = self.send_command(method, params).get("result", [])
  File "/usr/local/lib/python3.7/dist-packages/yeelight/main.py", line 545, in send_command
    raise BulbException(response["error"])
yeelight.main.BulbException: Bulb closed the connection.
>>> bulb = Bulb("192.168.1.13")
>>> bulb.toggle()
'ok'
>>> bulb.toggle()
'ok'

Hi. I am using same exact commands and this is what I get. The bulb that closes the connection (192.168.1.12) is brand new firmware for Yeelight 1S that just came out yesterday 2.06_0030. USA region. The toggle works and turns on/off the bulb, but HA shows it as unavailable because not getting an 'ok' response? Exactly like OP's problem back in August of last year... D:

Issuing identical commands to second bulb (192.168.1.13) works like a charm and responds to commands. This firmware is original factory firmware: 1.3.2_0018

Any chance of an update from Yeelight, @vvpossible? Please? I look over at Yeelight forums and many people are experiencing these connection issues over a year later.

I have the same issue using the Yeelight 1S YLDP13YL on 2.0.6_0030. As a temporary workaround, I'm using the HomeKit Controller integration to add the bulbs to HA. The bulbs have been working flawlessly using this, however you do lose some features such having only the colour wheel, and not whites to pick from.

Yeelight 1s color. After update Firmware 2.0.6_0030 I can use homekit controller with lag, also lag present with yeelight app. for turn on/off lamp. Integration with yeelight plugin in HA worked 5-20 minutes after add lamp in system, and after is unavailable status.
But, with factory firmware worked fine.

Was this page helpful?
0 / 5 - 0 ratings