Guest User

HAP.red sample flow

a guest
Oct 31st, 2015
120
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [{"id":"e896ab63.176958","type":"switch","name":"","controlId":"test","x":350,"y":205,"z":"32ce0c7a.cd31f4","wires":[["f9efab39.061058"]]},{"id":"f9efab39.061058","type":"function","name":"invert","func":"msg.payload = !msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":303,"y":320,"z":"32ce0c7a.cd31f4","wires":[["fdbe7392.02419"]]},{"id":"fdbe7392.02419","type":"delay","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":444,"y":318,"z":"32ce0c7a.cd31f4","wires":[["e896ab63.176958","2bebb405.d4144c"]]},{"id":"c6714c5.f398eb","type":"slider","name":"","controlId":"slider1","x":457,"y":443,"z":"32ce0c7a.cd31f4","wires":[["a3b991b4.5c467"]]},{"id":"6e047af2.91fb84","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"1.5","crontab":"","once":false,"x":244,"y":557,"z":"32ce0c7a.cd31f4","wires":[["a3b991b4.5c467"]]},{"id":"a3b991b4.5c467","type":"function","name":"increment","func":"if (typeof context.value === \"undefined\")\n    context.value = 0;\nif (typeof msg.payload === 'number')    \n    context.value = msg.payload;\n    \nmsg.payload = context.value;\ncontext.value = (context.value + 1) % 11;\n\nreturn msg;","outputs":1,"noerr":0,"x":458,"y":560,"z":"32ce0c7a.cd31f4","wires":[["c6714c5.f398eb"]]},{"id":"bf07c99a.40f838","type":"toast","name":"","sendTo":"all","x":712,"y":363,"z":"32ce0c7a.cd31f4","wires":[]},{"id":"2bebb405.d4144c","type":"template","name":"message","field":"payload","format":"handlebars","template":"Set switch to {{payload}}!","x":564,"y":364,"z":"32ce0c7a.cd31f4","wires":[["bf07c99a.40f838"]]}]
RAW Paste Data