Influxdb 2.0 Error Data Type

Hi, I'm using node-red-contrib-influxdb (0.5.0) to pipe data into an Influxdb V2.
After the updateto V2 I'm facing the following error:

Error: 500 Internal Server Error : {"code":"internal error","message":"unexpected error writing points to database: partial write: field type conflict: input field "ITE06_H" on measurement "ITE06" is type integer, already exists as type float dropped=1"}

It seems to be a problem with the datatype. If i.e. the temperature value is 20 it's an integer, 20.1 a float. But the table only supports one type.
Is there a way to convert numbers befor sending them to influxdb?

This error occures after updating node-red-contrib-influxdb to 0.5.0 and influxdb to V2.

Thank you very much for any advise!
Martin

You could always use a parseInt() or round() on the number

Changing/rounding to integer is easy. I'm trying to write temperature to Influx 1.8 and have exactly the same issue. 20 degrees set the field as integer, 20.1 as float. I would like to preserve decimal to have more precision.
I've tried to use .toFixed(2) but that change the type to string, which is not what I want.

So how to enforce float type even with values without decimal?
Thanks

I wonder whether this is a problem with the new version of the influx node. I have never had any problems like this with the previous versions.
In fact looking at https://github.com/mblackstock/node-red-contrib-influxdb/issues/49 it seems the previous version did not write integer types at all, so I suspect they have added that feature, with the result that now it is apparently possible to create field with integer type, and then you are stuck.
I see this problem has just been added as an issue, unless that issue has been submitted by someone here. https://github.com/mblackstock/node-red-contrib-influxdb/issues/71

Your second link should probably point to https://github.com/mblackstock/node-red-contrib-influxdb/issues/71
I've commented that issue for mode details.

I opened #71 and it was already fixed by owner.
Hopefully he'll release it in short time.

Correct, thanks for noticing that, have corrected my original post.

I you want to install it direct from the git repository you can go to your .node-red folder and run
npm install mblackstock/node-red-contrib-influxdb
and restart node-red.
When it has been released, or if you want to go back to the issued version go to that folder and run
npm remove node-red-contrib-influxdb
npm install node-red-contrib-influxdb
and restart node-red.

3 Likes

Thanks for reporting this, and sorry for the trouble.

I did a quick release to add support for integer values using strings as mentioned in the issue comments. To write an integer 10, use a string with an 'i' suffix: '10i', to write a float 10.0 use a number: 10 or 10.0.

I plan to update the docs and add some more tests soon. Let me know if you see any other problems by raising an issue on github.

1 Like

Thanks for the work on this node, I was wondering recently whether I should contemplate migrating to v2, now at least it should not be problematic at the node-red end.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.