Idea: Sensor to calculate direct sunshine times at coordinates (between buildings)

Hi everyone,

As summer is approaching in the northern hemisphere, I love to sit in my garden and enjoy the sun.

Problem is, however, I live in a city in my garden is situated in a very narrow inner courtyard. So I only have sunshine at very specific moments. Most of the times we have it at the end of the day, roughly between 5pm and 8pm. The same goes for other places where people enjoy the sun, like terraces, parks and such.

This made me think of a way to calculate if, and at what time, direct sunlight hits specific coordinates on a map. I also got inspired by this: http://shadowcalculator.eu/. I’ve filled this in myself, using height data for the buildings around me, provided by the local government, and it works quite well.

I can imagine having a sensor in Home Assistant exposing times when sunlight would and wouldn’t reach certain coordinates, so you could, for example, automate a notification like “Get ready, the sun will be out in 10 minutes!” for a specific location.

Variables to take into consideration:

  • azimuth
  • altitude of the sun
  • height of buildings around specific coordinates
  • ground level at specific coordinates
  • (optionally) weather conditions

The sensor should get coordinates as input, and maybe a time offset.
I can imagine output would be:

  • state boolean: currently sunshine at coordinates
  • start sunshine time/date
  • stop sunshine time/date

I found these websites to be interesting:
https://github.com/kameocode/shadowow - source code for shadow calculator
https://github.com/perliedman/shadow-mapper - create shadow maps using OpenStreetMap data
Some background about the above: http://www.liedman.net/2014/06/25/sunshine/

Shadow studies (how to calculate shadow casting): http://www6.mississauga.ca/onlinemaps/planbldg/UrbanDesign/ShadowStudiesFinal_Feb2012.pdf

I’ve done quite some research until now but I’m not a very skilled developer and it seems quite difficult to hack this, so I would like to get some input from the HAS community. Are there more people interested in developing such an integration? Does any of you know if there is any existing code or APIs to calculate this? Any input would be highly appreciated!

4 Likes

i also want to know something like this .

is there any sensor which can be install in a specific area in my terrace which can tell how much hour of sunlight i got ?