this is a beginner question for a node-red beginner as I am
What I'm trying to archieve is a flow in which my radiators turning down as the window get's opened. So I'm filtering my DeConz events on that binary window sensor. If the status changes, the flow gets the current state of the heating vave / the temperature setting of it. This is here in the message object:
So I thought I need a function node which reads this setting, stores it and then reduces the setting to e.g. 12°C. And if the window gets closed again, it restores the previous setting. So I think the scope of my variable has to be flow-wide.
I started to write the following function:
var tempsetprev=data.attributes.temperature; //Hole aktuell eingestellte Temperatur flow.set('tempsetprev',temsetprev); msg.payload = tempsetprev; return msg;
But I get: "ReferenceError: data is not defined (line 1, col 17)"
Can you help me where I'm wrong?