Wake up with Yeelight

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

Hello guys. Thanks for the great tutorial.
Have a few questions.

  1. Is it possible to use effects from Yeelight phone application?
  2. Is it possible to remove default effects which have already been installed to HA?

Thnx in advance

  1. No - there is no link between HA and the Yeelight app.
  2. Probably - you would need to start with https://github.com/home-assistant/core/blob/899431235b281a306d1ad66c45b1f324c2351895/homeassistant/components/yeelight/light.py and work out which file to edit… But every upgrade would likely overwrite your edited file. So you will need to create a local customisation that overrides the default yeelight integration… up for it?

Hello!
I have been able to create the effect as you suggested and it works great. But the transition from off to the first red color is too quick (and bright) so that change makes me wakes up instantly (in not a too good humor).
I have been looking for solutions to this and the only thing I have found that works is this:

Do you think that something similar could be got through Home Assistant?
What do you think @Michal_Ciemiega? It looks like you are comfortable with the Yeelight source code :smile:

Thank you in advance.

Everything should be possible using transitions, maybe try as suggested in your link, to make longer transaition time, on first transition

it should set 6s transition time, so maybe tweak it to minutes etc

RGBTransition: [255, 0, 0, 6000, 1]

Hi,

I’m not sure if this is still a question, but I found a link, where the original Yeelight transitions are listed. I tried Sunset and Sunrise, they match the one in Xiaomi Home/Yeelight app.

Maybe this one could be useful to understand the above:

Vendor effects are now merged into latest HA version ! ( https://github.com/home-assistant/core/pull/42711 )

2 Likes

This sounds pretty awesome. Could you pls point me to a side explaining how I can integrate that into my Hass?
edit: I guess it is already part of the current Hass version?

@Hackmett, here’s sample automation for you. “Effect” values listed in Developer Tools / States for your yeelight bulb.

alias: Sunrise Lights - Bedroom
description: ''
mode: single
trigger:
  - platform: template
    value_template: >-
      {{ states('sensor.time') ==
      (states.input_datetime.wakeup_time.attributes.timestamp | int |
      timestamp_custom('%H:%M', False)) }}
condition:
  - condition: state
    entity_id: input_boolean.wakeup
    state: 'on'
  - condition: state
    entity_id: input_boolean.vacation_mode
    state: 'off'
  - condition: state
    entity_id: binary_sensor.workday_sensor
    state: 'on'
action:
  - service: light.turn_on
    target:
      device_id: light.yeelight_bedroom
    data:
      effect: Sunrise


1 Like

I’m trying to recreate this flow in Node Red, but can’t get it working.
Could somebody give me some help if they got it working?