Enable Moonlight of Yeelight Ceiling with API


#1

Hello,

I realy like the Yeelight Ceiling and its Moonlight mode. I dim and adjust color by home-assistant. Now i wonder if it is possible to enable the Moonlight mode with the API as well. Right now i only saw the possibility to enable it with remote or cell phone. In the developer PDF is saw nothing about Moonlight.

Thanks for your help.

Peter


#2

Hi,
here is the API:

{"id":1,"method":"set_scene", "params": ["nightlight", 10]
//10 is brightness value

#3

That’s great - is there a way to set that scene with Alexa?


#4

You can create a scene through scene management in Yeelight app and re-run discovery in Alexa. Then you can say “turn on ‘scene_name’”.


#5

Thanks!


#6

Hello, is there a way to do a color flow with nightlight ?


#7

start a color flow under nightlight mode


#8

Hello,
can you please let me know how to switch from the nightlight mode back to the standard mode using the API?
Thank you.


#9

Hi,

If the client keeps track of the Ceiling’s brightness and color temperature info, it could achieve this by set_ct_abx interface. But I assume this is untrue for your case.

There’s an extra parameter “mode” for set_power interface though, which can be used to switch to specific mode regardless of current power status.

  • Example 1: switch or turn on the light to last mode:
    {“method”:“set_power”,“params”:[“on”, “smooth”, 500, 0]}
  • Example 2: switch or turn on the light to normal mode:
    {“method”:“set_power”,“params”:[“on”, “smooth”, 500, 1]}
  • Example 2: switch or turn on the light to nightlight mode:
    {“method”:“set_power”,“params”:[“on”, “smooth”, 500, 5]}

Note this interface requires/allows no brightness or color information.

Other values for mode (not supported by Yeelight Ceiling):
2: switch to RGB mode
3: switch to HSV mode
4. switch to color flow mode

Hope this helps.


#10

Thank you for your quick answer. It was very helpful.


#11

Hi Peter (@yeelight_ceiling)

As i can read, you use Home assistant, and you added this lamp.

Please, can you tell me how did you added?

I’m using too home assistant, but i would like to know if this lamp is compatible, before buy it.

Also i see that is new version, but also i dunno if it will possible to add in home assistant.

thanks


#12

It is supported using this component:

https://home-assistant.io/components/light.yeelight/

although moonlight is not supported yet. i use moonlight mode with a separate script

best regards


#13

Hi Peter,

I’m also a HA user. Can you share you code that you used to enable moon mode in HA?

Thx in advance!