Hello - I have had a problem for some time now with one particular measurement. I wish to persists volt meter readings, but am getting the following error:
2023-05-07 21:16:50.424 [ERROR] [com.influxdb.client.write.events.WriteErrorEvent ] - The error occurred during writing of data
com.influxdb.exceptions.UnprocessableEntityException: failure writing points to database: partial write: field type conflict: input field "value" on measurement "VoltMeter" is type string, already exists as type float dropped=1
I have checked and the only item being written to this measurement has the following definition:
Number:ElectricPotential EmonCMSVrms "EmonCMS Vrms [%d V]" (VoltMeter) {channel="http:url:105679ca48:EmonCMSVrms", influxdb="VoltMeter"}
Any thoughts why this error is appearing? I have dropped the measurement completely and confirmed it is gone. However as soon as the first value is written, the error re-appears. Nothing else is writing to this measurement.
What is interesting is the value is still written to the measurement.
Thank you
Ok so since dropping the measurement and getting some clarity (there is a lot of old data in my InfluxDB), it looks like both the EmonCMSVrms item is being persisted, as well as the group VoltMeter… presumably the VoltMeter entry is being persisted as a string (or trying to)…
My persistence config is as follows:
Strategies {
every10Seconds : "*/10 * * * * ?"
default = everyChange
}
Items {
* : strategy = every10Seconds, everyChange, restoreOnStartup
}
Reading the doco here: Persistence | openHAB, I don’t think the group should be persisted? Can anyone shed any light?
That persist all the groups and items it’s a wildcard. To me most of the time this happened was when I was testing and changed from string to number.
Hmm ok. Thank you.
Does anyone have any suggestions on how I can persist all item states except groups, without simply creating a group for persistence and individually adding all items to it?
Fixed it.
It occurred to me this morning that I have many groups made of Number
types which do not present similar persistence errors. I checked the value of the VoltMeter
group and found it was a decimal number (presumably expressed as a string), but all of my other groups were NULL
value. I set the value of the VoltMeter
group item to NULL
using VoltMeter.postUpdate(NULL)
in one of my rules which is triggered every few seconds, and the issue immediately stopped.
Problem solved and I don’t need to update my persistence configuration
.