If an observation type never gets reset to zero, you have two choices.
1. Save the value. If you want to know daily use, take the difference of
the value.
2. Save the difference. That is, the change in the value over an archive
period. If you want to know daily use, you would sum all the small deltas.
This is like rain

See the discussion *Accumulated vs delta energy
<https://github.com/tkeffer/weewx-brultech?tab=readme-ov-file#accumulated-vs-delta-energy>*
in
the README of the Brultech driver for the pros and cons of the two
approaches.

It is not necessary to save "dayRain". WeeWX mostly uses "rain". Besides,
as you note, it can always be calculated.



On Fri, Jan 26, 2024 at 7:06 AM Remy Lavabre <remy.lava...@gmail.com> wrote:

> And one more question....
> Is it absolutely necessary to create a "dayRain" field in addition to the
> "rain" field in the weewx.sdb database?
> If the database only contains the [rain] field but the Weewx driver
> returns a "dayRain" field (cumulative rain over 24 hours since midnight)
> with a real value in each packetloop, the class [[Delta]] [[ [rain]]] input
> = dayRain will it work??
> (the accumulation of rain since midnight is useless to me in a database
> field since it is easily calculated)
> Sorry for all the questions...and thanks again! ;-)
>
> Le vendredi 26 janvier 2024 à 15:46:04 UTC+1, Remy Lavabre a écrit :
>
>> Hello Tom and thank you for your response.
>>
>>      [StdWXCalculate]
>>          [[Calculations]]
>>              ...
>>          [[Delta]]
>>              [[[rain]]]
>>                  input = dayRain
>>
>> This will calculate the rain difference between two records in weewx sql
>> based on the principle that the counter is reset to zero at midnight ->
>> PERFECT FOR THE RAIN 24H !
>>
>> Small additional question: if we wish to constantly calculate the
>> difference between two records values of a meter which *never* resets to
>> zero (such as an electricity or water meter), how should we proceed?
>>
>> THANKS
>>
>> Le jeudi 18 janvier 2024 à 14:05:10 UTC+1, Tom Keffer a écrit :
>>
>>> Unfortunately (for you), WeeWX mostly uses observation type "rain", the
>>> amount of rain that fell since the last loop packet (what you are calling
>>> "instantaneous rain").
>>>
>>> You should assign the rain since midnight to type "dayRain".
>>>
>>> Then calculate "rain" as the difference between successive
>>> "dayRain" values. While this is a pretty simple calculation, there is an
>>> xtype that can do it for you.  See class Delta in weewx.wxxtypes
>>> <https://github.com/weewx/weewx/blob/master/src/weewx/wxxtypes.py#L586>.
>>> To use it, add this to weewx.conf:
>>>
>>>     [StdWXCalculate]
>>>         [[Calculations]]
>>>             ...
>>>         [[Delta]]
>>>             [[[rain]]]
>>>                 input = dayRain
>>>
>>>
>>>
>>>
>>> On Wed, Jan 17, 2024 at 11:47 PM Remy Lavabre <remy.l...@gmail.com>
>>> wrote:
>>>
>>>> Good morning,
>>>>
>>>> I created a [driver] for weewx to retrieve data from the Awekas API (my
>>>> Bresser weather station does not have a USB port).
>>>>
>>>> This works but regarding the rain, it is not the instantaneous rain
>>>> (from a packetloop) that we recover but the rain over 24 hours since
>>>> midnight.
>>>> Is there a "simple" way to tell WeeWX that the packetsloop rain data
>>>> corresponds to the cumulative rain since midnight and not the rain that
>>>> fell during the data retrieval interval (the time gap between two
>>>> packetsloops) ?
>>>>
>>>> Thank you so much...
>>>>
>>>> --
>>>> 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+...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/weewx-user/9887101f-fcc1-45ce-948e-e03429bf7baan%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/weewx-user/9887101f-fcc1-45ce-948e-e03429bf7baan%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
> 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 on the web visit
> https://groups.google.com/d/msgid/weewx-user/796eb84f-ad09-41bf-ad90-202ad6f05773n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/796eb84f-ad09-41bf-ad90-202ad6f05773n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEAvE4%2BRLHNki2nnzUMMFd%2Bh8uOoiB4HygnR%2BmVB6eJt8Q%40mail.gmail.com.

Reply via email to