Cost changes with time, but not hourly - once a month once the cheaper power is used up it goes to a higher rate. I already record the cost, but not the kWh rate in the database with the driver capturing loop data.
One possible workaround is to request the current kWh rate from the meter during execution of the genArchiveRecords method at the time of trying to catch up on missed records. Another is to grab the last record from the database as part of the genArchiveRecords execution. I am just trying to understand my options. I note your suggestions below. No one has said that I can't read the last database record from the driver - I just need to know if it is a doable option, or if there is a fundamental reason not to do it. On Monday, 25 March 2019 09:15:23 UTC-7, mwall wrote: > > On Monday, March 25, 2019 at 11:41:13 AM UTC-4, Louis De Lange wrote: >> >> I am thinking about some workarounds for the genArchiveRecords() >> methods. Since the historical data request does not contain the cost data >> it would be useful to be able to pull the cost from the last record in the >> database and use that when making up the historical data - not perfect but >> better than empty fields. >> >>> > if your cost is a simple multiplier that does not change with time, then > why would you record it in the database? > > why not record *only* the power data > > then apply and costs or other transformations in the reports or at the > display level? > > if you *do* need to record costs that change with time, record them in a > separate database, then combine at the report/display time > > or make a weewx driver that pulls spot prices for power :) > >
