Hi,
I want to create a function with multiple inputs and multiple outputs.
I use 2 illumination sensors and I want to specify my multiple outputs.
Here ist my code
So, If the illumination sensor voga is between a 700 and 40000 output one shoud send the string "hell".
If the illumination is above 40000 output one should send the string "sonnig".
The same should happen on output two, so I have different output for different areas. But I always receive an error: "ReferenceError: msg1 is not defined (line 33, col 9)"
That looks like the output from a Debug node rather than an error.
It is certainly possible, with your current code, that neither msg1 or msg2 will have their payload set, so it will be undefined.
It all depends on what behaviour you want. For example, if a message's payload has not been set by any of your if statements, should it return anything at all?
Yes, the illumination sensors will always send values. When this value is between a specific range then I will set "Hell" or "Sonnig" so it is easier to control my covers. I know I can do that with switches but I want to learn how to input multiple values and send them to multiple outputs.
Maybe you have a simple example how to solve this. The docs always explain how to use multiple inputs OR multiple outputs but not both together.
I hope you understand what I mean, english is a foreign language for me
Hi Colin,
you are absolutely right. That is the mistake. While I was opening my threat, the value was below 750 so undefined. Very embarrasing. Maybe you can help me to do nothing when the value is below 750.