I’m trying to figure out how to control a light depending on how much solar power is being generated through my panels. The idea is to use the panels instead of a light sensor so the lights turn on earlier if it’s a darker day (eg. cloudy or rainy).
This does a basic job but I would like to make it better. I want to turn on the light if the solar output is less than 1kW for 10 minutes any time after the sun elevation drops to below 24 degrees.
Using the “for” option on the numeric_state trigger for the solar panels wouldn’t work because it could trigger earlier in the day (while the sun is above 24 degrees).The ideal behaviour, if the solar output is less 1kW all day, would be to turn on the light when the sun drops to 24 degrees.
You could still use the “for” option and then use conditions to dial it in to your specific needs. You say that you can’t use “for” because it might trigger earlier in the day - while this is true that is just the trigger, you could use conditions to tighten that up and say “ok, you made it to here now is the sun less than 24 degrees and are we less than 1kW too?”.
There is a lot of flexibility both in the conditions as well as the actions, so you can really dial this in to a pretty fine level that if everything else passes in triggers and conditions then your actions could apply even more conditions using Choose. And with the new trace tool in automations you should be able to fine tune it to precisely what you are after.
My understanding of the “for” option is that it would only trigger once unless the output increased above 1kW after it has triggered.
So, for example, if it was a really dark day and the solar output was less than 1kW all day, the automation would trigger the first time that it remained less than 1kW for 10 minutes. If the sun’s elevation was above 24 degrees at that time, then nothing would happen (as intended). Then, if the output remained less than 1kW until the sun dropped to 24 degrees, it wouldn’t trigger again as that 10 minute threshold would have long since passed.
Is there a way to make this work with conditions?
Edit: I think the part that makes it difficult is that I only want it to trigger if the output remains less than 1kW for 10 minutes. The output fluctuates a lot even during sunny days so I don’t just want to check the output at a single moment.
Depending on how you wanted to approach it, you could move the “less than 1kW for 10 minutes” lower into the automation using the Choose option and make your trigger based on something that is more of a catch-all, such as “if kW changes at all, then process these Choose options”.
So the trigger becomes any change to kW, the condition is the angle of the sun or even nothing at all, allowing Choose to handle your conditions for you since you have several “if…then” statements to work with (sun elevation, kW for 10 minutes, etc).
If you pass all the triggers and conditions, the Choose should properly evaluate if the kW has been less than 1 for 10 minutes.
It’s worth experimenting and seeing, but it sounds like this would work (I don’t have anything similar to test with).
Here’s my attempt with a catch-all trigger. I’m still having trouble with the “for” part as I only see that option when I use numeric_state as a trigger, not when it’s a condition.