[RELEASE] SunCalc Driver

Ahhh - that is the key to what I am not understanding - how do you call for a driver value refresh from a rule?

Run custom action, the driver is considered an actuator in this case.

No parameter type need be selected.

1 Like

Very interesting, @michael.l.nelson, and good to know for a lot of reasons. I always wondered how to get to all of the other variables and buttons in drivers. I’m certainly not complaining because the SunCalc driver @augoisms wrote is just what I needed for controlling our shades, but I still find it a little unusual that the driver doesn’t update when it is called, much like when I call on a rain sensor to tell me if the floor is wet or dry. If I call on a sun sensor, it seems it should update the sun’s position.

Thanks for the quick response and clear answer.

Don

1 Like

Just an update on my automation using the SunCalc driver. After a minor hack to turn the altitude variable in the driver to a shutter position variable that can be fed directly to the shutter driver with a value of between zero (closed) and 100 (open) so that the shutter casts a constant shadow throughout the arc of the sun from sunrise to sunset, the result was truly remarkable.

Here are the calculations I added to the driver and the way I determined the field of view for each shutter so that they can adjust individually every 15 minutes between sunrise and sunset.

Many thanks for @augoisms and the others who helped out!

5 Likes

Wow this sounds amazing, We have Serena Shades on the NW and SE sides of our house and Velux Skylight shades on the roof. I'd love to do (sort of) what you did.

Check : are shades open at all? (e.g. don't open them before we wake up in the morning and manually open them a little)
THEN
Start SunControl
Increment shades throughout the day as Sun moves
Else
End SunControl

The skylight shades might need their own rule that just says "close if Altitude >= X otherwise open"

Being able to accurately control the amount of sun coming into any room throughout the day is a nice lifestyle improvement that comes at the price of a little technology and some high school math. You can literally draw a line on the floor beyond which you don’t want any sun to come.

The SunCalc software was, of course, the key to success. By knowing the position of the sun and that line on the floor, you can position your shades to maintain that line throughout the day. I update the sun’s position every 15 minutes and adjust accordingly. That gives a variation on the sun line on the floor of a few inches without constantly adjusting the shades.

Having auto adjusting shades can be a little surprising to guests, so I used our Alexas to do a simple chime 5 seconds before each adjustment. The Alexas also pre announce any major shade movements - like when all go up 5 minutes before sunset so we can enjoy the view. Also if water is detected on the terrace before they all go down.

Fun stuff! Good luck with your project...

1 Like

@augoisms This is awesome! I just installed 3 Ikea shades on my west windows mainly for the purpose to auto close them when the sun starts beating down on those windows. This is going to help me immensely!

@Donald I'd love to see your RM set up for your shades. I made a protractor and was using my compass today and my wife was laughing at me. :slight_smile:

@jared.zimmerman Did you get your RM set up for your shades as well? I'd love to see that too.

Great work everyone!

1 Like

I'm going to give this a try today and see how it works. Any recommendations/suggestions?

I went https://www.suncalc.org/ to try and get a good approximation. We'll see what happens!

Nice!

Do your delays needs to increase (10,20,30, etc)? I’m not positive, but seems like they would all run in 10 min.

:man_facepalming:

You’re right. I’ll add a pause/wait in between as opposed to the delay. I wasn’t thinking clearly last night! Lol

Maybe move your private boolean first in case the pauses "delay" the setting of the PB until the very end.

Good call!

Updated... right now it's pretty basic with the 10 min delay. Eventually i'll have to calculate out all the specific degrees and adjust off that.

1 Like

I did not. Too much math :expressionless:

1 Like

@Donald Could you possibly share how you added this to the code? I'm looking to do the same set up, but I'm new to coding in Hubitat. This would be a HUGE help to 'completing' my home automation set-up. (Is it ever really complete though?)

Throwing down my dumb-question chit...could you explain how this compares to using Sunrise/Sunset (w/offsets) to drive adjusting shades or blinds? Is this more accurate/reliable than using Sunrise/Sunset values, or ?

Thanks!

@danabw Not dumb at all. It can be more accurate, but it's really more about how the information is supplied.

The Sunrise/sunset values will return a time value that you can use to make adjustments, where this driver will return the sun's position that you can use to calculate the angle of light entering your house.

By using the angle of the light, I can lower my shades bit-by-bit and keep the sunlight in my office from sitting on (and roasting) my desktop!

1 Like

Thanks, makes sense. We have that issue in our office, wife works where the sun starts hitting her desk in the afternoon. I've been using a Sunset-based approach to adjust the blinds (iBlinds), but will look into changing over to this and give it a go. Thanks for posting it!

Sure!

I just added two lines to SunCalc to convert the altitude to a shutter position between 25 (down, but air vents are open) and 100 (completely up). The lines also include the constant of 4 feet which was the maximum amount of sun exposure I wanted on the terrace floor (see earlier posts in this thread).

Have fun,

Don

1 Like

That's perfect! Thank you @Donald for the hack and thank you @augoisms for the original code that made this possible!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.