Show Current Sun Position and Shadow of House (Generate SVG)

hi, did you find a solution for triggering if/not a position is shaded or not ?

I was going to try some experiments with the SunSet Azimuth

No I haven’t I’m also still struggling to get it to show correctly in the first pkace

Ok so for Southern Hemisphere query - which way should my house be facing? North to top?

grab a google maps, face it as is there, setup lat/long, timezone and correct time on your server and you should be good to go

Hi!
I’d like to add a few things:

  1. shaddow.svg has origin (x= 0, y= 0) in the upper left corner.
    Instead Inkscape has it in the lower left corner.
    Consider to vertically flip the image before taking nodes coordinates.
  2. Nodes has to be written in counterclockwise order.
  3. Shaddow.py has a nodes number capacity limited to 20.
    If you have (like me) more than 20 nodes you have to modify line number 190 (approx):

if (k == 20): break
/----/
Now it’s working fine !!
Thanks @pmpkk and everybody contributing this thread!

Alex
_shaddow

2 Likes

I’m having the same issue as @Andrew_Pawelski with being in the southern hemisphere, and like Andew I cannot work out what to change. Any ideas?

@nathantfry I did as above - used google maps - put it into SHAPE, set lat, long and timezone and then adjusted the image x an y until it was in the middle of the circle and the sun matched what it looked like when i looked out the window

I dont have a moon on the circle (thought i saw one at some stage though

all you really have to do is to set your lat/long, time, timezone and shape of the house.
Script does not care about hemispheres really


moon or sun is shown only when elevation is not below 0

@kriznik, @Andrew_Pawelski something is still not right. If I choose some random northern hemisphere lat/long then all works as expected including hour segments. If I choose southern hemisphere lat/long then it does not works correctly.
I have my Light Color / Primary color swamped for the sun arc but the moon is still not right and the hours do not show.

I can upload another image of when it works with northern hemisphere lat/long when I get home from work just to show the difference. I have these permanently in the script commented out to prove the script is working, it’s just the code seems to need tweaking for the south.

havent tried by myself, are your lat/long both negative?

edit, looks like it’s having difficulties with negative lattitude, will take a look on it

@kriznik, I have a positive lat but negative long (Australia), thanks for looking into this.

can you give me TZ code and relevant lat/long in that TZ so I dont need to search for it?
ty
nwm, it was quicker than I thought :stuck_out_tongue_winking_eye:

ok, it’s having difficulties only when you change lat/long timezone, but your time is mismatched eg. not right in given “random” lat/long"

I’ve tried Australia, Africa, Chile and seems to work just fine when properly configured time is in the game. eg. this line

self.now = timezone.localize(datetime.now() - timedelta(hours=6))

for setting up right time when your server time is different than destination time

chile right now:

sydney right now:

and dakar:

at midnight I still have no moon - how can I check elevation?

in your astro binding there is a elevation
or when you run :

python /etc/openhab2/scripts/shaddow.py update

you can see values in the console

OK thats consistent to what you are saying but I would have thought at 12.14am here the moon would be up?

Sun azimuth: 188.079278958
Sun elevation: -72.973945699
Moon azimuth: 162.060936626
Moon elevation: -75.9157767755

as you can see on pictures i made ytd, moon was visible in australia and chile but not in dakar…
and moon and sun have been on very close trajectory.

everyday is moon on different trajectory, look ouside if there is moon and your picture is missing it - something wrong with your config :slight_smile:

Your elevation is negative. The moon is not visible.
The moon is not always out at night. It depends on it’s orbit position and the position of the earth around the sun. I am sure you have seen the moon in the daytime before.

OK thanks guys the sun is up and I have it on the map and a shadow so your probs right it was cloudy last night and couldnt verify the moon location but that may have been cos it wasnt there!

What I would love to use this for is to detrmine where the sun is and if within a certain range on the map (this could be static) then lower my blinds, and as the sun moves around raise them back up again - any ideas? Im using time for this but as we are in winter here the times are very different to what they would be in summer