I convert it to a JS Object with the JSON node then inject it to an InfluxDB. That works.
In the MQTT data above, the keys IO and IO2 are each a BYTE where each bit is a binary value which I wish to decode as separate binary values in InlfuxDB, using the math() function and the BINARY AND operator. That part does not work.
After some research it turns out that InfluxDB converts by default the IO and IO2 variables to FLOAT. I guess I need an integer type instead.
I read somewhere that I must append an "i" at the end of the value in order to tell InfluxDB that we want a INTEGER type. And that is where I am stuck. Not sure how to do this on the JS object I have prior to injecting it to InfluxDB node. Does that mean I need to to convert the values to STRING then append an "i" at the end?
In the end I went around my problem by decoding the bitmaps in a NodeRed function and creating new KEYs for each decoded bit prior to feeding the JS object to Influx.
Thx dceejay,
I saw that node but I assumed that using it would have meant extra steps such as isolating the bitmaps from my JS object, feeding them to the binary node, then merging them back into the JS object prior to feeding the whole lot to Influx, so I went for the Function node approach.
If you set the MQTT node Output field to Parsed JSON object then it will parse the JSON for you so you don't need the JSON node
You shouldn't need the parseInt, IO is already a number not a string.
The binary decode is a bit neater, I think, if written as