As you say, putting it in the database would be a waste.

There are several ways to do this. You could use the builtin Cheetah
template engine in weewx to create a small file with the sunrise and
sunset, then include this into your PHP script. The following assumes you
have pyephem installed.

$almanac.sun.rise
$almanac.sun.set

Alternatively, if you can access Python from within your script, you could
run the almanac code directly

import weewx.almanac
almanac = weewx.almanac.Almanac(timestamp, latitude, longitude)
sunrise = almanac.sun.rise
sunset = almanac.sun.set

Of course, it's up to you to supply timestamp, latitude, and longitude.

-tk

On Sun, Apr 23, 2017 at 1:21 PM, mark2326L <m...@owyhee.com> wrote:

> I have been running weewx for a week now. I'm making  a custom php
> webpage, everything is going good, but I have no idea how to get the
> almanac data into my php page.
> I'm completely new to python, that adds to my struggle.
> I also realize having the sunrise, sunset in the database is a waste of
> space, but it's the only way I can think of.
> I was thinking of adding 2 tables or changing 2 that I most likely will
> never use in the archive table.
> The problem is I don't know how or where to put the python code to enter
> it.
> Any ideas?
> Thanks
>
> --
> 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