I tried to set both flow and global variables and I don't think I properly understand how they function. For example, I have a flow that sets a global variable global.GlobalTherm.Temp. When I inject the global variable into a debug using:
[{"id":"120c2b43.843be5","type":"debug","z":"30882327.2d261c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":440,"y":520,"wires":[]}]
I get { Temp: 65 }
which means it's clearly getting stored. However, whenever I try to do anything with that variable, I get a type error. For example:
[{"id":"69b204b.37764fc","type":"function","z":"30882327.2d261c","name":"convert to f","func":"global.GlobalTherm.Diff = global.GlobalTherm.Temp-10\nreturn global;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":720,"wires":[["5f0f5493.5ed0ac"]]}]
yields: "TypeError: Cannot read property 'Temp' of undefined".
I think I'm just confused about how node red uses global variables, etc. Can someone explain what exactly I'm doing wrong?