On Saturday, November 26, 2016 at 8:53:24 AM UTC-5, WindnFog wrote:
>
> I have a USB camera pointed at my backyard.  It takes a picture every 5 
> minutes, one minute before weewx does it's calculations and uploads (i.e. 
> picture at 04, weewx at 05 and so on.)  It works fine now on a cron job 
> every 5 minutes, 24/7.  
>
> I want to enhance it to just take pictures during daylight hours.  My 
> thoughts are to put a time check in my .bat file that runs every 5 
> minutes.  Something like: IF (DAYLIGHT) TAKE_PICTURE ELSE FORGET_IT sort of 
> thinking.  
>
> Is there a better way (from a Linux bash script, not Python) than parsing 
> /home/weewx/public_html/index_html to obtain these values?  I'm looking for 
> the simplest solution.  I'm hoping I can make DAYLIGHT a boolean that is 
> something like this:
>
> DAYLIGHT = ((time > Start civil twilight) AND time <  (End civil twilight))
>
> I could use Sunrise and Sunset instead if they are easier to obtain.
>
> I'd like to upload this photo to my weewx web site, and I can now except 
> well over half of them are taken in the dark.  I want to put a .jpg there 
> that says something like "Next photo update at sunrise" or similar.
>
> Thoughts?  Better ideas?
>
> - Paul
>
I don't know enough Python to help but perhaps Python has a function like 
the PHP date_sun_info:
PHP date_sun_info <http://php.net/manual/en/function.date-sun-info.php>
which, given time,lat and long, will spit out, for example:

> sunrise: 05:52:11
>
> sunset: 15:41:21
>
> transit: 10:46:46
>
> civil_twilight_begin: 05:24:08
>
> civil_twilight_end: 16:09:24
>
> nautical_twilight_begin: 04:52:25
>
> nautical_twilight_end: 16:41:06
>
> astronomical_twilight_begin: 04:21:32
>
> astronomical_twilight_end: 17:12:00
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to