Wake up with Yeelight

- name: 'Sunrise'
    flow_params:
      count: 1
      action: stay
      transitions:
        - RGBTransition: [255, 0, 0, 50, 1]
        - TemperatureTransition: [1700, 180000, 10]
        - TemperatureTransition: [2700, 180000, 11]
        - TemperatureTransition: [3700, 180000, 12]
        - TemperatureTransition: [4700, 180000, 13]
        - TemperatureTransition: [6500, 180000, 100]
1 Like

Thanks, that’s a fair bit different to what I had so I’m excited to test it out now

Good guys, thanks for sharing, since I have HA who was looking for these effects. And thanks to you I already have them. I am very grateful for your precious help.

Hi Jon,

I am now using your code for this effect which is working nicely, however it seems that I have to call the service twice to get it to start correctly. If the light is initially off and I call the light.turn_on service with the sunrise effect, the light simply turns on to the last known setting rather than the start of the sunrise. I have to call the service with the effect again to get the effect to start. Have you noticed this at all? The globe is running the latest firmware, v 1.4.2.0076

have to thank @EvanJ for the code

So I just tested (HA 0.95.4, Yeelight Colour bulb v1, 1.4.2.0076)

turn on light and set to purple. turn off light.
Call service light.turn_on with

{
  "entity_id": "light.yl_study_cb1",
  "effect":"Sunrise"
}

And the bulb goes to red and runs though the sequence - without starting at purple.

In the yeelight app I have the bulb “default state” set to not save state automatically - not sure if this is relevant. Cant think of anything else that might impact it.

Hi,
first of all, thanks for sharing your infos here. It helped me allready a lot!
I am trying to setup a sunrise automation for my Yeelight LED Ceiling Light Model No. YLXD01YL, not a bulb!
But I think the only differences that should be of relevance is that the colour range is restricted (2700K-6500K). Right? :grimacing:

I tried to adapt the code posted by @EvanJ for my case:

  custom_effects:
    - name: 'Sunrise'
      flow_params:
        count: 1
        action: stay
        transitions:
          - TemperatureTransition: [2700, 180000, 01]
          - TemperatureTransition: [6000, 180000, 90]

When I call the automation with the effect, it does not react as expected. It directly goes to a medium temperature value and does not change from there at all.

To be honest, I do not exactly know if I understand the parameters correctly. I guess the first ist the temperature, the second the time to reach the specified status from the current one and the third the brightness in percent? Is that correct?

To test the temperatures and brightness values for my lamp, I would like to manually trigger some values. Can someone recommend me a command for this?

You are correct about the parameters. I don’t think you can have a three minute (180000ms) transition to 1%. Yeelights are pretty poor at subtle changes (as seen in this thread and elsewhere) probably due to price. My custom Sunrise effect and others I’ve made work but there are often noticeable and unevenly spaced jumps in brightness and colour.

To manually trigger values, go to Services in the Lovelace frontend, and choose light.turn_on
Choose the desired light in Entity
Then enter your parameters in JSON format (you need quotation marks and commas)
That should let you play around.

1 Like

Thanks, that works very well! I call the service like this:
image

My problem is, that even if I set brightness to 1 (lowest value) the light is still pretty bright. Much brighter than the starting brightness if I use the sunrise scene from the yeelight app. Also I set the moonlight mode in hass.io like this:
image

This is still less bright than with the turn_on service and brightness setting of 1. Also the yeelight app has the “night mode” for the ceiling lamp, with which I can dim very fine at very low brightness values. I take from this, that it is not so much a hardware restriction of the lamp, but more a problem of the ability of the service to call lower brightness levels.
Is there no way of starting the yeelight sunrise scene from hass.io?

In a yeelight forum topic I asked for the start setting of the ceiling lamp for the yeelight sunrise scene. I got an answer rather quickly. But I do not know how to put this in any hass.io command.

image

Can anyone make something out of this?

It’s the same as the second post.

50 = duration (m/s)
1  = mode(color)
16731392 = color(Decimal Value) = FF4D00(Hexadecimal Value) = RGB([255, 77, 0)
1 = brightness

360000 = duration(m/s)
2 = mode(color temp)
1700 = color temp
10 = brightness

540000 = duration(m/s)
2 = mode(color temp)
2700 = color temp
100 = brightness

I know this isn’t technically regarding the wake up transition but one of my globes is having problems with this version of firmware. My long running automation which calls for a globe to turn on to 255, 255, 255 with full brightness now goes to some weird colour and brightness as if its having serious issues figuring out what it should do… changing it slightly off to some other colour temp seems to make it come good but only until it’s next turned off/on. Just a warning regarding this firmware version… I’m hoping a newer version is released soon to hopefully fix this

hmm - not noticed - but this is more likely the simplistic nature of my use.

(just checked the forum, not seeing anything on it)

how would you write this for a tuneable white yeelight (non-rgb)?
Thanks!

see this post Wake up with Yeelight onwards. But you may struggle depending on how dim your bulb goes.

Hello all,

I just started to get known with Home Assistant. Based on the comments I found I tried to replicate the built-in Yeelight scene “Sunset”. My only problem is, action: off is not accepted in the config file, although it was written between the options (together with stay and recover). Can someone help me, what did I wrong?

    - name: 'Sunset'
      flow_params:
        count: 1
        action: off <-- here I can not have this value
        transitions:
          - TemperatureTransition: [2700, 50, 10]
          - TemperatureTransition: [1700, 180000, 5]
          - RGBTransition: [255, 77, 0, 420000, 1]

Thank you.

try action: stay

1 Like

As this transition is used to go to bed, it would be nice to turn off the lamp. I guess it would be possible to add an action to switch off the lamp after the effect ends, but I would like to know why the off action is not working in my case.

action: off should work (not tried it) - its listed on the integration page (https://www.home-assistant.io/integrations/yeelight#custom-effects) and the underlying python page (https://yeelight.readthedocs.io/en/stable/flow.html)

that said, there is a post further up suggesting that off doesn’t work (Wake up with Yeelight), but that was more because actions were not supported (@Michal_Ciemiega )

Do you get any errors in the log?
Looking at github, Action: off does seem to be there.

Official documentation also lists “off” as an option, despite of this, it is not working. More precisely, when I try to save the configuration.yaml, it is not allowed as the value is not allowed. So basically there is no error message as I’m not allowed to use this value.

you rihgt. tried it myself:

2020-04-16 09:37:43 ERROR (MainThread) [homeassistant.config] Invalid config for [yeelight]: not a valid value for dictionary value @ data['yeelight']['custom_effects'][3]['flow_params']['action']. Got False. (See /home/homeassistant/.homeassistant/configuration.yaml, line 235). Please check the docs at https://www.home-assistant.io/integrations/yeelight
2020-04-16 09:37:43 ERROR (MainThread) [homeassistant.setup] Setup failed for yeelight: Invalid config.

I’ve opened a bug:

Hi

problem is that yaml interprets off as boolean, you need to quote it ‘off’.

action: 'off'

Boolean Language-Independent Type for YAML™ Version 1.1