Sunrise/sunset

Download javascript
Download profile

Goal

To calculate the sunrise, sunset and the twilight times for a given location, which the phone gets by GPS (net). The times are shown by PopUp and the sunrise/sunset is saved in global variables as well.

Changelog

Version 6 - fixed a bug (lat lon example not commented out), uploaded to sunriseset3.js (no right to delete the previous file)
Version 5 - (half)fixed (quick+dirty) the sunriseset.js (bug with at), uploaded to sunriseset2.js
Version 4 - works in Tasker v4 now, bugfix in JS (new file), bugfix in profile (new file)
Version 3 - added twilight times. Further DST fixes - please email me if this fails in your TZ.
Version 2 - corrected for Daylight Savings Time.
Version 1 - initial version.

Usage instructions

Download the javascript file and save it in the Tasker/JavaScript directory or point in the task to where you saved the javascript file.

The example profile will run once a day at 00:01 o'clock and set the variables %SUNSET and %SUNRISE to the appropriate times, it will show a PopUp with all times.

The script also returns the twilight times as follows:

%at_start Astronomical twilight start
%nt_start Nautical twilight start
%ct_start Civil twilight start
%rise Sunrise
%set Sunset
%ct_end Civil twilight start
%nt_end Nautical twilight start
%at_end Astronomical twilight start

References

Adapted from the NOAA Solar Calculator.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License