The light will be usually turned off. When someone turns it on I would like to have different brightness depending on the time.
So I am trying the following automation.
Invalid config for [automation]: [brightness] is an invalid option for [automation]. Check: automation->action->0->choose->0->sequence->0->brightness. (See /config/configuration.yaml, line 21).
That’s because the additional parameters for the service call need to be in the data block. Take a look at the Actions page of the automation documentation here, especially the examples.
I don’t know if you can set the night_light parameter like this, don’t own any yeelights.
You should also check the syntax for the choose action here as currently your automation is :
IF time after 23:00 and before 06:00 -> turn light on at low brightness, then turn on the light at high brightness.
But I assume you want
IF time after 23:00 and before 06:00 -> turn light on at low brightness
ELSE turn on light at hight brightness.
To get the ELSE part, you need to define a default action. Something like this (you may need to check indentation, can’t test right now):
In your sequence to set the light to “moonlight” you need to put mode: 'moonlight' in a data block as well. And the default service needs to be indented more. Try like this:
Does it work through Developer Tools -> Services?
Might be that the entity_id must also be in the data block, but I think it shouldn’t matter, but it’s worth a try.
It doesn’t work as expected BUT
the yeelight integration has 2 entities
1 for the light that I am using
and the binary_sensor.bedroom_ceiling_light_nightlight
The lamp has also a remote control (which I use lately for the moonlight option)
I was playing with it and when the moonlight light was on the above binary sensor turned on.
But I am not sure how I can handle it through HA.
Yes. if I ask for moonlight id does reduce the light but not as low as the original moonlight. Even when I set brightness to 1 it is much brighter than moonlight option.
Ok great, that means that the remote probably also sends 2 commands, one to turn the light to moonlight and a second to decrease the brightness, as you did in your automation.
Give it a try with the time based automations and come back with your code if you don’t succeed. Just as a tip, sometimes it’s easier to create 2 separate automations to handle different scenarios.
usually I do create 2 automations but for this one I couldn’t find it’s logic.
Now I am rethinking about it could I just ask the automation to turn on the moonlight mode after 23:00 until 06:00 otherwise to keep the original light.
I noticed something that obviously has to do with the particular lamp (and one more yeelight I have)
Since those lamps are switched off HA keeps looking (until the are on again) for them. This wouldn’t happen until the mew integration (before 0.115 version)
Now I have the following in my config
Logger: homeassistant.config_entries
Source: config_entries.py:239
First occurred: 7:33:08 PM (111 occurrences)
Last logged: 8:18:15 PM
Config entry for yeelight not ready yet. Retrying in 5 seconds
Config entry for yeelight not ready yet. Retrying in 10 seconds
Config entry for yeelight not ready yet. Retrying in 20 seconds
Config entry for yeelight not ready yet. Retrying in 40 seconds
Config entry for yeelight not ready yet. Retrying in 80 seconds