core: Yeelight color4 is not configured correctly

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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 53 (4 by maintainers)

Most upvoted comments

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

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

@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 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

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 … <#m_8499351708409528073> 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