This paste brought to you by Pastebin. View Raw

  1. var chk_state;
  2. if (msg.payload[0] =="on" && msg.payload[1] =="on"  && msg.payload[2] =="on") {
  3.     chk_state = "on"
  4. }
  5. else {
  6.     chk_state ="off"
  7. }
  8. msg.payload = chk_state;
  9. return msg;