I'm trying to read data from a BH1750 i2c light intensity sensor. There is no node-red node for it, so I'm using a node.js module and trying to access it from within a function node in node-red. However anything that is in a function() code seems not to be executed. I used one function node to initialise the module
var BH1750 = global.get('BH1750');
var ls1 = new BH1750();
flow.set('ls1', ls1)
return msg;
and another one, from an example to read the value:
I'd also suggest you add some node.warn("hello"); type statements within the callback so you can see what is happening - those warn messages will appear in the debug sidebar.
Hi max95, I hope you found the way to reach your goal. Would you mind to provide the solution that worked for you? Any help even little is appreciated. Thank you!