You can add the values for just the archive records by hooking into the event NEW_ARCHIVE_RECORD.
On Thu, Jan 23, 2025 at 6:05 AM Peter Fletcher <[email protected]> wrote: > Either of these approaches look to be more straightforward than using > XTypes. The search list extension approach probably involves less overhead, > since the code presumably only runs when Cheetah does. For the second > approach, I assume that I would have to add the values on every loop, even > though they would only be used for reporting. > On 1/22/2025 8:01 PM, Tom Keffer wrote: > > OK, I get it --- somewhere in the file are the aggregate values that you > need. I can think of two ways to approach this: > > 1. If you only need tags for use in the Cheetah generator, you could > write a search list extension, which would read the file and make the > contents available as a tag. You'd end up with tags such as > $month_total_energy. > 2. Write a WeeWX service to read your file, then add the values to the > current record. Then, the values would be available as > $current.month_total_energy --- not the most intuitive tag. > > That's all I can think of right now. > > -tk > > > > On Wed, Jan 22, 2025 at 3:58 PM Peter Fletcher <[email protected]> > wrote: > >> All of my 'aggregate' values will be directly available in the file I >> mentioned in my original message - there will be no need for any actual >> calculations. >> On 1/22/2025 5:42 PM, Tom Keffer wrote: >> >> Yes, an observation value implemented as an XType can be used pretty much >> anywhere a database value can be used. >> >> However, because they are not stored in the daily summaries, calculating >> some aggregates of XTypes can be quite expensive. Something to be aware of. >> >> >> >> On Wed, Jan 22, 2025 at 2:36 PM Peter Fletcher <[email protected]> >> wrote: >> >>> Thanks! >>> >>> I had obviously not read the introductory documentation (which is all I >>> had read) on XTypes carefully enough, since I had thought it (only) allowed >>> adding new types to be manipulated and stored in the database. I will have >>> to read the full documentation with more care. >>> On 1/22/2025 4:51 PM, Tom Keffer wrote: >>> >>> This is exactly what XTypes <https://github.com/weewx/weewx/wiki/xtypes> >>> are for. >>> >>> For an example of using XTypes in an energy monitoring context, see >>> weewx-brultech <https://github.com/tkeffer/weewx-brultech>. >>> >>> On Fri, Jan 10, 2025 at 2:19 PM 'Peter Fletcher' via weewx-development < >>> [email protected]> wrote: >>> >>>> I am working on a service which will take current energy production >>>> data from my PV solar monitoring system and store it in the weewx database, >>>> to be reported to a modified version of the (pre-4.2) Seasons skin. The >>>> data I want to store is already being written at 5 min intervals to a >>>> transient file on the Raspberry Pi on which I am running weewx, so so far, >>>> so easy. I would also like to *display*, in 'Current Conditions', but >>>> not store, current totals for various periods (e.g. Today, this month, this >>>> utility billing period, this year). I assume that the Report generator >>>> could compute these from the archived energy generation values, but >>>> accurate values for all these totals are already available in the same file >>>> that contains the current production data, and it seems stupid, as well as >>>> potentially error-prone, to recalculate them. Is it possible just to make >>>> such values available to the report generator - e.g. by inserting >>>> appropriate tuples in Loop or Archive records within the 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 visit >>>> https://groups.google.com/d/msgid/weewx-development/c51f55d7-340f-4ed4-a295-0e559f4ced03n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/weewx-development/c51f55d7-340f-4ed4-a295-0e559f4ced03n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> >>> Peter R. Fletcher <[email protected]> <[email protected]> >>> Home Page - https://pfletch.fletchers-uk.com >>> >>> -- >> >> Peter R. Fletcher <[email protected]> <[email protected]> >> Home Page - https://pfletch.fletchers-uk.com >> >> -- > > Peter R. Fletcher <[email protected]> <[email protected]> > Home Page - https://pfletch.fletchers-uk.com > > -- 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 visit https://groups.google.com/d/msgid/weewx-development/CAPq0zEBd-cPEMM5bRXhv_2rOe9TSabJ%2B6%2B-%3DN8DfbZpmr%2BqMSg%40mail.gmail.com.
