core: Xiaomi Mi Bedside Lamp 2 - MJCTD02YL - socket error

The problem

I have problem with adding my Xiaomi Mi Bedside Lamp 2. After I installed HA OS it automatically discovered another Yeelight Bulb that I have: YLDP23YL, but it has problems with my bedside lamp. In integration description there is a hint that I should enable LAN control in Yeelight app. Unfortunately I don’t have this option in my app, even after updating bedside lamp firmware to the latest. Maybe that’s the problem? Maybe there is different option to add Bedside Lamp 2 to HA? Please help :<

What is version of Home Assistant Core has the issue?

core-2021.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Yeelight

Link to integration documentation on our website

https://www.home-assistant.io/integrations/yeelight/

Example YAML snippet

# Put your YAML below this line


yeelight:
  devices:
    192.168.1.27:
      name: Lampka
      model: bslamp1
    192.168.1.24:
      name: Lampa w salonie
      model: bslamp1

Anything in the logs that might be useful for us?

# Put your logs below this line


2021-02-24 10:58:05 ERROR (MainThread) [homeassistant.components.yeelight.config_flow] Failed to get properties from 192.168.1.27: A socket error occurred when sending the command.
2021-02-24 10:58:05 ERROR (MainThread) [homeassistant.components.yeelight.config_flow] Failed to import 192.168.1.27: cannot connect

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (8 by maintainers)

Most upvoted comments

the yeelight bulbs should be unaffected from the problem - only xiaomi branded products

I was able to turn the developer mode on, thanks to @rytilahti tip. It also worked for my yeelight ceiling light.

I have obtained my tokens for the device that are needed for miiocli. Here are a few ways listed to get the tokens. https://github.com/Maxmudjon/com.xiaomi-miio/blob/master/docs/obtain_token.md

After that I could activate the developer mode via miiocli (https://python-miio.readthedocs.io/en/latest/).

miiocli yeelight --ip <address> --token <token> set_developer_mode

So, if I bought a Yeelight Color bulb today, I wouldn’t be able to use it with Home Assistant, or has the change been reverted?

We just received a report on Twitter of this issue so I thought I’d dig a bit. I’ll leave it to @balloob to see if we want to make a big stink about this publicly to try to pressure Xiaomi (who forced Yeelight to remove local control according to Yeelight on Twitter) to re-add local control but did want to point people of this issue to this thread on our forums where @mmakaay has done a great job of documenting his work to reverse engineer his Yeelight bedside lamp to install ESPHome on it. That may be your best bet for now instead of trying to maintain LAN control on a product whose creator doesn’t want it maintained.

I’m going to close this out as we can’t do anything about lan support being removed from the firmware.

The yeelight integration has been significant refactored in 2021.9 to use local push which addresses a whole class of connectivity issues. If there is still a problem after updating to 2021.9 and its not because lan support is missing, please open a new issue as previous logs and troubleshooting will not longer be relevant.

Just lost control of all of my Yeelight Color2 bulbs. All at once. All other devices remain unaffected. Firmware update hit these as well?

The devices that are controlled with mi home app are using either miio or miot for communication. The library implementing support for such devices is python-miio, which is used by the xiaomi_miio integration. That library has some basic support to yeelight devices (miiocli yeelight can be used from console), so extending xiaomi_miio.light to provide at least some basic support to the devices without lan mode would be doable.

Also, there is a custom component using the miio protocol that is separate from the lan mode, I have asked if its author has interest in adding support for that to xiaomi_miio: https://github.com/home-assistant/core/issues/44540#issuecomment-824367183

It seems products starting with MJC are affected while YLD retains local control.

The question is, should these products have a separate integration in Home Assistant?

Interesting statement. Seeing the LAN support disappear from my lamps and app does not match this statement, but it would be great if they changed their mind and brought back the support (without having to jump hoops like having devices whitelisted to receive working firmware).

What this does not change, are my efforts to come up with my own firmware for the BS2. It likely will bring me more options than the original firmware, and I am really looking forward to those, amongst which:

  • no phone home activity from my devices
  • independent use of the front panel (e.g. to do a house power down when long pressing my bedside lamp’s power button)
  • a fix for the device getting disconnected from HA, because of stringent rate limiting
  • easier control of the night light feature.
  • options for adding extra sensors to the device, nicely tucked away inside the enclosure