Advertisement
Grandwhazoo

Node Red test

Jul 16th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [{"id":"7bff287.b5c1ad8","type":"tab","label":"Lights","disabled":false,"info":""},{"id":"26d8ba7c.3ba106","type":"mqtt in","z":"7bff287.b5c1ad8","name":"Volts","topic":"C_AD4D","qos":"2","datatype":"auto","broker":"a9cb58b5.4afb28","x":240,"y":200,"wires":[["db396a3.85c7098","a3145345.218a5"]]},{"id":"4fd7ed2d.c64794","type":"mqtt out","z":"7bff287.b5c1ad8","name":"led","topic":"led","qos":"","retain":"","broker":"182e5dba.c86072","x":730,"y":340,"wires":[]},{"id":"db396a3.85c7098","type":"ui_text_input","z":"7bff287.b5c1ad8","name":"","label":"Volts","tooltip":"","group":"d7a4d76b.2fda78","order":4,"width":"3","height":"1","passthru":true,"mode":"text","delay":300,"topic":"","x":470,"y":200,"wires":[[]]},{"id":"62d7daa6.d1f9a4","type":"ui_switch","z":"7bff287.b5c1ad8","name":"","label":"Kitchen Light","tooltip":"","group":"b5d51fa1.e6c51","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":270,"y":340,"wires":[["99750d73.297d2"]]},{"id":"a3145345.218a5","type":"file","z":"7bff287.b5c1ad8","name":"","filename":"rasp.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"ascii","x":480,"y":240,"wires":[[]]},{"id":"a04f9bb7.cdf1a8","type":"alexa-local","z":"7bff287.b5c1ad8","devicename":"Kitchen Light","inputtrigger":false,"x":90,"y":340,"wires":[["62d7daa6.d1f9a4"]]},{"id":"99750d73.297d2","type":"function","z":"7bff287.b5c1ad8","name":"convert on/off to 1/0","func":"\nif (msg.payload == \"on\") {\n  out={payload: \"1\"};\n} else if (msg.payload == \"off\") {\n  out={payload: \"0\"};\n} else {\n  out={payload: \"0\"};\n}\nreturn out;","outputs":1,"noerr":0,"x":500,"y":340,"wires":[["4fd7ed2d.c64794","2d4b8740.527478"]]},{"id":"393bf0a2.6f2d3","type":"rpi-gpio out","z":"7bff287.b5c1ad8","name":"PWM","pin":"11","set":"","level":"0","freq":"60","out":"pwm","x":730,"y":480,"wires":[]},{"id":"7b733143.f03c6","type":"ui_slider","z":"7bff287.b5c1ad8","name":"Brightness","label":"Brightness","tooltip":"","group":"d7a4d76b.2fda78","order":2,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":0,"max":"100","step":1,"x":130,"y":480,"wires":[["c5c88a19.bd3658"]]},{"id":"c5c88a19.bd3658","type":"alexa-local","z":"7bff287.b5c1ad8","devicename":"Pie Light","inputtrigger":true,"x":300,"y":480,"wires":[["10c400fc.d25c5f"]],"inputLabels":["bri"],"outputLabels":["bri"],"info":"var Msg = { payload : {\"data\": { \"brightness\": msg.payload}}}\nreturn newMsg;"},{"id":"10c400fc.d25c5f","type":"function","z":"7bff287.b5c1ad8","name":"convert on/off to 1/0","func":"\nif (msg.payload == \"on\") {\n  out={payload: msg.bri};\n} else if (msg.payload == \"off\") {\n  out={payload: \"0\"};\n} else {\n  out={payload: \"0\"};\n}\nreturn out;","outputs":1,"noerr":0,"x":500,"y":480,"wires":[["393bf0a2.6f2d3","7b733143.f03c6","497c7d70.50d2f4"]]},{"id":"180deb69.844755","type":"mqtt in","z":"7bff287.b5c1ad8","name":"Cnt","topic":"Cnt","qos":"2","datatype":"auto","broker":"182e5dba.c86072","x":230,"y":280,"wires":[["9ae75c81.c9998"]]},{"id":"9ae75c81.c9998","type":"ui_text_input","z":"7bff287.b5c1ad8","name":"","label":"Cnt","tooltip":"","group":"d7a4d76b.2fda78","order":4,"width":"3","height":"1","passthru":true,"mode":"text","delay":300,"topic":"","x":490,"y":280,"wires":[[]]},{"id":"c4d1d253.14cd1","type":"ui_slider","z":"7bff287.b5c1ad8","name":"Hall Light","label":"","tooltip":"","group":"afd75853.7d4558","order":2,"width":"3","height":"1","passthru":true,"outs":"all","topic":"H_PWM3","min":0,"max":"100","step":1,"x":120,"y":540,"wires":[["6e6c96f0.8793e8"]]},{"id":"6e6c96f0.8793e8","type":"alexa-local","z":"7bff287.b5c1ad8","devicename":"Hall Light","inputtrigger":true,"x":300,"y":600,"wires":[["a6c33219.55849","68c73528.728cbc"]],"inputLabels":["bri"],"outputLabels":["bri"],"info":"var Msg = { payload : {\"data\": { \"brightness\": msg.payload}}}\nreturn newMsg;"},{"id":"a6c33219.55849","type":"function","z":"7bff287.b5c1ad8","name":"convert on/off to 1/0","func":"msg.pin = 2;\nmsg.typ = 1;\nmsg.req = 1;\nmsg.topic = \"C\";\nmsg.dat = msg.bri;\nflow.set('stateC_PWM3',msg.payload);\nflow.set('valueC_PWM3',msg.bri);\nflow.set('msgC_PWM3',msg);\nif (msg.payload == \"on\") {\n  //out1 = {payload};\n  out2 =  {payload: \"on\"};\n  out3 = {payload: \"on\", topic:msg.topic, req:msg.req, pin:msg.pin, typ:msg.typ, dat:msg.dat};\n} else if (msg.payload == \"off\") {\n  //out1 = {payload};\n  out2 =  {payload: \"off\"};\n  out3 = {payload: \"off\", topic:msg.topic, req:msg.req,  pin:msg.pin, typ:msg.typ, dat:0};\n} else {\n  //out1 = {payload};\n  out2 =  {payload: \"on\"};\n  out3 = {payload: \"off\", topic:msg.topic,  req:msg.req, pin:msg.pin, typ:msg.typ, bri: 0};\n}\n\nreturn [msg , out2, out3];","outputs":3,"noerr":0,"x":500,"y":600,"wires":[["c4d1d253.14cd1","59c80f24.49bb3","2c651983.60a6f6"],["41504c77.e7a044"],["fac11db6.b95d6"]]},{"id":"2c651983.60a6f6","type":"mqtt out","z":"7bff287.b5c1ad8","name":"Hall Light","topic":"","qos":"1","retain":"true","broker":"182e5dba.c86072","x":780,"y":620,"wires":[]},{"id":"41504c77.e7a044","type":"ui_switch","z":"7bff287.b5c1ad8","name":"Hall Light","label":"Hall Light","tooltip":"","group":"afd75853.7d4558","order":1,"width":"3","height":"1","passthru":false,"decouple":"true","topic":"H_PWM3","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":120,"y":660,"wires":[["6e6c96f0.8793e8","96317bce.f86da8"]]},{"id":"59c80f24.49bb3","type":"debug","z":"7bff287.b5c1ad8","name":"hall msg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":780,"y":540,"wires":[]},{"id":"96317bce.f86da8","type":"debug","z":"7bff287.b5c1ad8","name":"hall switch msg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":320,"y":700,"wires":[]},{"id":"68c73528.728cbc","type":"debug","z":"7bff287.b5c1ad8","name":"alexa hall msg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":580,"y":700,"wires":[]},{"id":"af5cb360.f13c6","type":"comment","z":"7bff287.b5c1ad8","name":"Info","info":"a template for home automation system","x":450,"y":140,"wires":[]},{"id":"4cd90b40.8301d4","type":"function","z":"7bff287.b5c1ad8","name":"convert on/off to 1/0","func":"var out = flow.get('msgC_PWM3');\nreturn out;","outputs":1,"noerr":0,"x":440,"y":780,"wires":[["3879b97b.450856"]]},{"id":"3879b97b.450856","type":"debug","z":"7bff287.b5c1ad8","name":"stored msg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":780,"wires":[]},{"id":"a0140aea.185608","type":"mqtt in","z":"7bff287.b5c1ad8","name":"","topic":"C_PWM3_S","qos":"2","datatype":"auto","broker":"182e5dba.c86072","x":160,"y":780,"wires":[["4cd90b40.8301d4"]]},{"id":"fac11db6.b95d6","type":"debug","z":"7bff287.b5c1ad8","name":"hall short msg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":800,"y":680,"wires":[]},{"id":"2d4b8740.527478","type":"debug","z":"7bff287.b5c1ad8","name":"led","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":730,"y":280,"wires":[]},{"id":"497c7d70.50d2f4","type":"debug","z":"7bff287.b5c1ad8","name":"pi","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":730,"y":440,"wires":[]},{"id":"a9cb58b5.4afb28","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"182e5dba.c86072","type":"mqtt-broker","z":"","name":"Hall Light","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"2","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d7a4d76b.2fda78","type":"ui_group","z":"","name":"PI LED","tab":"62e59252.b603ac","order":1,"disp":false,"width":"6","collapse":false},{"id":"b5d51fa1.e6c51","type":"ui_group","z":"","name":"Kitchen","tab":"b1db41b5.4306b","disp":true,"width":"6","collapse":false},{"id":"afd75853.7d4558","type":"ui_group","z":"","name":"Hall Light","tab":"67ebb7d8.c6eec8","disp":true,"width":"6","collapse":false},{"id":"62e59252.b603ac","type":"ui_tab","z":"","name":"Living Room","icon":"dashboard","disabled":false,"hidden":false},{"id":"b1db41b5.4306b","type":"ui_tab","z":"","name":"Kitchen","icon":"dashboard","order":3,"disabled":false,"hidden":false},{"id":"67ebb7d8.c6eec8","type":"ui_tab","z":"","name":"Hallway","icon":"dashboard","disabled":false,"hidden":false}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement