Thank you Michael and Karen for your responses. I have tried both options, unfortunately niether gave me exactly what I was looking for, however they helped to point me in the right direction. I have found a solution outside WeeWX with which I can manipulate the data before I then use the weewx-filepile extension to inject the data into my extended database. The end result can be seen on my web page shows the current state and whether power is incoming (grid and/or solar), whether battery is discharging or charging, or power exporting to grid.
You can see the resulting module and linked chart on my web page https://claydonsweather.org.uk. The chart is rather sparse at the moment due to limited amount of data I have at the moment. Thanks Ian On Thursday, November 14, 2024 at 9:08:46 AM UTC Karen K wrote: > I would recommend against changing the sign of the readings. > > And I would try this (not tested): > > #set $data = $year.gridProduction.series(aggregate_type='min', > aggregate_interval=86400, time_series='start', > time_unit='unix_epoch_ms').round(0).json > #set $data = [ [i,-j] for i,j in $data ] > > > michael.k...@gmx.at schrieb am Donnerstag, 14. November 2024 um 06:45:22 > UTC+1: > >> >> The problem is - imho - that the observation type is not recorded >> correctly in the first place. Purchased energy is different from produced >> energy is different from supplied energy is different from directly >> consumed energy, etc., so supplied energy to the grid isn't just the same >> as purchased energy from the grid, just with a negative sign. To display >> the values in a comprehensive way, the straightforward way would be to >> record the data in that way. So supplied energy (gridProduction as you call >> it) should be a positive value, when recorded. My power meter at the >> metering point gives positive values for this observation type. >> >> https://weewx.com/docs/5.1/reference/weewx-options/stdcalibrate/ >> >> [StdCalibrate] [[Corrections]] gridProduction = -gridProduction >> >> Keep in mind you have to migrate existing data in the database and >> recalculate daily summaries for this obs_type, if you do it that way. >> Steeple Ian schrieb am Mittwoch, 13. November 2024 um 22:52:04 UTC+1: >> >>> I am using the following in a .tmpl file to generate series data for a >>> Highcharts chart: - >>> >>> $year.gridProduction.series(aggregate_type='min', >>> aggregate_interval=86400, time_series='start', >>> time_unit='unix_epoch_ms').round(0).json >>> >>> This series produces either 0 or negative numbers, something like this >>> extract: - >>> >>> [[1731024000000, 0], [1731110400000, -107], [1731196800000, -407], >>> [1731283200000, -341]] >>> >>> Is there any straightforward way of converting the negative values to >>> absolute numbers? >>> >>> The context is solar generated power. When the grid values are negative, >>> solar generated power is being exported to the grid. >>> >>> Thank you >>> >> -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/weewx-user/b8ef1a09-8b34-4917-b353-fe1edfd114abn%40googlegroups.com.