Thanks, Tom. I appreciate the tips. Right now I am issuing SQL statements directly into the 'archive' and 'archive_day_rain' tables for the barometer trend and day rain values. This works as the access only occurs with each new record.
My basic understanding of Python is fine, it's all of the abstraction through the various classes where I tend to get lost. Still this little project of mine has helped me immensely as it has given me a reason to understand the WeeWX internals much better and the way an object oriented project ties together. - Nate On Sunday, December 24, 2023 at 7:39:34 PM UTC-6 Tom Keffer wrote: > 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 [email protected] <[email protected]> > 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 [email protected]. >> 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/882990f1-4e76-4bb7-a63d-40e8c25b387cn%40googlegroups.com.
