Automation Triggers based on formula that includes sunrise

I live to the west of a tall mountain. I have a motorized shade on my eastern facing window. I’d like to lower the shade as the sun hits the window and not before because it’s pretty occlusive to the view. Seems easy, eh? Well, here’s the hitch. In the height of the summer the sun comes up over the highest part of the mountain, so the trigger would be SUNRISE+135 minutes. In the depth of the winter the sun come comes up over a plain, so the trigger would be SUNRISE+10 minutes. The rest of the year is variable based on how far north the sun is rising at. So, one way to do this that I can think of would be to setup a trigger that’s actually based on a formula that I can define (with a bunch of lookups or a big case statement or something like that), but I just don’t see where that’s possible. The ‘SUN’ trigger allows an offset, but it’s a fixed value and not a variable based on time of year. I could probably segment the year into parts (like 5 parts or so) and create a separate automation for each part of the year, but that seems cumbersome. Is there an easy way to do this?

I’d create a formula based on week number vs offset and use that in a template trigger.

1 Like

How is the light level in the room during the time you want the shade to be lowered? I would assume it would be the same, no matter the time of year. If this is the case, you could probably use a sensor that measures lux levels, then trigger on that. You would obviously would need to exclude lights on in the room as a condition.

A lux sensor on the window would be the better option as it would prevent lowering the shade on overcast days.

1 Like

So reading into the template trigger, I think that’s exactly what I had in mind. If I’m reading the documentation correctly, I should be able to create a bunch of nested if-then-else statements based on time of year and time of day to arrive on a false-true transition when I want the shade to come down.

That said, the lux sensor idea is intriguing. The idea of not dropping the shade on cloudy days is pretty awesome. Do you know of a HA compatible lux sensor?

If you are into diy:

Otherwise there are plenty of zigbee, zwave or wifi off the shelf options.

There’s a thread about setting up a sensor based on the orientation of your window and the sun’s azimuth…

1 Like