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

I got it working:

[20:46:40] openhabian@openHABianPi:/etc/openhab2/html$ python /etc/openhab2/scripts/shaddow.py update
Sun azimuth: 299.589545552
Sun elevation: -12.2902011317
Moon azimuth: 54.2078919705
Moon elevation: -20.0187090139
Done in 0:00:00.401640 seconds
[20:46:42] openhabian@openHABianPi:/etc/openhab2/html$ 

But in VS Code, I am still getting the unresolved import ‘pylunar’ and ‘astral’ along with undefined variable for ‘Astral’ and ‘Location’, but both Astral and Pylunar have been installed with python 2.7:

20:48:25] openhabian@openHABianPi:/etc/openhab2/html$ pip install astral
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: astral in /usr/local/lib/python2.7/dist-packages (1.10.1)
Requirement already satisfied: pytz in /usr/local/lib/python2.7/dist-packages (from astral) (2019.2)
[20:48:36] openhabian@openHABianPi:/etc/openhab2/html$ pip install pylunar
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: pylunar in /usr/local/lib/python2.7/dist-packages (0.5.1)
Requirement already satisfied: enum34; python_version == "2.7" in /usr/local/lib/python2.7/dist-packages (from pylunar) (1.1.6)
Requirement already satisfied: ephem in /usr/local/lib/python2.7/dist-packages (from pylunar) (3.7.6.0)
Requirement already satisfied: pytz in /usr/local/lib/python2.7/dist-packages (from pylunar) (2019.2)
[20:48:54] openhabian@openHABianPi:/etc/openhab2/html$ 

The sun is working, however, the moon is not. Any ideas as to why this would happen?

Thanks,

~John

if you have pylunar it have to work. How do you assume “moon is not working” statement? based on ?
as your moon elevation is -20 eg. it’s not visible eg can’t be shown

I seem to have taken a step backwards - its 2.48pm and no sun but moon? (and no time bands)
using August script

image

@kriznik,
This is my results from just now (5:43 am), about a half hour before sunrise:

[05:43:32] openhabian@openHABianPi:~$ python /etc/openhab2/scripts/shaddow.py update
Sun azimuth: 72.2814807047
Sun elevation: -4.48626415385
Moon azimuth: 82.5192446462
Moon elevation: 21.5990372029
Done in 0:00:00.354876 seconds
[05:43:38] openhabian@openHABianPi:~$ 

By looking at this data, I would expect to be able to see the moon, but not the sun… I cannot see either one.

~John

Mine is now working - can anyone tell me the lines to modify the hour bands color? I want this to not be primary and light colors

magically fixed itself?

define new color variable and change this and the one after this

svg = svg + self.generateArc(WIDTH/2+8,PRIMARY_COLOR,

im not sure what changed there was some caching of svgs involved and I managed to sort that out and at one stage the svg file wasnt being overwritten but deleting the file and changing the source to somewhere else and back again seemed to do it - very odd but has to be a local problem to my setup

Might have asked for the wrong color item looking to change the darker color on the arc - I tried all the similar lines but perhaps its being generated somewhere else

it’s generated where I wrote you

			if (i % 2 == 0):
				svg = svg + self.generateArc(WIDTH/2+8,PRIMARY_COLOR,'none',DEGS[i],DEGS[j],'stroke-width="3" stroke-opacity="0.2"')	
			else:
				svg = svg + self.generateArc(WIDTH/2+8,PRIMARY_COLOR,'none',DEGS[i],DEGS[j],'stroke-width="3"')

define new color you want or two, whatever and change this code accordingly

First I would like to thank everyone for your hard work.
I LOVE this widget!!! Thats the good news.
Second, It appears that mobilefish has installed a pop-up virus on my computer.
This is a warning to anyone that might attempt to gather coordinates through that link.
the widget works awesome. I am working on changing the colors a bit and haven’t figured all of that out yet. YA’LL ARE SOME AMAZING BRAIN POWER!!!.
Not to get to personal but I have been recently going through neck and head cancer treatment. It has been Hell on earth. a few surgeries so far, treatment is really slow but thanks to the OH community I have had a much need distraction. So THANK YOU ALL SOOOOO MUCH!!!
We are Openhab Strong :muscle:
Steve-

if you need your coordinates I would strongly recommend to not use any software at all.
Just open https://maps.google.com click on your house and you’ll see your coordinates right at the bottom of the screen in new bubble which appears after you clicked.

Cheers

Thank you @kriznik.
I am grateful for your quick response.
I wasn’t clear, mobilefish is a program for the X,Y coordinate’s for the SVG rendering.
I already have my LON,LAT.
God Bless
Cheers back atcha
Steve-

Ah it wasnt clear which coordinates you mean… well you can get coordinates from inkscape as well
And mobilefish is an website, if your browser security is not set to none, it should not install you anything anywhere

OK finally got through this simple issue with color but it seems as if the arc i colored isnt even now?

Hi, I need your help, I do not know where I messed settings but my generated picture looks like this :
image
issue is bright line showing part of house under light - it is completely opposite than I expect.
All other information seems to be displayed correctly.
I’m using latest script and house data are as following:

SHAPE = [{'x': 40, 'y': 23}, \
		{'x': 29, 'y': 73}, \
		{'x': 58, 'y': 81}, \
		{'x': 61, 'y': 66}, \
		{'x': 66, 'y': 68}, \
		{'x': 69, 'y': 64}, \
		{'x': 67, 'y': 57}, \
		{'x': 63, 'y': 51}, \
		{'x': 68, 'y': 36}, \
		{'x': 58, 'y': 33}, \
		{'x': 59, 'y': 28}]

Any help / hint will be appreciated.

invert your coordinates to the opposite of where your house should be.
its mentioned in this thread that inkscape has got different 0;0 location than svg

of course its not, because earth is NOT traveling in circles around the sun…

I dont think I explained myself properly perhaps?
The “none” color I changed to “green” and this showed as expected but the lines are not shaped evenly as in they seem to be thin at the ends and fat in the middle

no idea what have you changed in actual code :wink:

Thank you very much, that works.

Any clues?
my system crashed and I reloaded from scratch and:

File “/etc/openhab2/scripts/shaddow.py”, line 7, in

import pytz

ImportError: No module named pytz
if anyone can help?

Thank you
Steve