diff --git a/common.sh b/common.sh index 3288d4d..2d03581 100755 --- a/common.sh +++ b/common.sh @@ -1,4 +1,4 @@ -##!/bin/bash +#!/bin/bash ## debug # set -x diff --git a/install.sh b/install.sh index 1603383..4a69f49 100755 --- a/install.sh +++ b/install.sh @@ -286,6 +286,7 @@ else log_done "pd120_decoder installed" fi +cp templates/sun.py . success "Install (almost) done!" diff --git a/templates/sun.py b/templates/sun.py new file mode 100755 index 0000000..cdd87e8 --- /dev/null +++ b/templates/sun.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +import ephem +import time +import sys +timezone = change_tz + time.localtime().tm_isdst +date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(sys.argv[1])-(timezone*60*60))) + +obs=ephem.Observer() +obs.lat='change_latitude' +obs.long='change_longitude' +obs.date = date + +sun = ephem.Sun(obs) +sun.compute(obs) +sun_angle = float(sun.alt) * 57.2957795 # Rad to deg +print(int(sun_angle))