tldr:
Try the following.
Remove the contains_total and if the [Accumulator] section does not exist,
add the following. If it exists, just add the [[kwh]] subsection. Note
that [Accumulator] is a ‘ top level’ section.
[Accumulator]
[[kwh]]
extractor = sum
Background:
When running as a service, MQTTSubscribe has no control over the arrival of
the MQTT data nor the loop interval. It leverages WeeWX accumulator
functionality to manage when multiple MQTT payloads have arrived since the
last loop packet generation. The default accumulator extractor is average,
the configuration setting above will override this, setting it to sum.
The idea is to treat the loop packet like a ‘mini archive’. I haven’t fully
vetted this, so I will be very interested in how it goes.
rich
ps. I think you should be able to remove the conversion_type because the
default is float.
rich
On Saturday, 17 October 2020 at 08:06:08 UTC-4 [email protected] wrote:
>
> I use contains_total=true but I get the average of the values obtained. I
> need the sum.
>
> The log:
>
> Oct 17 13:58:58 rpi weewx[522]: (Service) user.MQTTSubscribe: TopicManager
> data-> outgoing ESP_Energy_Meter_01/kwh: dateTime: 1602935896.48, kwh:
> 0.001, usUnits: 17
> Oct 17 13:58:58 rpi weewx[522]: (Service) user.MQTTSubscribe: TopicManager
> data-> outgoing ESP_Energy_Meter_01/kwh: dateTime: 1602935913.83, kwh:
> 0.003, usUnits: 17
> Oct 17 13:58:58 rpi weewx[522]: (Service) user.MQTTSubscribe: TopicManager
> data-> outgoing ESP_Energy_Meter_01/kwh: dateTime: 1602935931.37, kwh:
> 0.026, usUnits: 17
> Oct 17 13:58:58 rpi weewx[522]: (Service) user.MQTTSubscribe: TopicManager
> data-> outgoing accumulated ESP_Energy_Meter_01/kwh: dateTime:
> 1602935934.0, kwh: 0.01, usUnits: 16
> Here there are 3 values 0.001, 0.003 and 0.026. I get 0.01 which is the
> average. I need the sum of the three 0.001+0.003`0.0026 which is 0.03.
> The conf:
> [MQTTSubscribeService]
> enable = true
> console = True
> payload_type = json
> host = 192.168.1.3
> port = 1883
> keepalive = 60
> binding = loop
> [[message_callback]]
> type = individual
> [[topics]]
> unit_system = METRICWX
> use_topic_as_fieldname = true
> [[[esp/ds18b20/radiation]]]
> name = radiation
> [[[esp/ds18b20/extraTemp1]]]
> name = extraTemp1
> [[[ESP_Energy_Meter_01/watt]]]
> name = watt
> [[[ESP_Energy_Meter_01/kwh]]]
> contains_total = True
> conversion_type = float
> name = kwh
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/c881924f-4e2a-44df-9b98-6d511ed2c824n%40googlegroups.com.