Check multiple conditions

Hi Darren

My first question is how is the status of the door/window delivered to NR and how often?

Next, from your write up it is unclear if you are checking ALL the doors and windows at the same time, or if you want to check a single door or window at a time, or if there is a time interval wher you want to check the status of them all.

Changing the state of a window is easy and you can do it with a switch and two change nodes or a function node. If you never want to check for other cases, the function node could be three lines:

if (msg.payload == 'on') msg.payload = 'Open'
else msg.payload = 'Closed';
return msg;

However, why not just use 1 (open/unlocked) and 0(closed/locked) as a status for both doors and windows and then pick what to show when you display the results.

If you want to check all the doors and windows storing them in an array with the 1/0, you could just sum up the value of the status (the 1 or 0's) and if the result is 0 everything is closed/locked otherwise something is open or unlocked.