News for hackers. Stuff that matters.
Re:Ask HN: What are you working on? by DavidPeiffer on Friday January 15, 2021 @06:37AM (#25789679)
Neat project!

I've been trying to figure out a smart home automated system to determine if shades should be open or closed to optimize for energy efficiency, accounting for sun intensity, time of day, and orientation of the window. I suppose I could throw something like this on rather than relying on generic sunrise and sunset times.

Did you have a lot of wrangling with coordinate systems and the location of the sun changing throughout the year?

Re:Ask HN: What are you working on? by tppiotrowski on Friday January 15, 2021 @11:47AM (#25792854)
Suncalc [1] is the library I use to calculate the position of the sun. Mapzen [2] host public elevation tile data. This blog post [3] is a good overview of the calculations involved.

[1] https://github.com/mourner/suncalc

[2] https://www.mapzen.com/blog/terrain-tile-service/

[3] http://www.liedman.net/2014/06/25/sunshine/