Gate - cflurin/node-red-contrib-dsm GitHub Wiki
This is a simple gate
, it can be set programmatically to true or false to block or pass messages.
The globalOutput
is also set, just delete it if you don't need it.
Configuration
{
"currentState": false,
"globalOutput": "gate",
"methods": {
"setGate": "sm.currentState = msg.payload; output = false;",
"default": "output = sm.currentState;",
"status": {
"fill": {
"get": "sm.currentState ? 'green' : 'grey';"
},
"shape": "dot",
"text": {
"get": "sm.currentState;"
}
}
}
}
Flow
[{"id":"13a53710.b3ec29","type":"inject","z":"895bbff8.0e6c4","name":"","topic":"setGate","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":490,"y":2560,"wires":["ea5fc0a8.c58a8"](/cflurin/node-red-contrib-dsm/wiki/"ea5fc0a8.c58a8")},{"id":"5afa1ffb.17136","type":"inject","z":"895bbff8.0e6c4","name":"","topic":"setGate","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":490,"y":2600,"wires":["ea5fc0a8.c58a8"](/cflurin/node-red-contrib-dsm/wiki/"ea5fc0a8.c58a8")},{"id":"1e5d66f2.767f69","type":"inject","z":"895bbff8.0e6c4","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":490,"y":2640,"wires":["ea5fc0a8.c58a8"](/cflurin/node-red-contrib-dsm/wiki/"ea5fc0a8.c58a8")},{"id":"13da89.c892c577","type":"debug","z":"895bbff8.0e6c4","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","x":790,"y":2600,"wires":[]},{"id":"ea5fc0a8.c58a8","type":"dsm","z":"895bbff8.0e6c4","name":"gate","sm_config":"{\n \"currentState\": false,\n \"globalOutput\": \"gate\",\n \"methods\": {\n \"setGate\": \"sm.currentState = msg.payload; output = false;\",\n \"default\": \"output = sm.currentState;\",\n \"status\": {\n \"fill\": {\n \"get\": \"sm.currentState ? 'green' : 'grey';\"\n },\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"sm.currentState;\"\n }\n }\n }\n}","x":650,"y":2600,"wires":["13da89.c892c577"](/cflurin/node-red-contrib-dsm/wiki/"13da89.c892c577")}]