[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sunrise and Sunset from terminal



On Wed, Sep 27, 2023 at 11:12:02AM +0100, Carles Pina i Estany wrote:
> 
> Hi,
> 
> sudo apt install python3-ephem
> 
> And in one line:
> 
> """
> (LATITUDE=51.5; LONGITUDE=0.12; python3 -c "import ephem; o=ephem.Observer(); o.lat, o.lon = $LATITUDE, $LONGITUDE; print('Sunrise:', o.next_rising(ephem.Sun()).datetime(), 'Sunset:', o.next_setting(ephem.Sun()).datetime())")
> """
> 

Some more options for the fun of it:
python3-suntime / https://github.com/SatAgro/suntime

I converted that code into a Lua script [1] to run it
on OpenWrt based systems, in case someone is up for something to
run in more constrained environments.
https://git.sven.stormbind.net/?p=sven/scripts.git;a=blob_plain;f=weblogpro/suntime.lua;hb=HEAD

Cheers,
Sven



Reply to: