It occurs to me this can easily be done within the templates. For example,
near the top of index.html.tmpl, put (NOT TESTED):

#set isDaylight = lambda t: $almanac.sun.rise.raw < t < $almanac.sun.set.raw


Now you can say things like:


#if $isDaylight($current.dateTime.raw)

  <p>It is daylight</p>

#else

  <p>Still dark</p>

#end if


No search list extension necessary.


-tk

On Sun, Dec 10, 2017 at 5:21 AM, Antony K. <nafpaktia.weat...@gmail.com>
wrote:

> This issue was raised because I ask in a post if Weewx can return true if
> it is day, or false if it is night. I was tempted by Mr. Tom Keffer to
> write a script named daylight.py because he told me this is done
> voluntarily and suggested I do it, so I did.
>
> The script ( attachment daylight.py ) is in 3 phases.
>
> 1) Parse sunrise and sunset time from Weewx and check if the content is a
> time format in this form,
> for example:
>
> 00:00
> 12:00am 12:00AM
> 12:00 am 12:00 AM
> 12:00pm 12:00PM
> 12:00 pm 12:00 PM
>
> If nothing applies from the above return N/A.
>
> 2) If the time is in 12hr mode convert it to 24hr.
>
> 3) Check if it is night or day using sunrise, sunset and current time.
>
> The problem is that I'm not familiar with weewx development, how will I
> incorporate and register this script to Weewx so by importing sunrise and
> sunset time and giving $current.isDaylight tag, return true or false.
>
> --
> 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.
>

-- 
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