[miio] Wake-up-light with yeelight color bulbs

Hi,

I recently got a couple of relatively cheap bulbs in order to create a wake up light for my bedroom with them. At first I thought that this would involve a lot of Openhab scripting but it turned out that this can be done right out of the box with these bulbs. Everything I needed to know could be found here in the community and the pretty good yeelight specification (https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf).

As it may save those who are interested some time to figure it out I will share my final results here. All that is needed is to send a single text command to the “Execute Command” channel of the lamp. I use the following command to create a slow transformation effect from a dark red, over orange and yellow to a bright (but still warm) white colour that will take roughly 18 minutes and will remain as is after the transformation:

<Name of your execute command item>.sendCommand("set_scene [\"cf\",7,1,\"2000,1,16711680,1,180000,1,16711680,20,180000,1,16731392,40,180000,1,16738048,60,180000,1,16744704,80,180000,1,16754432,100,180000,2,3400,100\"]")

For those interested in changing parameters a short explanation for every parameter in order of appearance:
set_scene: Leave as it is, this is the name of the command that needs to be executed on the lamp
cf: Leave as it is (cf=colour flow)
7: This must correspond with the number of states that your final transformation will have. Change this if you add or remove transformation steps (see below)
1: Change to 0 if the light should be switched off after the transformation (for a wake up light you would most likely keep this set to 1)
2000,1,16711680,1: Description of the first state that can be broken down into four parts: 2000 is the transformation duration in ms, 1 is the colour mode (change to 2 for different white temperatures), 16711680 is the final colour (see interoperation spec for details, if mode is white/2 use this parameter to set the temperature between 1700 & 6500) and the final 1 is the final brightness (between 1 and 100) after the transformation. The same goes for the remaining 6 transformation steps.

1 Like