Browse Source

Added new Function

master
unixweb 11 months ago
parent
commit
7f4bf7ca7e
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      toogle.js

+ 17
- 0
toogle.js View File

@ -0,0 +1,17 @@
/*
if we receive a true we toogle output
and store the new state in a local context
with a unique name
*/
var fname = "toggle1";
if(msg.payload === true){
if(context.get(fname) === false){
msg.payload = true;
}else{
msg.payload = false;
}
context.set(fname, msg.payload);
}
return msg;

Loading…
Cancel
Save