Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yeelight add support for MiBedsideLamp2 (MJCTD02YL) #24018

Closed
pascalsaul opened this issue May 21, 2019 · 16 comments · Fixed by #22547
Closed

Yeelight add support for MiBedsideLamp2 (MJCTD02YL) #24018

pascalsaul opened this issue May 21, 2019 · 16 comments · Fixed by #22547

Comments

@pascalsaul
Copy link

pascalsaul commented May 21, 2019

Home Assistant release with the issue:
0.93.1

Last working Home Assistant release (if known):
n/a

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

Component/platform:
https://www.home-assistant.io/components/homekit_controller/

Description of problem:
Unsupported device

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

discovery:

Traceback (if applicable):

2019-05-21 17:59:08 INFO (MainThread) [homeassistant.components.discovery] Found new service: yeelight {'host': '192.168.1.78', 'port': 54321, 'hostname': 'yeelink-light-color2_miio133256187.local.', 'properties': {'epoch': '1', 'mac': '04cf8ca4c329'}, 'mac_address': '04cf8ca4c329', 'device_type': 'color2'}
2019-05-21 17:59:08 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: homekit {'host': '192.168.1.93', 'port': 80, 'hostname': 'MiBedsideLamp2-F468.local.', 'properties': {'sh': '9m3WYQ==', 'ci': '5', 'sf': '1', 's#': '1', 'pv': '1.1', 'md': 'MJCTD02YL', 'id': '2C:4A:AE:98:0D:0C', 'ff': '1', 'c#': '1'}, 'name': 'MiBedsideLamp2-F468'}
2019-05-21 17:59:08 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: homekit {'host': '192.168.1.94', 'port': 80, 'hostname': 'MiBedsideLamp2-BACF.local.', 'properties': {'sh': 'XQlSBg==', 'ci': '5', 'sf': '1', 's#': '1', 'pv': '1.1', 'md': 'MJCTD02YL', 'id': '23:AA:BB:A3:0E:E8', 'ff': '1', 'c#': '1'}, 'name': 'MiBedsideLamp2-BACF'}

Additional information:
The new Bedside Lamp 2 is supported in the Xiaomi Home and Google Home app.

@zewelor
Copy link
Contributor

zewelor commented May 21, 2019

What happens now ? Looks like its detected, what doesn't work ? Try declaring it as color2 or ceiling4, it might work.

@pascalsaul
Copy link
Author

pascalsaul commented May 21, 2019

The lamp isn't added to HA.

I just did

discovery:
  enable:
    - homekit
2019-05-21 18:21:55 INFO (MainThread) [homeassistant.components.discovery] Found new service: homekit {'host': '192.168.1.94', 'port': 80, 'hostname': 'MiBedsideLamp2-BACF.local.', 'properties': {'sh': 'XQlSBg==', 'ci': '5', 'sf': '1', 's#': '1', 'pv': '1.1', 'md': 'MJCTD02YL', 'id': '23:AA:BB:A3:0E:E8', 'ff': '1', 'c#': '1'}, 'name': 'MiBedsideLamp2-BACF'}
2019-05-21 18:21:55 INFO (MainThread) [homeassistant.components.discovery] Found new service: homekit {'host': '192.168.1.93', 'port': 80, 'hostname': 'MiBedsideLamp2-F468.local.', 'properties': {'sh': '9m3WYQ==', 'ci': '5', 'sf': '1', 's#': '1', 'pv': '1.1', 'md': 'MJCTD02YL', 'id': '2C:4A:AE:98:0D:0C', 'ff': '1', 'c#': '1'}, 'name': 'MiBedsideLamp2-F468'}

Then I got a notification that I can enter the PIN for both devices which is displayed on the bottom of the lamp and that worked.

2019-05-21 18:29:45 INFO (MainThread) [homeassistant.components.light] Setting up light.homekit_controller
2019-05-21 18:29:45 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.homekit_controller entity: light.mibedsidelamp2_f468
2019-05-21 18:30:40 INFO (MainThread) [homeassistant.components.light] Setting up light.homekit_controller
2019-05-21 18:30:40 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.homekit_controller entity: light.mibedsidelamp2_bacf

So I need to force the auto discovery? I still would expect that the Yeelight component would pick it up instead of the HomeKit. Confusing...

@ghost
Copy link

ghost commented May 23, 2019

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

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

@ghost
Copy link

