Probably will need to install PyEphem first ("sudo pip install ephem").
- Code: Select all
import ephem
azimuth = indigo.variables[717359973] # "Azimuth"
elevation = indigo.variables[719196174] # "Elevation"
(lat, long) = indigo.server.getLatitudeAndLongitude()
obs=ephem.Observer()
obs.lat=str(lat)
obs.long=str(long)
sun = ephem.Sun(obs)
indigo.variable.updateValue(azimuth, str(float(sun.az) * 57.2957795)) # converted from Radians to Degrees
indigo.variable.updateValue(elevation, str(float(sun.alt) * 57.2957795))