This problem is driving me “nuts”. I really hope that someone can point out my mistake.
I’m trying to persist the amount of water my water meter counts. The number of liters is send every 60 seconds via MQTT. The amount is an absolute value. So the counter resets after every MQTT message.
I verified that the correct number of liters arrives in OH3 and is stored in the “Watermeter_Vebruik” item.
This item is persisted in RRD4J using the following configuration:
The problem is that the value persisted to the database is 1/20 of the value in the item. So when the item is updated with the value 2 the persisted value in the database is 0.1 . This is also the value that shows up in the graphs.
What am I missing here?
I guess the first question is why did you change the RRD4J configs? Most users usually and should leave those alone unless they really know what they are doing. RRD4J is fiddly and getting everything just right can be a challenge.
Does your Item have a Unit of Measurment?
What is your persistence strategy?
The default RRD4J config uses GAUGE as datasource type. The RRD4J documentation explains that ABSOLUTE should be used for resetting counters.
UoM is “l” (liter)
I’m using the default persistence strategy
That’s the specific unit but the UoM would be Volume. But just to make sure, how is the Item defined.
First the ability of any of the databases to handle UoM is a little iffy right now. And the value stored by the Item might be different from the value you see if you’ve overridden the default units in your display. If you have a label or state description of
%.1f l it will show the state of the Item in liters, even if the actual Item is storing gallons or kiloliters or some other unit. The database will only save what the Item is actually storing and doesn’t know anything about the label.
So what is the actual state of the Item? What do you see in events.log when the Item changes? What do you see if you remove the state formatting from the Item?
I have no label configured. Ik wou love to send you the configuration of the item but I’m still trying to get the hang of the new OH3 interface. I couldn’t immediately find a “code” description on the items page.
The value shows up in the logs as a value measured in liters. So there seems to be no conversion error.
Furthermore the numbers are correctly (as liters) persisted when I select the COUNTER or GAUGE options in RRD4J.
It’s the one place where there isn’t a code view yet. But knowing the type and whether the State Description metadata is defined and if so what it’s defined as is sufficient.
I changed the remote sensor to a non resetting counter so that I can use the COUNTER type in RRD4J. Now every value (delta between readings) is being being saved without issues. It seems to me that there is a problem with the ABSOLUTE type. Either in the RRD4J implementation or in the way that OH send data to the database.
I’m quite willing to provide further testing should anyone be interested to look into this any further.
That sounds as if the"default_other" datasource is/was actually used ( which uses a stepsize of 5 seconds).