In order to do this, a lot of infrastructure has to be in place. Take a
look at the test file test_daily.py
<https://github.com/weewx/weewx/blob/master/bin/weewx/tests/test_daily.py>,
function testTags
<https://github.com/weewx/weewx/blob/master/bin/weewx/tests/test_daily.py#L206>
(line 206).

It sets up a TimeBinder object (line 222). Once you have that, you can do
things like

    print(tagStats.trend.barometer)

For many of these aggregates, you can use the xtypes
<https://github.com/weewx/weewx/wiki/xtypes> system, which is a lot simpler
to access. For example, to get the day's rain

    val_tuple = xtypes.get_aggregate('rain', timespan, 'sum', db_manager)

where timespan is the start/stop times over which the aggregation is to be
taken, and db_manager is an open database manager object. It returns a
ValueTuple <https://www.weewx.com/docs/customizing.htm#ValueTuple>.

If you're not a Python programmer, it's going to be tough. :-(

-tk

On Sun, Dec 17, 2023 at 3:38 PM nfbarg...@gmail.com <nfbargman...@gmail.com>
wrote:

> This likely has everything to do with my lack of Python acuity than WeeWX.
>
> When obtaining values for a user extension that does not have an
> associated skin so I am not using the Cheetah Generator, how might I call
> into the tag system to get the data such as 'trend.barometer'?  in
> cheetahgenerator.py I see the Stats class that looks like it should be what
> should be called but I don't see it subclassed anywhere but is part of
> 'default_search_list'.
>
> Primarily I am interested in 'trend.barometer' and 'day.rain'.  The rest I
> am getting from the latest archive record.  I've not found any extensions
> that use the tag system like this that I can be inspired by so I am asking
> the experts.
>
> TIA
>
> - Nate
>
> --
> 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 weewx-development+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-development/b4a1b9d6-2e1e-4132-8731-477c2d6018f8n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-development/b4a1b9d6-2e1e-4132-8731-477c2d6018f8n%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 weewx-development+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/CAPq0zEAsOmrfyb5p0T%3Ds0vxae4MQNdchLHkFh%3D_YUue7U8AOhw%40mail.gmail.com.

Reply via email to