openhab-addons: [influxdb] FieldTypeConflictException: "..." is type integer, already exists as type float

As part of migrating to OH3 Iโ€™ve added my influxdb persistence. For some reason, Iโ€™m now getting this error. I get this across multiple items, not just the one below. I could just purge these values from the database and let it create new as a workaround, but Iโ€™d rather not lose the historical data. Not sure why itโ€™s writing as an integer now and not a float as before.

2020-11-14 20:32:37.956 [ERROR] [org.influxdb.impl.BatchProcessor    ] - Batch could not be sent. Data will be lost
org.influxdb.InfluxDBException$FieldTypeConflictException: partial write: field type conflict: input field "value" on measurement "ZWave_DownstairsHallwayMotionSensor_BinarySensor" is type integer, already exists as type float dropped=1
        at org.influxdb.InfluxDBException.buildExceptionFromErrorMessage(InfluxDBException.java:144) ~[bundleFile:?]
        at org.influxdb.InfluxDBException.buildExceptionForErrorState(InfluxDBException.java:173) ~[bundleFile:?]
        at org.influxdb.impl.InfluxDBImpl.execute(InfluxDBImpl.java:827) ~[bundleFile:?]
        at org.influxdb.impl.InfluxDBImpl.write(InfluxDBImpl.java:460) ~[bundleFile:?]
        at org.influxdb.impl.OneShotBatchWriter.write(OneShotBatchWriter.java:22) ~[bundleFile:?]
        at org.influxdb.impl.BatchProcessor.write(BatchProcessor.java:340) [bundleFile:?]
        at org.influxdb.impl.BatchProcessor$1.run(BatchProcessor.java:287) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 29 (13 by maintainers)

Most upvoted comments

On one of my OH instances I also ran into this issue with some Switch items. So I wrote a little Bash script to fix it for several items to prevent errors and tedious work ๐Ÿ˜‰ :

#!/bin/bash

MEASUREMENTS=$(cat << EOF
Room1_Motion
Room2_Motion
Room3_Motion
EOF
)

command="SELECT value::integer INTO temp FROM measurement; DROP MEASUREMENT measurement; SELECT value::integer INTO measurement FROM temp; DROP MEASUREMENT temp;"

for m in $MEASUREMENTS; do
	echo "Updating $m..."
	influx -database 'openhab' -execute "$(sed "s#measurement#$m#g" <<< $command)"
done

Just replace Room1_Motion etc. with your own items that have this issue. Make sure you have a backup in case something goes wrong. ๐Ÿ’พ

I must admit, I encountered the same problem and worked around it, instead of raising an issue. I changed the type of my historic data to integer by storing it to a temporary measurement:

select value::integer into Flur_Bell_Lock2 from Flur_Bell_Lock
drop measurement Flur_Bell_Lock
select value::integer into Flur_Bell_Lock from Flur_Bell_Lock2

have somebody wrote a script to do this automatic for all items?

Iโ€™m also experiencing this issue after upgrading from openHAB 2.5.10 to openHAB 3.0 M2. Iโ€™ve also started converting from float to integer where needed:

select * into Hue_MotionSensor1_Presence_backup from Hue_MotionSensor1_Presence group by item
select time, item, value::integer into Hue_MotionSensor1_Presence_tmp from Hue_MotionSensor1_Presence group by item
drop measurement Hue_MotionSensor1_Presence
select * into Hue_MotionSensor1_Presence from Hue_MotionSensor1_Presence_tmp group by item
drop measurement Hue_MotionSensor1_Presence_tmp

and that seems to work fine.

I used this command for every thing that showed errors. there was many of them but now it is ok.

select value::integer into temp from Flur_Bell_Lock
drop measurement Flur_Bell_Lock
select value::integer into Flur_Bell_Lock from temp
dropmeasurement temp

Indeed deleting is only from the CLI

On one of my OH instances I also ran into this issue with some Switch items. So I wrote a little Bash script to fix it for several items to prevent errors and tedious work ๐Ÿ˜‰ :

#!/bin/bash

MEASUREMENTS=$(cat << EOF
Room1_Motion
Room2_Motion
Room3_Motion
EOF
)

command="SELECT value::integer INTO temp FROM measurement; DROP MEASUREMENT measurement; SELECT value::integer INTO measurement FROM temp; DROP MEASUREMENT temp;"

for m in $MEASUREMENTS; do
	echo "Updating $m..."
	influx -database 'openhab' -execute "$(sed "s#measurement#$m#g" <<< $command)"
done

Just replace Room1_Motion etc. with your own items that have this issue. Make sure you have a backup in case something goes wrong. ๐Ÿ’พ

So far so good ๐Ÿ˜ƒ But tell please for beginner where you write this? In which file? influxdb.persist?

I am facing this issue too. It seems the item switches and contacts are stored as float in OH2.5.x and integer in OH3.0.0Mx. I have to convert the items back and forth every time I go from one version to the other of OH.