Now that we have reached The Dark Times (after the time change), I would like to be able to easily find the sunset/sunrise time for our location.
Does anyone know a site that publishes that in XML or JSON? I was hoping the National Weather Service in the USA would include it with the forecast page (https://forecast.weather.gov/MapClick.php?lat=44.58&lon=-73.51 is the local one for me) because that data is also in XML, but I don’t see it there.
You either need to run something each day to programmatically set or update the scheduler with the jobs you wish to run. One way of doing this would be to tag the reschedule onto the end of the job that runs - e.g. your daily sunrise job runs as a one off and then schedules a new instance of itself to run at tomorrow’s sunrise. The precise approach on how to do it would be determined by your scheduler, and not all schedulers support automation.
Your other option would be to use a dedicated tool like sunwait.
If you want the Sunrise and Sunset times you can also use Siri shortcuts. The standard Weather App can provide these times. No need to use the API of a Website.
First you fetch the current weather details with “Get Current Weather” at the current location and then you select “Get Details of Weather Condition”. There you can find the variables for the Sunrise Time and Sunset Time.
As far as scheduling… this looks like a job for at … but I haven’t used at for years. At one point at didn’t work reliably on macOS. I wonder if that is no longer true.
sunwait looks like it might be ideal for getting the info I want. Thanks!! It compiled and ran without any tweaking necessary.