I tend to do maintenance with the lights at 100%, but I also tend to do it around the time when the lights would be at 80%+, so I wouldn’t need an override.
One final thing to say though. The delay automation appears to be working ok right now, but today is the first day where it should go through a full sequence, so I cannot be sure yet. I would be happy to stay with the current configuration if it proves to be effective, so if you choose to write something custom I will try it, but would also be happy to stay with delays if you did not.
I’m also at probably beginner to intermediate stages of HA, so whilst I can modify configuration.yaml and automation.yaml, it is at basic level.
The issue is you can’t queue transitions like this. When you issue them they take effect immediately. The fade-down is replacing the fade up transition.
So what you can do:
one automation triggered at 12 that turns on and fades from 30% to 100% over 5 hours.
a second automation triggered at 5 pm (12+5 hours) that fades from 100% to 30% over whatever time period you like - assume 5 hours.
This way if you need to you can push the automation at 5pm to start a bit later if you want more time @ 100% for whatever reason.
No, I’m proposing that the automation (runs now every 79 80 (again ) secs) calculates what level it should be at (according to the time of day, going up down whatever) and you write that value to the brightness
There’s the critical clue (explaining why the wait_template doesn’t wait). You also reminded me of how this works in the other home automation software I use (Premise). When the light is commanded to transition, Premise receives the first brightness status message from the light (a low value) and that’s the light’s brightness for the duration of the transition (because the light issues only one status report upon initial receipt of the transition command). It’s not ideal but that’s the way it works.
In other words, the situation with Premise is opposite to Home Assistant which immediately indicates the transition’s final (not initial) brightness value. Effectively, it “anticipates” and reports the light’s brightness to be its final (i.e. target) value.
This comparison highlights the challenge for any home automation software to accurately report transition status. Ultimately it depends on the light’s ability to report it’s changing brightness level. This ability depends upon the lighting technology. As far as I know, most lighting technologies do NOT report their transition status while it’s changing.
Because Premise reports only what the light reports, I can create an automation to periodically poll the light, while it’s transitioning, to acquire its latest brightness value. I can also do this with Home Assistant, however it will have an initial glitch because Home Assistant initially reports the transitioning light’s brightness to be its final brightness. It’s this initial “anticipated” value that renders the wait_template useless.
Edit : There is a problem with brightnes: vs brightness_pct: (No Idea Why) Please go down to Post 95 for the workaround
Okay, Here we go : -
I have written for 30 to 255 (and it suspiciously/fortuitously comes out at 80s per 1/255)
Not sure if I needed the
{% set outp = 0.0 %}
line as I need a float but start off with integers (maybe I’m being pedantic)
But I’m sure the code could be improved/polished but try to keep it readable/easily maintainable as bedfellow is still learning.
I’d just bung this in a new file under packages but bedfellow may have to split it out for his particular configuration (I just keep it all together)
Obviously I have not tested this with real world entities nor over a 24 hour period, so theory now meets the real world.
Not this will maintain the desired level regardless of when HA is started.
Oh ! and it has a maintenance overide built in for 20 mins of 100% output - use it or ignore it, you choose.
@Mutt, thanks for the package. It may be some time before I can tell you if this works as TBH, at the moment I have no idea on how to implement this in HA
As you gave me a brilliant idea to use your fish tank lighting idea for a different project, i’d like to return the favor to help you implement it in HA
Create a new folder in your Homeassistant-folder (where configuration.yaml is already at) and name it ‘packages’ without the quotes.
In your newly created folder, create a file called ‘fishtank_light.yaml’ and paste the contents of @Mutt 's earlier code in the file. And of course, don’t forget to save
Go back to your homeassistant-folder and open configuration.yaml. Add the following line at the line after homeassistant:, including the two spaces:
packages: !include_dir_named packages
Save configuration.yaml and restart Home Assistant.
@bedfellow Whoops, my bad! It’s not the end of the file (that just happens to be my own configuration-file format…)
Can you try adding it directly under the homeassistant: line (probably at the top of your file). Again, with the two spaces included. So it should look like this:
Packages are new to me but I must say that I like them. I have a ZigBee join panel which has elements split all over configuration.yaml and it would be much smarter in packages.
it did work, it’s just that your input number didn’t like having -39 assigned to it (0 to 256 range) not sure why I did the 256 now, could get away with 255