I have my hat in my hand looking for answers. full disclosure don't know what I'm doing. Using a esp32 and a PCF8574 module to control an 8 channel relay via MQTT. I am able to turn the relay high or low thru a soft button in node red but it does not retain the state.it flashes high then low
" pcf8574.digitalWrite(beer1, LOW);". If i press the mouse button the relay will flash as if it will come on then go back to High. I can turn relays on or off by changing pcf8574.digitalWrite(P0, HIGH); to LOW
Is this a problem with MQTT or do i have a delay set that is bad? my goal is to press the button turn the relay on release the button turn the relay off.
Since no one else weighed in I'll try to help. First if you would post your flow it would help. Second, have you looked at the output from node red to see what the status of the signal is? Is this a node red issue or esp? In other words does the output of node red match what the esp is doing?
thanks for looking. the debug shows the topic and payload being sent. I am seeing it in the serial monitor as well. The PCF8574 is working because i can see the LED blink on and off. Not sure if the issue is on the node red side or the hardware side.
[{"id":"f0410d53.895fa","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"6ba3dfd9.b92d8","type":"ui_numeric","z":"f0410d53.895fa","name":"FreezerTempSetting","label":"Freezer Setting","tooltip":"","group":"7ba8a1e0.82d5b","order":6,"width":0,"height":0,"wrap":false,"passthru":false,"topic":"FreezerTempSetting","format":"{{value}}","min":"0","max":"90","step":1,"x":380,"y":640,"wires":[["25236bae.4f89a4"]]},{"id":"2616982f.6bdb48","type":"ui_numeric","z":"f0410d53.895fa","name":"FridgeTempSetting","label":"Fridge Setting","tooltip":"","group":"7ba8a1e0.82d5b","order":2,"width":0,"height":0,"wrap":false,"passthru":false,"topic":"FridgeTempSetting","format":"{{value}}","min":"0","max":"90","step":1,"x":400.11112213134766,"y":753.3333435058594,"wires":[["72285695.3e74e8"]]},{"id":"eeca2b47.0fca98","type":"inject","z":"f0410d53.895fa","name":"DefaultFreezerTemperature","topic":"","payload":"2","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":152.7777862548828,"y":611.6666660308838,"wires":[["6ba3dfd9.b92d8","25236bae.4f89a4"]]},{"id":"1d536fac.021db","type":"inject","z":"f0410d53.895fa","name":"DefaultFridgeTemperature","topic":"","payload":"38","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":155.66665649414062,"y":712.9999752044678,"wires":[["2616982f.6bdb48","72285695.3e74e8"]]},{"id":"25236bae.4f89a4","type":"function","z":"f0410d53.895fa","name":"FreezerTempSetting","func":"flow.set(\"FreezerTempSetting\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":600,"wires":[[]]},{"id":"72285695.3e74e8","type":"function","z":"f0410d53.895fa","name":"FridgeTempSetting","func":"flow.set(\"FridgeTempSetting\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":603.6666374206543,"y":713.7777414321899,"wires":[[]]},{"id":"72535d7c.a9c2e4","type":"inject","z":"f0410d53.895fa","name":"fridgeheartbeat","topic":"","payload":"","payloadType":"date","repeat":"2","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":1560,"wires":[["c2afcada.f22b68"]]},{"id":"c2afcada.f22b68","type":"function","z":"f0410d53.895fa","d":true,"name":"Relaysetter","func":"const setBit = (num, position) => {\n let mask = 1 << position;\n return num | mask;\n}\n\nconst clearBit = (num, position) => {\n let mask = 1 << position;\n return num & ~mask;\n}\n\nvar buf = Buffer.alloc(1);\nbuf[0] = 0;\nbuf[0] = (flow.get(\"freezerfanOnOff\") ? setBit(buf[0], 5) : clearBit(buf[0], 5));\nif (\"Off\" == flow.get(\"freezerfermenterMode\")) {\n // compressor Off\n buf[0] = clearBit(buf[0], 0);\n // Set fridge fan\n buf[0] = clearBit(buf[0], 3);\n} else if (\"freezer\" == flow.get(\"freezerfermenterMode\")) {\n tempSetting = flow.get(\"FreezerTempSetting\");\n var freezerTemp = flow.get(\"freezerTemp\");\n if (freezerTemp < tempSetting) {\n //compressor on\n buf[0] = setBit(buf[0], 6);\n } else {\n //compressor off\n buf[0] = clearBit(buf[0], 6);\n }\n //fridge fan\n tempSetting = flow.get(\"fridgeTempSetting\");\n var fridgeTemp = flow.get(\"fridgeTemp\");\n if (fridgeTemp < tempSetting) {\n //fridgefan on\n buf[0] = setBit(buf[0], 3);\n } else {\n //fridgefan off\n buf[0] = clearBit(buf[0], 3);\n }\n} else { // fermenter\n {\n tempSetting = flow.get(\"FreezerTempSetting\");\n\n if (freezerTemp < tempSetting) {\n //compressor on\n buf[0] = setBit(buf[0], 6);\n } else {\n //compressor off\n buf[0] = clearBit(buf[0], 6);\n }\n //fridge fan\n tempSetting = flow.get(\"fridgeTempSetting\");\n\n if (fridgeTemp < tempSetting) {\n //fridgefan off\n buf[0] = clearBit(buf[0], 3);\n //fridgeheater on\n buf[0] = setBit(buf[0], 4);\n } else {\n //fridgeheater off\n buf[0] = clearBit(buf[0], 4);\n //fridgefan off\n buf[0] = clearBit(buf[0], 3);\n }\n }\n\n\n}\n\nmsg.payload = buf;\n\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":1560,"wires":[[]]},{"id":"4de73d78.9f6ba4","type":"ui_dropdown","z":"f0410d53.895fa","name":"","label":"Off/freezer/fermenter","tooltip":"","place":"Off","group":"4cc82956.ea15d8","order":4,"width":0,"height":0,"passthru":false,"options":[{"label":"","value":"Off","type":"str"},{"label":"","value":"freezer","type":"str"},{"label":"","value":"fermenter","type":"str"}],"payload":"","topic":"","x":140,"y":1140,"wires":[["ec85835.025388","2b7b2392.8032cc"]]},{"id":"ec85835.025388","type":"switch","z":"f0410d53.895fa","name":"OfffreezerfermenterSwitcher","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Off","vt":"str"},{"t":"eq","v":"freezer","vt":"str"},{"t":"eq","v":"fermenter","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":220,"y":1260,"wires":[["34be6bd8.7b5f04","81476c5e.3f8cc","e85d3ffe.5107c"],["5e216696.918538","83606c85.29125","e1c6d436.a038e8","e85d3ffe.5107c"],["ff2c5deb.118b3","79e63a0b.da8484","3e1a68a9.cc86e8","e85d3ffe.5107c"]]},{"id":"81476c5e.3f8cc","type":"template","z":"f0410d53.895fa","name":"msgenabledfalse","field":"enabled","fieldType":"msg","format":"handlebars","syntax":"plain","template":"false","output":"json","x":510,"y":1200,"wires":[["370be7fe.57f798","361c38a9.c61388"]]},{"id":"5e216696.918538","type":"template","z":"f0410d53.895fa","name":"msgenabledtrue","field":"enabled","fieldType":"msg","format":"handlebars","syntax":"plain","template":"true","output":"json","x":500,"y":1300,"wires":[["370be7fe.57f798"]]},{"id":"34be6bd8.7b5f04","type":"template","z":"f0410d53.895fa","name":"msgpayloadfalse","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"false","output":"json","x":510,"y":1160,"wires":[["370be7fe.57f798","361c38a9.c61388"]]},{"id":"3e1a68a9.cc86e8","type":"template","z":"f0410d53.895fa","name":"msgenabledtrue","field":"enabled","fieldType":"msg","format":"handlebars","syntax":"plain","template":"true","output":"json","x":523.2221984863281,"y":1514.333251953125,"wires":[["361c38a9.c61388"]]},{"id":"ff2c5deb.118b3","type":"template","z":"f0410d53.895fa","name":"msgenabledfalse","field":"enabled","fieldType":"msg","format":"handlebars","syntax":"plain","template":"false","output":"json","x":510,"y":1440,"wires":[["370be7fe.57f798"]]},{"id":"83606c85.29125","type":"template","z":"f0410d53.895fa","name":"msgenabledfalse","field":"enabled","fieldType":"msg","format":"handlebars","syntax":"plain","template":"false","output":"json","x":506.77777099609375,"y":1328,"wires":[["361c38a9.c61388"]]},{"id":"79e63a0b.da8484","type":"template","z":"f0410d53.895fa","name":"msgpayloadfalse","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"false","output":"json","x":506.5555419921875,"y":1480.4443969726562,"wires":[["370be7fe.57f798"]]},{"id":"e1c6d436.a038e8","type":"template","z":"f0410d53.895fa","name":"msgpayloadfalse","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"false","output":"json","x":520.4443969726562,"y":1363.7776489257812,"wires":[["361c38a9.c61388"]]},{"id":"ee2974bf.35ac98","type":"comment","z":"f0410d53.895fa","name":"Off","info":"","x":474.4444580078125,"y":1128,"wires":[]},{"id":"c5ee6474.f6a0c8","type":"comment","z":"f0410d53.895fa","name":"freezer","info":"","x":501.4444580078125,"y":1253,"wires":[]},{"id":"86e1e35a.c6eaa","type":"comment","z":"f0410d53.895fa","name":"fermenter","info":"","x":499.4444580078125,"y":1409,"wires":[]},{"id":"e85d3ffe.5107c","type":"function","z":"f0410d53.895fa","name":"ModeSetter","func":"flow.set(\"freezerfermenterMode\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":1080,"wires":[["1bad05d2.fd7e9a"]]},{"id":"361c38a9.c61388","type":"ui_switch","z":"f0410d53.895fa","name":"","label":"fermenterfan","tooltip":"","group":"4cc82956.ea15d8","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":810,"y":1340,"wires":[["b3e03ad3.2502d8"]]},{"id":"370be7fe.57f798","type":"ui_switch","z":"f0410d53.895fa","name":"","label":"freezer fan","tooltip":"","group":"4cc82956.ea15d8","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":790,"y":1280,"wires":[["ed87c1d9.32b45","22002e75.0d7652"]]},{"id":"ed87c1d9.32b45","type":"function","z":"f0410d53.895fa","name":"freezerfanSetter","func":"flow.set(\"freezerfanOnOff\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":1000,"y":1280,"wires":[[]]},{"id":"b3e03ad3.2502d8","type":"function","z":"f0410d53.895fa","name":"fermenterfanSetter","func":"flow.set(\"fermenterfanOnOff\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":997,"y":1340.7777709960938,"wires":[["8875ccd.d15763"]]},{"id":"1bad05d2.fd7e9a","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":850,"y":1080,"wires":[]},{"id":"22002e75.0d7652","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1000,"y":1240,"wires":[]},{"id":"8875ccd.d15763","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1210,"y":1280,"wires":[]},{"id":"7cf36733.3ee748","type":"mqtt in","z":"f0410d53.895fa","name":"freezer/temperature","topic":"freezer/temperature","qos":"2","datatype":"utf8","broker":"c76f58a5.83b2a8","x":144,"y":447,"wires":[["16175531.cd1aab","3334394b.0c0956","8f61b825.631718"]]},{"id":"16175531.cd1aab","type":"debug","z":"f0410d53.895fa","name":"freezer temp","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":341,"y":414,"wires":[]},{"id":"48cb6359.4a84dc","type":"mqtt in","z":"f0410d53.895fa","name":"fridge/temperature","topic":"fridge/temperature","qos":"2","datatype":"auto","broker":"c76f58a5.83b2a8","x":143,"y":331,"wires":[["f831c14d.e37ef","de52b4a3.b4d8a8","3305f6d9.39ac6a"]]},{"id":"f831c14d.e37ef","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":330,"y":298,"wires":[]},{"id":"de52b4a3.b4d8a8","type":"ui_gauge","z":"f0410d53.895fa","name":"","group":"7ba8a1e0.82d5b","order":1,"width":10,"height":6,"gtype":"gage","title":"Fridge Temp","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#0000ff","#800080","#ff0000"],"seg1":"33","seg2":"66","x":330,"y":358,"wires":[]},{"id":"3334394b.0c0956","type":"ui_gauge","z":"f0410d53.895fa","name":"","group":"7ba8a1e0.82d5b","order":5,"width":0,"height":0,"gtype":"gage","title":"Freezer Temp","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#0000ff","#800080","#ff0000"],"seg1":"33","seg2":"66","x":340,"y":460,"wires":[]},{"id":"3305f6d9.39ac6a","type":"function","z":"f0410d53.895fa","name":"FridgeTemp","func":"msg.payload = parseFloat(msg.payload);\nflow.set('lastFridgeTemp',msg.payload);//I added\nmsg.topic = 'currentTemp';\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":320,"wires":[["fa173fbf.0949b"]]},{"id":"fa173fbf.0949b","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":530,"y":280,"wires":[]},{"id":"4c364b8a.73e584","type":"function","z":"f0410d53.895fa","name":"Freezer Temp comparing Set Point","func":"var temperature = flow.get(\"lastFreezerTemp\");\nvar setting = flow.get(\"FreezerTempSetting\");\nvar hysteresis = 5;\nconst oHigh =5\nconst oLow =-5\nvar on = flow.get('on');\nflow.set('FreezerTemp',msg.payload);//I added\nnode.status({fill:\"blue\",shape:\"dot\",text:\"temperature\"+\":\"+temperature+\"---\"+\"setting+hysteresis\"+\":\"+setting+\" \" + \" on \" + on});\n\n//if temperature now is less than the setpoint\nif (on === 0){\n msg.payload = 0;\n return msg;\n}\nif(temperature >= setting+oHigh) {\n //close the relay\n msg.payload = 0;\n on = 0;\n } else if (temperature <= oLow+setting) {\n //open the relay\n msg.payload = 1;\n on = 1;\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":700,"y":40,"wires":[["e69d4b87.c5d4c","14966e1b.ee5102"]]},{"id":"cbd722cf.01894","type":"inject","z":"f0410d53.895fa","name":"freezertemp","topic":"freezertemp","payload":"","payloadType":"date","repeat":"15","crontab":"","once":false,"onceDelay":0.1,"x":440,"y":40,"wires":[["4c364b8a.73e584"]]},{"id":"9b582836.a2e928","type":"mqtt out","z":"f0410d53.895fa","name":"","topic":"freezertemp","qos":"2","retain":"false","broker":"9dfd182f.955648","x":1330,"y":240,"wires":[]},{"id":"33df2978.52bab6","type":"debug","z":"f0410d53.895fa","name":"sensor_temperature","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":560,"y":420,"wires":[]},{"id":"8f61b825.631718","type":"function","z":"f0410d53.895fa","name":"FreezerTemp","func":"msg.payload = parseFloat(msg.payload);\nflow.set('lastFreezerTemp',msg.payload);//I added\nmsg.topic = 'currentTemp';\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":480,"wires":[["33df2978.52bab6"]]},{"id":"e69d4b87.c5d4c","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":970,"y":20,"wires":[]},{"id":"c57c1db0.cf3bf8","type":"function","z":"f0410d53.895fa","name":"Fridge Temp comparing Set Point","func":"var temperature = flow.get(\"lastFridgeTemp\");\nvar setting = flow.get(\"FridgeTempSetting\");\nvar hysteresis = 1;\nvar on = flow.get('on');\n\nnode.status({fill:\"blue\",shape:\"dot\",text:\"temperature\"+\":\"+temperature+\"---\"+\"setting+hysteresis\"+\":\"+setting+\" \" + \" on \" + on});\n\nif (on === 0){\n msg.payload = 0;\n return msg;\n}\n\n//if temperature now is less than the setpoint\nif(temperature > setting+hysteresis) {\n //close the relay\n msg.payload = 0;\n on = 0;\n } else {\n //open the relay\n msg.payload = 1;\n on = 1;\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":700,"y":100,"wires":[["6aeec441.a0e5f4","dff38973.3c1c88"]]},{"id":"89c507d4.738a4","type":"inject","z":"f0410d53.895fa","name":"fridgetemp","topic":"fridgetemp","payload":"","payloadType":"date","repeat":"30","crontab":"","once":false,"onceDelay":0.1,"x":470,"y":100,"wires":[["c57c1db0.cf3bf8"]]},{"id":"dff38973.3c1c88","type":"mqtt out","z":"f0410d53.895fa","name":"","topic":"fridgetemp","qos":"","retain":"","broker":"9dfd182f.955648","x":1090,"y":100,"wires":[]},{"id":"6aeec441.a0e5f4","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":930,"y":140,"wires":[]},{"id":"2b7b2392.8032cc","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":400,"y":1060,"wires":[]},{"id":"1417ced0.6573e9","type":"mqtt out","z":"f0410d53.895fa","name":"defrost","topic":"defrost","qos":"","retain":"","broker":"c76f58a5.83b2a8","x":1300,"y":500,"wires":[]},{"id":"14966e1b.ee5102","type":"change","z":"f0410d53.895fa","name":"freezeronoff","rules":[{"t":"set","p":"freezeronoff","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":80,"wires":[["9c8a78b4.6e8b88"]]},{"id":"9c8a78b4.6e8b88","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1280,"y":80,"wires":[]},{"id":"66b3672a.2335d","type":"function","z":"f0410d53.895fa","name":"fridge setting","func":"var msg2 = flow.get(\"Defrostonoff\");\n\nif (msg2 === \"off\") {\n return [ msg, null ];\n} else if (msg2 === \"on\"){\n return [ null, msg ];\n}\n","outputs":2,"noerr":0,"x":910,"y":220,"wires":[["9b582836.a2e928","abb3eb08.e2de8"],["37e08203.8ec64e"]]},{"id":"3bc94585.ce0242","type":"timerswitch","z":"f0410d53.895fa","name":"defrost timer","ontopic":"Defrost","offtopic":"Defrost","onpayload":"","offpayload":"","disabled":false,"schedules":[{"on_h":"16","on_m":"30","on_s":"00","off_h":"16","off_m":"50","off_s":"00","valid":true}],"x":870,"y":540,"wires":[["f12d7212.94f958"]]},{"id":"b753f284.9b26d8","type":"debug","z":"f0410d53.895fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1250,"y":560,"wires":[]},{"id":"abb3eb08.e2de8","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1310,"y":200,"wires":[]},{"id":"1c776857.b95748","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1290,"y":280,"wires":[]},{"id":"f49bf9e7.328d48","type":"inject","z":"f0410d53.895fa","name":"","topic":"freezertemp","payload":"freezeronoff","payloadType":"flow","repeat":"3","crontab":"","once":false,"onceDelay":0.1,"x":730,"y":220,"wires":[["66b3672a.2335d"]]},{"id":"f12d7212.94f958","type":"function","z":"f0410d53.895fa","name":"","func":"flow.set(\"Defrostonoff\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":1050,"y":500,"wires":[["b753f284.9b26d8","1417ced0.6573e9"]]},{"id":"37e08203.8ec64e","type":"change","z":"f0410d53.895fa","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":280,"wires":[["1c776857.b95748","9b582836.a2e928"]]},{"id":"3b935719.3f39c","type":"mqtt out","z":"f0410d53.895fa","name":"beer1","topic":"beer1","qos":"2","retain":"","broker":"9dfd182f.955648","x":510,"y":1660,"wires":[]},{"id":"4b36a9b0.2b2e7","type":"ui_template","z":"f0410d53.895fa","group":"18a79f4c.e0af59","name":"Up","order":5,"width":"4","height":"1","format":"<style>\n.button {\n background-color: #097479;\n border: none;\n color: white;\n padding: 15px 32px;\n text-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 16px;\n margin: 4px 2px;\n cursor: pointer;\n \n box-shadow: none !important;\n width: 100% !important;\n height: 100% !important;\n margin: 0px !important;\n min-width: 0px !important;\n min-height: 0px !important;\n white-space: nowrap;\n text-transform: uppercase;\n font-weight: 500;\n font-size: 14px;\n \n transition: background-color 0.1s;\n\n}\n\nbutton:hover {\n background-color: #0b8f95;\n}\n\nbutton:active {\n background-color: #ff0000;\n}\n\n</style>\n\n<button ng-mousedown=\"send({topic: 'beer1',payload: 'down'})\" ng-mouseup=\"send({topic: 'beer1',payload: 'off'})\"><a class=\"waves-effect waves-light btn-large\">Bluepoint</a></button>\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":90,"y":1700,"wires":[["e3eac56e.5ee158"]]},{"id":"9bbfb308.154e28","type":"trigger","z":"f0410d53.895fa","op1":"pour","op2":"0","op1type":"str","op2type":"str","duration":"-60","extend":true,"units":"s","reset":"off","bytopic":"all","name":"Repeate","x":360,"y":1620,"wires":[["dfef530b.682c4","3b935719.3f39c"]]},{"id":"b9827cac.a3e0d8","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":1680,"wires":[]},{"id":"e3eac56e.5ee158","type":"switch","z":"f0410d53.895fa","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"down","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":1680,"wires":[["9bbfb308.154e28"],["b9827cac.a3e0d8","9bbfb308.154e28","3b935719.3f39c"]]},{"id":"dfef530b.682c4","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":1620,"wires":[]},{"id":"6d0cf5d9.be5e4c","type":"mqtt out","z":"f0410d53.895fa","name":"beer2","topic":"beer2","qos":"2","retain":"","broker":"9dfd182f.955648","x":510,"y":1800,"wires":[]},{"id":"dc153ae8.197ec","type":"ui_template","z":"f0410d53.895fa","group":"18a79f4c.e0af59","name":"Up","order":5,"width":"4","height":"2","format":"<style>\n.button {\n background-color: #097479;\n border: none;\n color: white;\n padding: 15px 32px;\n text-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 16px;\n margin: 4px 2px;\n cursor: pointer;\n \n box-shadow: none !important;\n width: 100% !important;\n height: 100% !important;\n margin: 0px !important;\n min-width: 0px !important;\n min-height: 0px !important;\n white-space: nowrap;\n text-transform: uppercase;\n font-weight: 500;\n font-size: 14px;\n \n transition: background-color 0.1s;\n\n}\n\nbutton:hover {\n background-color: #0b8f95;\n}\n\nbutton:active {\n background-color: #ff0000;\n}\n\n</style>\n\n<button ng-mousedown=\"send({topic: 'beer2',payload: 'down'})\" ng-mouseup=\"send({topic: 'beer2',payload: 'off'})\"><a class=\"waves-effect waves-light btn-large\">Diet Coke</a></button>\n","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":90,"y":1820,"wires":[["2db317a9.047ff8"]]},{"id":"592dd6a9.16089","type":"trigger","z":"f0410d53.895fa","op1":"pour","op2":"0","op1type":"str","op2type":"str","duration":"-5","extend":false,"units":"s","reset":"off","bytopic":"all","name":"Repeate","x":360,"y":1760,"wires":[["6845f9b1.c8b7d","6d0cf5d9.be5e4c"]]},{"id":"f359e25c.9048c8","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":1820,"wires":[]},{"id":"2db317a9.047ff8","type":"switch","z":"f0410d53.895fa","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"down","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":1820,"wires":[["592dd6a9.16089"],["f359e25c.9048c8","592dd6a9.16089","6d0cf5d9.be5e4c"]]},{"id":"6845f9b1.c8b7d","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":1760,"wires":[]},{"id":"50c50229.e41d84","type":"mqtt out","z":"f0410d53.895fa","name":"beer3","topic":"beer3","qos":"2","retain":"","broker":"9dfd182f.955648","x":510,"y":1920,"wires":[]},{"id":"521c5ae9.a84df4","type":"ui_template","z":"f0410d53.895fa","group":"18a79f4c.e0af59","name":"Up","order":5,"width":"4","height":"2","format":"<style>\n.button {\n background-color: #097479;\n border: none;\n color: white;\n padding: 15px 32px;\n text-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 16px;\n margin: 4px 2px;\n cursor: pointer;\n \n box-shadow: none !important;\n width: 100% !important;\n height: 100% !important;\n margin: 0px !important;\n min-width: 0px !important;\n min-height: 0px !important;\n white-space: nowrap;\n text-transform: uppercase;\n font-weight: 500;\n font-size: 14px;\n \n transition: background-color 0.1s;\n\n}\n\nbutton:hover {\n background-color: #0b8f95;\n}\n\nbutton:active {\n background-color: #ff0000;\n}\n\n</style>\n\n<button ng-mousedown=\"send({topic: 'beer3',payload: 'down'})\" ng-mouseup=\"send({topic: 'beer3',payload: 'off'})\"><a class=\"waves-effect waves-light btn-large\">Water</a></button>\n","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":90,"y":1940,"wires":[["de39e774.b93298"]]},{"id":"3763da7a.9e45f6","type":"trigger","z":"f0410d53.895fa","op1":"pour","op2":"0","op1type":"str","op2type":"str","duration":"-5","extend":false,"units":"s","reset":"off","bytopic":"all","name":"Repeate","x":360,"y":1880,"wires":[["ce67e5c0.701b38","50c50229.e41d84"]]},{"id":"730936c0.442b1","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":1940,"wires":[]},{"id":"de39e774.b93298","type":"switch","z":"f0410d53.895fa","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"down","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":1940,"wires":[["3763da7a.9e45f6"],["730936c0.442b1","3763da7a.9e45f6","50c50229.e41d84"]]},{"id":"ce67e5c0.701b38","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":1880,"wires":[]},{"id":"2fa0bec0.c05e8a","type":"mqtt out","z":"f0410d53.895fa","name":"beer4","topic":"beer4","qos":"2","retain":"","broker":"9dfd182f.955648","x":510,"y":2040,"wires":[]},{"id":"3ae9a4b.183965c","type":"ui_template","z":"f0410d53.895fa","group":"18a79f4c.e0af59","name":"Up","order":5,"width":"4","height":"2","format":"<style>\n.button {\n background-color: #097479;\n border: none;\n color: white;\n padding: 15px 32px;\n text-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 16px;\n margin: 4px 2px;\n cursor: pointer;\n \n box-shadow: none !important;\n width: 100% !important;\n height: 100% !important;\n margin: 0px !important;\n min-width: 0px !important;\n min-height: 0px !important;\n white-space: nowrap;\n text-transform: uppercase;\n font-weight: 500;\n font-size: 14px;\n \n transition: background-color 0.1s;\n\n}\n\nbutton:hover {\n background-color: #0b8f95;\n}\n\nbutton:active {\n background-color: #ff0000;\n}\n\n</style>\n\n<button ng-mousedown=\"send({topic: 'beer4',payload: 'down'})\" ng-mouseup=\"send({topic: 'beer4',payload: 'off'})\"><a class=\"waves-effect waves-light btn-large\">Lagunitas</a></button>\n","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":90,"y":2060,"wires":[["f2cd397d.b2ccd"]]},{"id":"759ad8ab.26d938","type":"trigger","z":"f0410d53.895fa","op1":"pour","op2":"0","op1type":"str","op2type":"str","duration":"-5","extend":false,"units":"s","reset":"off","bytopic":"all","name":"Repeate","x":360,"y":2000,"wires":[["46027ba6.91a34c","2fa0bec0.c05e8a"]]},{"id":"8d953fbf.da9568","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":2060,"wires":[]},{"id":"f2cd397d.b2ccd","type":"switch","z":"f0410d53.895fa","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"down","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":2060,"wires":[["759ad8ab.26d938"],["8d953fbf.da9568","759ad8ab.26d938","2fa0bec0.c05e8a"]]},{"id":"46027ba6.91a34c","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":2000,"wires":[]},{"id":"ac8e0ed9.1185e","type":"comment","z":"f0410d53.895fa","name":"Bluepoint","info":"","x":100,"y":1660,"wires":[]},{"id":"d257ab54.e49c08","type":"comment","z":"f0410d53.895fa","name":"Diet coke","info":"","x":100,"y":1780,"wires":[]},{"id":"2062ed28.a9fe02","type":"comment","z":"f0410d53.895fa","name":"","info":"","x":100,"y":1900,"wires":[]},{"id":"cbffcc2b.09a67","type":"comment","z":"f0410d53.895fa","name":"","info":"","x":100,"y":2020,"wires":[]},{"id":"3d05efcc.49396","type":"mqtt out","z":"f0410d53.895fa","name":"beer4","topic":"beer4","qos":"1","retain":"","broker":"9dfd182f.955648","x":510,"y":2200,"wires":[]},{"id":"10b33a7d.30ccd6","type":"ui_template","z":"f0410d53.895fa","group":"18a79f4c.e0af59","name":"Up","order":5,"width":"4","height":"2","format":"<style>\n.button {\n background-color: #097479;\n border: none;\n color: white;\n padding: 15px 32px;\n text-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 16px;\n margin: 4px 2px;\n cursor: pointer;\n \n box-shadow: none !important;\n width: 100% !important;\n height: 100% !important;\n margin: 0px !important;\n min-width: 0px !important;\n min-height: 0px !important;\n white-space: nowrap;\n text-transform: uppercase;\n font-weight: 500;\n font-size: 14px;\n \n transition: background-color 0.1s;\n\n}\n\nbutton:hover {\n background-color: #0b8f95;\n}\n\nbutton:active {\n background-color: #ff0000;\n}\n\n</style>\n\n<button ng-mousedown=\"send({topic: 'beer4',payload: 'down'})\" ng-mouseup=\"send({topic: 'beer4',payload: 'off'})\"><a href=\"#!\" class=\"btn waves-effect waves-teal\">test</a></button>\n","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":90,"y":2220,"wires":[["1722dcd1.378133"]]},{"id":"ffee61a4.b1573","type":"trigger","z":"f0410d53.895fa","op1":"pour","op2":"0","op1type":"str","op2type":"str","duration":"-5","extend":false,"units":"s","reset":"off","bytopic":"all","name":"Repeate","x":360,"y":2160,"wires":[["2b25897a.ae7796","3d05efcc.49396"]]},{"id":"80ebd0df.ed0d5","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":2220,"wires":[]},{"id":"1722dcd1.378133","type":"switch","z":"f0410d53.895fa","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"down","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":2220,"wires":[["ffee61a4.b1573"],["80ebd0df.ed0d5","ffee61a4.b1573","3d05efcc.49396"]]},{"id":"2b25897a.ae7796","type":"debug","z":"f0410d53.895fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":2160,"wires":[]},{"id":"2be94e30.b021c2","type":"comment","z":"f0410d53.895fa","name":"test","info":"","x":90,"y":2180,"wires":[]},{"id":"7ba8a1e0.82d5b","type":"ui_group","z":"","name":"Fridge","tab":"cf9e3c59.35b6a","disp":true,"width":10,"collapse":false},{"id":"4cc82956.ea15d8","type":"ui_group","z":"","name":"Fridge control","tab":"cf9e3c59.35b6a","order":2,"disp":true,"width":"6","collapse":false},{"id":"c76f58a5.83b2a8","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":"9dfd182f.955648","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"18a79f4c.e0af59","type":"ui_group","z":"","name":"Tap Control","tab":"cf9e3c59.35b6a","order":3,"disp":true,"width":"6","collapse":false},{"id":"cf9e3c59.35b6a","type":"ui_tab","z":"","name":"Fridge","icon":"dashboard","disabled":false,"hidden":false}]
So, first, there is an unknown node "timerswitch", you'll need to provide the whole name. something like node-red-contrib-something Otherwise I can't see your whole flow.
My next recommendation is to save this whole flow somewhere and start a new flow and start off small. One switch, one function, one mqtt node and see if you can get just one relay to work like you want it to. One switch to turn it off and on and get that working first. Then you can move on to adding other things in.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.