I have a very simple function but for some reason it is not working as I expected... I've attached a screenshot of the function. Via Debug messages, I've confirmed global.Rain is true and msg.payload.value = "on" but the function only returns null. What am I missing?
One thing is that when looking for true/false you should use "===", small thing but.....
Do some troubleshooting with node.warn(variable). E.g:
Add the line node.warn(global) as well as node.warn(global.Rain) in the very beginning of your code (before the if statement). Most likely you will get something different from what you expect.
If you stored the variable "Rain" in the global context you should recover it with global.get("Rain") instead of global.Rain.
@Andrei ... I was using the same var name I used in the other nodes and forgot I needed to change with the function. Great catch, thanks.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.