You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to node-red/node-red#714 (comment), the original msg object needs to be modified and sent back for it to work. Not sure if this is the best fix (using .once() in the input event handler), but I got beanTemp.js working properly like this:
// respond to inputs....this.on('input',function(msg){if(this.beanConfig&&this.beanConfig.device){this.beanConfig.device.once('temp',function(temp,valid){msg.topic="temp";msg.payload=(temp);this.send(msg);}.bind(this));this.beanConfig.requestTemp();}else{this.error('Bean not connected');this.send(msg);}});// this.beanConfig.on("connected", function() {// this.beanConfig.device.on('temp', tempDataReceived);// }.bind(this));
According to node-red/node-red#714 (comment), the original
msg
object needs to be modified and sent back for it to work. Not sure if this is the best fix (using.once()
in theinput
event handler), but I got beanTemp.js working properly like this:At first I tried a persistent
msg
variable in the closure thattempDataReceived
could access, but that could lead to race conditions I think. Seehttps://node-red.slack.com/archives/general/p1476118415001635
The text was updated successfully, but these errors were encountered: