Smart Brick - Button, RGB, RFTX

You need these Smart Brick:

  1. Button
  2. RGB
  3. RFTX

You can experiment with how to connect these bricks.

[{"id":"c255c307.d0413","type":"mqtt in","z":"1ce094f3.74b6fb","name":"button","topic":"borot/feeds/O3559752265","qos":"0","broker":"5fee3e12.eff6a","x":90,"y":63,"wires":[["6d2596fa.f06dd8","d9cc843a.61ef58"]]},{"id":"6d2596fa.f06dd8","type":"function","z":"1ce094f3.74b6fb","name":"AutomaONOFF","func":"var s = context.get('state')||\"OFF\"\nvar e = msg.payload;\n\nfunction nextstate(s) {\n    context.set('state',s); \n    switch (s) {\n        case \"OFF\" : node.status({fill:\"red\",shape:\"dot\",text:s});\n                     msg.payload=s;\n                     return msg;\n\n        case 'ON'  : node.status({fill:\"green\",shape:\"dot\",text:s});\n                     msg.payload=s;\n                     return msg;\n    }\n    return null;\n}\n\nif (e.startsWith(\"START\")) {msg.payload=\"XXX\";return msg;}\nswitch (s) {\n    \n    case \"OFF\" :\n        switch (e) {\n            case \"START\" : return nextstate(\"OFF\"); \n            case \"ON\" :    return nextstate(\"ON\"); \n        }\n        break;\n    case \"ON\" :\n        switch (e) {\n            case \"START\" : return nextstate(\"ON\"); \n            case \"ON\" : return nextstate(\"OFF\"); \n        }\n        break;\n}\nreturn null;\n\n\n","outputs":"3","noerr":0,"x":381,"y":67,"wires":[["f1297711.627e58","d539eab2.3d93a8","3353997e.772cf6","addeb9dc.a79e78","40913326.9a76cc"],[],[]]},{"id":"6563e196.1502f","type":"debug","z":"1ce094f3.74b6fb","name":"","active":false,"console":"false","complete":"payload.value","x":790,"y":1043,"wires":[]},{"id":"f1297711.627e58","type":"mqtt out","z":"1ce094f3.74b6fb","name":"RFTX","topic":"borot/feeds/I2495135839","qos":"","retain":"","broker":"5fee3e12.eff6a","x":865,"y":162,"wires":[]},{"id":"d539eab2.3d93a8","type":"mqtt out","z":"1ce094f3.74b6fb","name":"button","topic":"borot/feeds/I3559752265","qos":"","retain":"","broker":"5fee3e12.eff6a","x":853,"y":66,"wires":[]},{"id":"3353997e.772cf6","type":"mqtt out","z":"1ce094f3.74b6fb","name":"RGB","topic":"borot/feeds/I3330588877","qos":"","retain":"","broker":"5fee3e12.eff6a","x":890,"y":643,"wires":[]},{"id":"ee1b57a3.c43388","type":"mqtt in","z":"1ce094f3.74b6fb","name":"RGB","topic":"borot/feeds/O3330588877","qos":"0","broker":"5fee3e12.eff6a","x":90,"y":263,"wires":[["6d2596fa.f06dd8","d9cc843a.61ef58"]]},{"id":"d9cc843a.61ef58","type":"debug","z":"1ce094f3.74b6fb","name":"","active":false,"console":"false","complete":"payload","x":850,"y":423,"wires":[]},{"id":"f98b9e18.68af7","type":"mqtt in","z":"1ce094f3.74b6fb","name":"RFTX","topic":"borot/feeds/O2495135839","qos":"0","broker":"5fee3e12.eff6a","x":90,"y":163,"wires":[["6d2596fa.f06dd8","d9cc843a.61ef58"]]},{"id":"8883c0.ae264c4","type":"function","z":"1ce094f3.74b6fb","name":"RED","func":"msg.payload=\"RED=\"+msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":543,"wires":[["3353997e.772cf6"]]},{"id":"cea57e6e.27911","type":"ui_slider","z":"1ce094f3.74b6fb","name":"RED","label":"RED","group":"ee6bce96.bc967","order":1,"width":0,"height":0,"passthru":true,"topic":"","min":0,"max":"255","x":310,"y":583,"wires":[["8883c0.ae264c4"]]},{"id":"388abef7.f56582","type":"ui_slider","z":"1ce094f3.74b6fb","name":"GREEN","label":"GREEN","group":"ee6bce96.bc967","order":2,"width":0,"height":0,"passthru":true,"topic":"","min":0,"max":"255","x":330,"y":643,"wires":[["627a7023.541f"]]},{"id":"8b76776a.e2e4f8","type":"ui_slider","z":"1ce094f3.74b6fb","name":"BLUE","label":"BLUE","group":"ee6bce96.bc967","order":3,"width":0,"height":0,"passthru":true,"topic":"","min":0,"max":"255","x":320,"y":723,"wires":[["8f02ca8a.7b1728"]]},{"id":"627a7023.541f","type":"function","z":"1ce094f3.74b6fb","name":"GREEN","func":"msg.payload=\"GREEN=\"+msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":643,"wires":[["3353997e.772cf6"]]},{"id":"8f02ca8a.7b1728","type":"function","z":"1ce094f3.74b6fb","name":"BLUE","func":"msg.payload=\"BLUE=\"+msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":723,"wires":[["3353997e.772cf6"]]},{"id":"244031ea.06b39e","type":"ui_button","z":"1ce094f3.74b6fb","name":"","group":"ee6bce96.bc967","order":4,"width":0,"height":0,"label":"BLACK","color":"","icon":"","payload":"BLACK","payloadType":"str","topic":"","x":100,"y":543,"wires":[["3353997e.772cf6","8b76776a.e2e4f8","388abef7.f56582","cea57e6e.27911"]]},{"id":"addeb9dc.a79e78","type":"ui_switch","z":"1ce094f3.74b6fb","name":"","label":"ON/OFF","group":"ee6bce96.bc967","order":5,"width":0,"height":0,"passthru":false,"topic":"","style":"","onvalue":"ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"ON","offvalueType":"str","officon":"","offcolor":"","x":360,"y":463,"wires":[["6d2596fa.f06dd8","dac8255.0f64bd8"]]},{"id":"3d378c80.46a454","type":"switch","z":"1ce094f3.74b6fb","name":"","property":"payload.analyze","propertyType":"msg","rules":[{"t":"true"},{"t":"false"},{"t":"else"}],"checkall":"false","outputs":3,"x":610,"y":1103,"wires":[["6563e196.1502f"],["4d06754e.cf28fc"],["5e2bcf70.b81bc"]]},{"id":"81dba67e.ac28d8","type":"inject","z":"1ce094f3.74b6fb","name":"","topic":"","payload":"{\"analyze\": true, \"value\": 10}","payloadType":"str","repeat":"","crontab":"","once":true,"x":210,"y":983,"wires":[["91de5818.3c31d8","ed428291.7f751","6caf7d0e.a65184","dac8255.0f64bd8"]]},{"id":"b751f409.9813c8","type":"debug","z":"1ce094f3.74b6fb","name":"","active":false,"console":"false","complete":"payload","x":770,"y":1403,"wires":[]},{"id":"91de5818.3c31d8","type":"json","z":"1ce094f3.74b6fb","name":"analyze","x":440,"y":1003,"wires":[["3d378c80.46a454","b751f409.9813c8","835678f9.ad5af8"]]},{"id":"1c3431ee.37310e","type":"switch","z":"1ce094f3.74b6fb","name":"switch","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"slow","vt":"str"},{"t":"cont","v":"fast","vt":"str"}],"checkall":"true","outputs":2,"x":460,"y":1383,"wires":[["eaaacce9.23e34"],["b751f409.9813c8"]]},{"id":"9eeaae35.e7358","type":"inject","z":"1ce094f3.74b6fb","name":"","topic":"","payload":"slow","payloadType":"str","repeat":"","crontab":"","once":false,"x":170,"y":1363,"wires":[["1c3431ee.37310e"]]},{"id":"d48c93af.16299","type":"inject","z":"1ce094f3.74b6fb","name":"","topic":"","payload":"fast","payloadType":"str","repeat":"","crontab":"","once":false,"x":170,"y":1463,"wires":[["1c3431ee.37310e"]]},{"id":"eaaacce9.23e34","type":"delay","z":"1ce094f3.74b6fb","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":600,"y":1323,"wires":[["b751f409.9813c8"]]},{"id":"4d06754e.cf28fc","type":"debug","z":"1ce094f3.74b6fb","name":"","active":false,"console":"false","complete":"payload","x":770,"y":1163,"wires":[]},{"id":"5e2bcf70.b81bc","type":"debug","z":"1ce094f3.74b6fb","name":"","active":false,"console":"false","complete":"false","x":800,"y":1263,"wires":[]},{"id":"5d577062.6fe6b","type":"function","z":"1ce094f3.74b6fb","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":820,"wires":[[]]},{"id":"835678f9.ad5af8","type":"debug","z":"1ce094f3.74b6fb","name":"","active":false,"console":"false","complete":"payload.analyze","x":910,"y":903,"wires":[]},{"id":"ed428291.7f751","type":"debug","z":"1ce094f3.74b6fb","name":"","active":false,"console":"false","complete":"payload","x":880,"y":843,"wires":[]},{"id":"75b4e23f.02d9fc","type":"change","z":"1ce094f3.74b6fb","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":320,"wires":[[]]},{"id":"9281f344.05838","type":"inject","z":"1ce094f3.74b6fb","name":"","topic":"","payload":"{\"temp\":25,\"hum\":50}","payloadType":"str","repeat":"","crontab":"","once":false,"x":240,"y":1080,"wires":[["15a48c0c.4cc184"]]},{"id":"15a48c0c.4cc184","type":"json","z":"1ce094f3.74b6fb","name":"","x":400,"y":1120,"wires":[["e6a92cbe.5c2ab"]]},{"id":"e6a92cbe.5c2ab","type":"debug","z":"1ce094f3.74b6fb","name":"","active":false,"console":"false","complete":"payload.hum","x":520,"y":1220,"wires":[]},{"id":"40913326.9a76cc","type":"debug","z":"1ce094f3.74b6fb","name":"","active":true,"console":"false","complete":"false","x":880,"y":263,"wires":[]},{"id":"255e1876.d9ee68","type":"mqtt in","z":"1ce094f3.74b6fb","name":"Matrix","topic":"frafin/feeds/O2351743180","qos":"0","broker":"5fee3e12.eff6a","x":90,"y":363,"wires":[["d9cc843a.61ef58"]]},{"id":"6caf7d0e.a65184","type":"mqtt out","z":"1ce094f3.74b6fb","name":"Matrix","topic":"borot/feeds/I2351743180","qos":"","retain":"","broker":"5fee3e12.eff6a","x":910,"y":523,"wires":[]},{"id":"40dbc65e.dc0008","type":"mqtt in","z":"1ce094f3.74b6fb","name":"button 425","topic":"borot/feeds/O240809425","qos":"0","broker":"5fee3e12.eff6a","x":120,"y":482,"wires":[[]]},{"id":"17b361e2.1759ae","type":"mqtt out","z":"1ce094f3.74b6fb","name":"button 425","topic":"borot/feeds/I240809425","qos":"","retain":"","broker":"5fee3e12.eff6a","x":1050,"y":380,"wires":[]},{"id":"c7d0a79.6834958","type":"inject","z":"1ce094f3.74b6fb","name":"finis","topic":"","payload":"finis","payloadType":"str","repeat":"","crontab":"","once":false,"x":530,"y":480,"wires":[["17b361e2.1759ae"]]},{"id":"9a058605.22f948","type":"mqtt in","z":"1ce094f3.74b6fb","name":"proto","topic":"borot/feeds/O3291251417","qos":"0","broker":"5fee3e12.eff6a","x":90,"y":423,"wires":[["40913326.9a76cc"]]},{"id":"dac8255.0f64bd8","type":"mqtt out","z":"1ce094f3.74b6fb","name":"proto","topic":"borot/feeds/I3291251417","qos":"","retain":"","broker":"5fee3e12.eff6a","x":990,"y":323,"wires":[]},{"id":"5fc1efa7.555be","type":"inject","z":"1ce094f3.74b6fb","name":"","topic":"","payload":"ON","payloadType":"str","repeat":"","crontab":"","once":false,"x":550,"y":203,"wires":[["f1297711.627e58","40913326.9a76cc"]]},{"id":"43243c6d.3e8f04","type":"inject","z":"1ce094f3.74b6fb","name":"","topic":"","payload":"OFF","payloadType":"str","repeat":"","crontab":"","once":false,"x":550,"y":243,"wires":[["f1297711.627e58","40913326.9a76cc"]]},{"id":"5fee3e12.eff6a","type":"mqtt-broker","z":"","broker":"ffacraspberry.ddns.net","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"true","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"true","birthPayload":""},{"id":"ee6bce96.bc967","type":"ui_group","z":"","name":"RGB LED","tab":"14a360ca.be21bf","disp":true,"width":"6"},{"id":"14a360ca.be21bf","type":"ui_tab","z":"","name":"Home","icon":"RF"}]

Flow Info

Created 8 years ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x1)
  • debug (x9)
  • delay (x1)
  • function (x5)
  • inject (x7)
  • json (x2)
  • mqtt in (x6)
  • mqtt out (x6)
  • mqtt-broker (x1)
  • switch (x2)
Other
  • ui_button (x1)
  • ui_group (x1)
  • ui_slider (x3)
  • ui_switch (x1)
  • ui_tab (x1)

Tags

  • SmartBrick
  • Button
  • RGB
  • RFTX
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option