Unfortunately, no, there's no easy way to get at the searchlist instance
that does almanac tags.

Your best bet would be to create a private instance of weewx.almanac.Almanac
and use that. That will require the time you want the almanac to be valid
for and your position. Altitude is optional. These can be obtained from the
engine. Something like this (NOT TESTED):

import time
import weewx.engine
import weewx.almanac

class MyService(weewx.engine.StdService):
    def __init__(self, engine, config_dict):
        super(MyService, self).__init__(engine, config_dict)

        latitude_f = engine.stn_info.latitude_f
        longitude_f = engine.stn_info.longitude_f
        altitude_vt = engine.stn_info.altitude_vt

        almanac = weewx.almanac.Almanac(time.time(),          # The time
you want to use
                                        latitude_f,           # The latitude
                                        longitude_f,          # The
longitude
                                        altitude=altitude_vt) # The
altitude as a ValueTuple (optional)

        print("Jupiter will rise at", almanac.jupiter.rise)

The values can be further refined by adding the horizon angle, pressure,
etc. See the initializer
<https://github.com/weewx/weewx/blob/b5a79042fb5017c8c0d342e957ae1fa98040bd94/bin/weewx/almanac.py#L195>
for Almanac, and the doctests for the class.

Hopefully, that will get you started!

-tk


On Sun, Mar 26, 2023 at 1:36 PM 'Peter Fletcher' via weewx-development <
[email protected]> wrote:

> weewx obviously 'knows' the sunrise and sunset times for the current date
> and location, since almost all available skins display them. Are their
> values accessible from within a service?
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-development/c2bde934-9c69-431e-8fd1-e899067af581n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-development/c2bde934-9c69-431e-8fd1-e899067af581n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/CAPq0zEDmczdQyoZky4Ry3_a%2Brv11p97i3Hf7qS%2Bi1v%3DrPaLJ6g%40mail.gmail.com.

Reply via email to