Is there a range limit for node-red-contrib-i2c 'i2c out' node?

Is there a range limit for node-red-contrib-i2c 'i2c out' node payload value? Looking at the NR module node code I don't any defined limit for a single byte value to be defined as signed? It should be unsigned 0-255. for example, using a tsl2591 sensor, to fully power up the sensor, you have to send a byte value of 147. However, this generates the following error:

"RangeError: The value of "value" is out of range. It must be >= -128 and <= 127. Received 147"

This appears to be a limitation from the underlying node module 'i2c-bus' right?

1 Like

I don't know the answer to the question but if you need a workaround you can use
msg.payload = msg.payload > 127 ? msg.payload - 256 : msg.payload

Some time ago, I opened an issue Signed integer only as payload for IĀ²C out node? #26 at the GitHub repository and suggested the same temporary workaround.

As of today, the issue remains unanswered.

It seems that Dceejay is the new maintainer of the node.

Thanks for the work around. Will try it of course. I contacted the code maintainer of i2c-bus library and he believes this is within the NR node, not the base library, and I walked most of the code of the i2c-bus base library, and did not find any comparable limit either.

Currently on vacation, but Pull requests can still be submitted

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