Control LCTech Relay X2 board with ESP Easy
This is a very simple flow showing how to control an LCTech Relay X2 board running ESP Easy firmware. More details of how to set up the hardware can be found in this video: https://youtu.be/i_CnBcQgdGk
And also here in text form: https://www.letscontrolit.com/forum/viewtopic.php?p=28044#p28044
[{"id":"4cf8565b.b0c408","type":"mqtt out","z":"297463ad.25de4c","name":"","topic":"/LCTech/cmd","qos":"0","retain":"false","broker":"cea5258a.b34038","x":730,"y":100,"wires":[]},{"id":"8e51165e.c553e8","type":"inject","z":"297463ad.25de4c","name":"Relay 0 Off","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":100,"wires":[["90fd05a0.0d8b88"]]},{"id":"b67b12db.71176","type":"comment","z":"297463ad.25de4c","name":"LCTech 2 relay board","info":"","x":120,"y":40,"wires":[]},{"id":"eed1ae18.170ee","type":"inject","z":"297463ad.25de4c","name":"Relay 0 On","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":140,"wires":[["c875ed3f.99cae"]]},{"id":"6a5fd568.f71e8c","type":"mqtt in","z":"297463ad.25de4c","name":"","topic":"/LCTech/#","qos":"2","broker":"cea5258a.b34038","x":280,"y":440,"wires":[["3f17f89b.fb7d18"]]},{"id":"3f17f89b.fb7d18","type":"debug","z":"297463ad.25de4c","name":"","active":true,"console":"false","complete":"false","x":492,"y":440,"wires":[]},{"id":"c99d6229.96ab8","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"http://192.168.1.148/control?cmd=relay,0,0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":500,"wires":[["a47ebfb6.c0282"]]},{"id":"a47ebfb6.c0282","type":"http request","z":"297463ad.25de4c","name":"","method":"GET","ret":"txt","url":"","tls":"","x":730,"y":500,"wires":[[]]},{"id":"35ccbeca.265a42","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"http://192.168.1.148/control?cmd=relay,0,1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":540,"wires":[["a47ebfb6.c0282"]]},{"id":"fc09525a.bb264","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"http://192.168.1.148/control?cmd=relay,1,0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":600,"wires":[["a47ebfb6.c0282"]]},{"id":"d85817e6.445818","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"http://192.168.1.148/control?cmd=relay,1,1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":640,"wires":[["a47ebfb6.c0282"]]},{"id":"8301c151.0e1a6","type":"inject","z":"297463ad.25de4c","name":"Relay 0 Off","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":500,"wires":[["c99d6229.96ab8"]]},{"id":"3cf16ad8.a30836","type":"inject","z":"297463ad.25de4c","name":"Relay 0 On","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":540,"wires":[["35ccbeca.265a42"]]},{"id":"253d08f.8d395f8","type":"inject","z":"297463ad.25de4c","name":"Relay 1 Off","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":600,"wires":[["fc09525a.bb264"]]},{"id":"bc175c16.ffa93","type":"inject","z":"297463ad.25de4c","name":"Relay 1 On","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":640,"wires":[["d85817e6.445818"]]},{"id":"72633f93.41a8","type":"inject","z":"297463ad.25de4c","name":"Relay 1 Off","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":200,"wires":[["8da522bc.4cc49"]]},{"id":"4fbf1af8.f08bf4","type":"inject","z":"297463ad.25de4c","name":"Relay 1 On","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":240,"wires":[["7fc97295.e7e48c"]]},{"id":"90fd05a0.0d8b88","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"relay,0,0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":100,"wires":[["4cf8565b.b0c408"]]},{"id":"c875ed3f.99cae","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"relay,0,1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":140,"wires":[["4cf8565b.b0c408"]]},{"id":"8da522bc.4cc49","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"relay,1,0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":200,"wires":[["4cf8565b.b0c408"]]},{"id":"7fc97295.e7e48c","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"relay,1,1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":240,"wires":[["4cf8565b.b0c408"]]},{"id":"9879f75.7f2f608","type":"ui_switch","z":"297463ad.25de4c","name":"","label":"Relay 0","group":"411e0a2d.5d16d4","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"0","offvalueType":"str","officon":"","offcolor":"","x":140,"y":300,"wires":[["85846500.7ecd78"]]},{"id":"85846500.7ecd78","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"'relay,0,' & msg.payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":300,"wires":[["4cf8565b.b0c408"]]},{"id":"493cf0.40d2931","type":"ui_switch","z":"297463ad.25de4c","name":"","label":"Relay 1","group":"411e0a2d.5d16d4","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"0","offvalueType":"str","officon":"","offcolor":"","x":140,"y":360,"wires":[["14e60476.a5d1fc"]]},{"id":"14e60476.a5d1fc","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"'relay,1,' & msg.payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":360,"wires":[["4cf8565b.b0c408"]]},{"id":"c26def53.430b5","type":"ui_switch","z":"297463ad.25de4c","name":"","label":"Relay 0","group":"f50354f7.22a028","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"0","offvalueType":"str","officon":"","offcolor":"","x":140,"y":700,"wires":[["9b253782.e18928"]]},{"id":"9b253782.e18928","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"'http://192.168.1.148/control?cmd=relay,0,' & msg.payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":700,"wires":[["a47ebfb6.c0282"]]},{"id":"925be439.fa6348","type":"ui_switch","z":"297463ad.25de4c","name":"","label":"Relay 1","group":"f50354f7.22a028","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"0","offvalueType":"str","officon":"","offcolor":"","x":140,"y":760,"wires":[["5d0972bc.3eec2c"]]},{"id":"5d0972bc.3eec2c","type":"change","z":"297463ad.25de4c","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"'http://192.168.1.148/control?cmd=relay,1,' & msg.payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":760,"wires":[["a47ebfb6.c0282"]]},{"id":"cea5258a.b34038","type":"mqtt-broker","z":"","broker":"192.168.1.80","port":"1883","clientid":"node-red","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"411e0a2d.5d16d4","type":"ui_group","z":"","name":"LCTech 2x Relay MQTT","tab":"2e88dfd1.9e0e5","disp":true,"width":"6","collapse":false},{"id":"f50354f7.22a028","type":"ui_group","z":"","name":"LCTech 2x Relay HTTP","tab":"2e88dfd1.9e0e5","disp":true,"width":"6","collapse":false},{"id":"2e88dfd1.9e0e5","type":"ui_tab","z":"","name":"ESP Easy","icon":"dashboard"}]