ghost commented May 23, 2019

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

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

@rytilahti
Copy link
Member

Does it work if you define it manually as yeelight? https://www.home-assistant.io/components/yeelight/ has the documentation for manual configuration.

Maybe it advertises homekit support, so that's why homekit integration picks it up, unfortunately I have no idea about its details.

@pascalsaul
Copy link
Author

Does it work if you define it manually as yeelight? https://www.home-assistant.io/components/yeelight/ has the documentation for manual configuration.

Maybe it advertises homekit support, so that's why homekit integration picks it up, unfortunately I have no idea about its details.

Don't know for sure anymore since I enabled homekit support manually in the config as you can see and finally was able to configure it within HA with the right PIN. The Yeelight app can control the BedSide2 lamps without a problem. It advertises homekit support indeed but doesn't 'load' correctly within HA with 'standard' autodiscovery. I think personally that it is a homekit since auto discovery is giving the message and not yeelight.

@Jc2k
Copy link
Member

Jc2k commented May 23, 2019

Hi!

From a HomeKit point of view everything looks like it is working as expected. On 0.94 the homekit discovery will be enabled by default so it wouldn't have needed enabling manually. 0.94 will switch over to config entries too, and not depend on discovery at start up (theres a 30s delay after restarts on < 0.94 thats a bit annoying).

It's normal for some devices to have multiple control APIs - e.g. we have a few climate devices I have been looking at that can either be controlled via their cloud API or via homekit and homekit is the only viable "local" internetless API. So that bit is normal as well.

It's weird that the native client hasn't detected it but unless there are features not exposed to the HomeKit API I guess its fine to use the HomeKit API.

@pascalsaul
Copy link
Author

pascalsaul commented May 23, 2019

Hi!

From a HomeKit point of view everything looks like it is working as expected. On 0.94 the homekit discovery will be enabled by default so it wouldn't have needed enabling manually. 0.94 will switch over to config entries too, and not depend on discovery at start up (theres a 30s delay after restarts on < 0.94 thats a bit annoying).

It's normal for some devices to have multiple control APIs - e.g. we have a few climate devices I have been looking at that can either be controlled via their cloud API or via homekit and homekit is the only viable "local" internetless API. So that bit is normal as well.

It's weird that the native client hasn't detected it but unless there are features not exposed to the HomeKit API I guess its fine to use the HomeKit API.

In that case I'll wait for that update and remove the discovery entry for homekit. Hopefully it will detect it then automatically and add it to HA. When I remove it now, the lamps are gone again.

@Jc2k
Copy link
Member

Jc2k commented May 23, 2019

Cool - we are still working out some of the finer details of the switchover but if it doesnt work the things to check will be - is the zeroconf component active and is homekit not listed at all under discovery. If both of those are true it should work. (I believe that is the "stock" setup).

@aignacio
Copy link

aignacio commented Jun 2, 2019

Hi @pascalsaul and @Jc2k, I finally got mine lamp working after manually forcing homekit to discover but now the only feature controllable it's the brightness, (NOT RGB color) as it should be, so does you know how to handle other configs? Should I create a custom sensor with yeelight?

@zewelor
Copy link
Contributor

zewelor commented Jun 2, 2019

I think it might be same error as described here: #23871

Try this code from pending PR, it might fix it:
#23871 (comment)
#23871 (comment)

@aignacio
Copy link

aignacio commented Jun 2, 2019

@zewelor thanks, fixed!

@zewelor zewelor mentioned this issue Jun 2, 2019
3 tasks
@pascalsaul
Copy link
Author

pascalsaul commented Jun 6, 2019

I don't know what the update to 0.94 breaks but now are both lights not detected at all...

https://www.home-assistant.io/blog/2019/06/05/release-94/
The new discovery is now part of the default config. If you are not using the default config, add ssdp: and zeroconf: to your configuration.yaml.

I did use the default configuration but probably things are changed during the versions and by adding those two directives it is working.

@Jc2k
Copy link
Member

Jc2k commented Jun 6, 2019

You need to make sure the zeroconf component is turned on, it’s a breaking change listed in the release notes.

@Jc2k
Copy link
Member

Jc2k commented Jun 6, 2019

Ah I replied before I saw your edit

@adriandmitroca
Copy link

Have you managed to add Bedside Lamp 2 to HA somehow guys?

Trying to manual connection via Yeelight component with no luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants