Looking for help with the eztimer

Hi All,

I’m trying build an irrigation flow using the eztimer but having trouble getting it to work. I’m trying to use the dashboard to control the eztimer functions. I would like to set an automatic schedule with days of the week, duration and time on/off as well as manually turn it on/off with suspend/reset with buttons. Ive had a go but without much luck. Any help will be much appreciated.

Cheers

[{"id":"3e1a306a.3b0ee","type":"tab","label":"Sprinkler","disabled":false,"info":""},{"id":"d1839bcd.7115d8","type":"eztimer","z":"3e1a306a.3b0ee","name":"Scheduler","debug":false,"autoname":" + ","tag":"eztimer","topic":"","suspended":false,"sendEventsOnSuspend":true,"latLongSource":"manual","latLongHaZone":"zone.home","lat":"","lon":"","timerType":"1","startupMessage":false,"ontype":"9","ontimesun":"dawn","ontimetod":"17:00:00","onpropertytype":"msg","onproperty":"payload","onvaluetype":"num","onvalue":"1","onoffset":0,"onrandomoffset":0,"onsuppressrepeats":false,"offtype":"3","offtimesun":"dusk","offtimetod":"dusk","offduration":"","offpropertytype":"msg","offproperty":"payload","offvaluetype":"num","offvalue":"0","offoffset":0,"offrandomoffset":0,"offsuppressrepeats":false,"resend":false,"resendInterval":"0s","mon":false,"tue":false,"wed":false,"thu":false,"fri":false,"sat":false,"sun":false,"x":660,"y":420,"wires":[["3c271688.af442a"]]},{"id":"c87ee095.fdbd88","type":"ui_dropdown","z":"3e1a306a.3b0ee","name":"Select duration","label":"Select duration","tooltip":"","place":"Select option","group":"3a35b938.33bba6","order":2,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"10","value":10,"type":"num"},{"label":"20","value":20,"type":"num"},{"label":"30 ","value":30,"type":"num"},{"label":"40","value":40,"type":"num"},{"label":"50","value":50,"type":"num"},{"label":"60","value":60,"type":"num"},{"label":"None selected","value":"","type":"str"}],"payload":"","topic":"","x":200,"y":360,"wires":[["bc9481b3.2b99b"]]},{"id":"bc9481b3.2b99b","type":"function","z":"3e1a306a.3b0ee","name":"Set duration","func":"if (msg.payload == 10){\n    msg.payload = {duration: \"00:10:00\"}\n}\nelse if (msg.payload == 20){\n    msg.payload = {duration: \"00:20:00\"}\n}\nelse if (msg.payload == 30){\n    msg.payload = {duration: \"00:30:00\"}\n}\nelse if (msg.payload == 40){\n    msg.payload = {duration: \"00:40:00\"}\n}\nelse if (msg.payload == 50){\n    msg.payload = {duration: \"00:50:00\"}\n}\nelse if (msg.payload == 60){\n    msg.payload = {duration: \"00:60:00\"}\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390,"y":360,"wires":[["d1839bcd.7115d8"]]},{"id":"336f5db6.ac575a","type":"function","z":"3e1a306a.3b0ee","name":"Set day","func":"\nif (msg.payload == \"monday\"){\n    msg.payload = {mon: true};\n}\nelse if (msg.payload == \"tuesday\"){\n    msg.payload = {tue: true};\n}\nelse if (msg.payload == \"wednesday\"){\n    msg.payload = {wed: true};\n}\nelse if (msg.payload == \"thursday\"){\n    msg.payload = {thu: true};\n}\nelse if (msg.payload == \"friday\"){\n    msg.payload = {fri: true};\n}\nelse if (msg.payload == \"saturday\"){\n    msg.payload = {sat: true};\n}\nelse if (msg.payload == \"sunday\"){\n    msg.payload = {sun: true};\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":380,"y":420,"wires":[["d1839bcd.7115d8"]]},{"id":"cdbefbd6.0e8f18","type":"ui_dropdown","z":"3e1a306a.3b0ee","name":"Select days","label":"Select days","tooltip":"","place":"Select option","group":"3a35b938.33bba6","order":3,"width":0,"height":0,"passthru":true,"multiple":true,"options":[{"label":"Monday","value":"monday","type":"str"},{"label":"Tuesday","value":"tuesday","type":"str"},{"label":"Wednesday","value":"wednesday","type":"str"},{"label":"Thursday","value":"thursday","type":"str"},{"label":"Friday","value":"friday","type":"str"},{"label":"Saturday","value":"saturday","type":"str"},{"label":"Sunday","value":"sunday","type":"str"},{"label":"None selected","value":"","type":"str"}],"payload":"","topic":"","x":210,"y":420,"wires":[["336f5db6.ac575a"]]},{"id":"21b28647.d22d3a","type":"ui_text_input","z":"3e1a306a.3b0ee","name":"Set off time","label":"Off Time","tooltip":"","group":"3a35b938.33bba6","order":6,"width":3,"height":1,"passthru":true,"mode":"text","delay":300,"topic":"off_time","x":210,"y":540,"wires":[["593a735e.fe8144"]]},{"id":"e1625abd.2db368","type":"ui_text_input","z":"3e1a306a.3b0ee","name":"Set on time","label":"On Time","tooltip":"","group":"3a35b938.33bba6","order":4,"width":3,"height":1,"passthru":true,"mode":"text","delay":300,"topic":"on_time","x":210,"y":480,"wires":[["593a735e.fe8144"]]},{"id":"9c85fef2.b8dc38","type":"ui_button","z":"3e1a306a.3b0ee","name":"Submit time","group":"3a35b938.33bba6","order":5,"width":1,"height":1,"passthru":false,"label":"Submit","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"str","topic":"submit","x":210,"y":600,"wires":[["593a735e.fe8144"]]},{"id":"593a735e.fe8144","type":"function","z":"3e1a306a.3b0ee","name":"Set start/finish","func":"var payload=msg.payload;\nvar topic=msg.topic;\n\nfunction checktime(time)\n{\n    var error_flag=false;\n   var a=time.split(\":\"); \n   node.log(a)\n   if(a.length <2)\n     error_flag=true;\n   if(parseInt(a[0])>23)\n     error_flag=true;\n   if(parseInt(a[1])>=60)\n     error_flag=true;\n    if(parseInt(a[2])>=60)\n     error_flag=true;\n\nreturn error_flag;  \n}\nif (topic==\"on_time\")\n{\n  flow.set(\"on_time\",msg.payload);\n  \n    \n}\nif (topic==\"off_time\")\n \n{\n     flow.set(\"off_time\",msg.payload);\n\n}\nif (topic==\"submit\")\n \n{\n  var on_time= flow.get(\"on_time\");\n  var off_time= flow.get(\"off_time\");\n  var error_flag=false;\n  if(checktime(on_time)) //ok\n    error_flag=true;\n  if(checktime(off_time)) //ok\n    error_flag=true;\n  \n\n\n  if(!error_flag)\n  {\n      newpayload={};\n      newpayload.ontime=on_time;\n      newpayload.offtime=off_time;\n      msg.payload=newpayload;\n   return[msg,null];\n}\nelse\n{\n    var msg1={};\n    msg1.payload=\"error time not set\";\n   return [null,msg1]; \n}\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","x":400,"y":480,"wires":[["d1839bcd.7115d8"],[]]},{"id":"44fd7fb1.fee99","type":"inject","z":"3e1a306a.3b0ee","name":"","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":340,"y":1200,"wires":[["128ed9fe.100af6"]]},{"id":"128ed9fe.100af6","type":"function","z":"3e1a306a.3b0ee","name":"Format Time","func":"\nvar d =new Date(msg.payload);\nmsg.payload=d.getHours()+\":\"+d.getMinutes()+\":\"+d.getSeconds();\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":1200,"wires":[["85ee2cdf.fb1728"]]},{"id":"85ee2cdf.fb1728","type":"ui_text","z":"3e1a306a.3b0ee","group":"3a35b938.33bba6","order":1,"width":7,"height":1,"name":"Current Time","label":"Current Time","format":"{{msg.payload}}","layout":"col-center","x":730,"y":1220,"wires":[]},{"id":"c205cb9.c19b7b8","type":"inject","z":"3e1a306a.3b0ee","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"monday","payloadType":"str","x":100,"y":80,"wires":[["6cbc2bd7.2d9724"]]},{"id":"e5b87db0.2c931","type":"inject","z":"3e1a306a.3b0ee","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":110,"y":40,"wires":[["26112892.fa7018"]]},{"id":"7980a09d.d45c68","type":"ui_button","z":"3e1a306a.3b0ee","name":"","group":"3a35b938.33bba6","order":8,"width":0,"height":0,"passthru":true,"label":"On","tooltip":"","color":"","bgcolor":"","icon":"","payload":"on","payloadType":"str","topic":"","x":430,"y":180,"wires":[["d1839bcd.7115d8"]]},{"id":"ed5ad22d.d75fc","type":"ui_button","z":"3e1a306a.3b0ee","name":"","group":"3a35b938.33bba6","order":9,"width":0,"height":0,"passthru":true,"label":"Off","tooltip":"","color":"","bgcolor":"","icon":"","payload":"off","payloadType":"str","topic":"","x":430,"y":220,"wires":[["d1839bcd.7115d8"]]},{"id":"2cb00d45.3305ca","type":"ui_button","z":"3e1a306a.3b0ee","name":"","group":"3a35b938.33bba6","order":12,"width":0,"height":0,"passthru":true,"label":"Cancel","tooltip":"","color":"","bgcolor":"","icon":"","payload":"cancel","payloadType":"str","topic":"","x":420,"y":300,"wires":[["d1839bcd.7115d8"]]},{"id":"3b668b88.3d69ec","type":"link in","z":"3e1a306a.3b0ee","name":"Duration","links":["26112892.fa7018"],"x":55,"y":360,"wires":[["c87ee095.fdbd88"]]},{"id":"26112892.fa7018","type":"link out","z":"3e1a306a.3b0ee","name":"10","links":["3b668b88.3d69ec"],"x":215,"y":40,"wires":[]},{"id":"6cbc2bd7.2d9724","type":"link out","z":"3e1a306a.3b0ee","name":"Monday","links":["4a6b9902.6df0a"],"x":215,"y":80,"wires":[]},{"id":"4a6b9902.6df0a","type":"link in","z":"3e1a306a.3b0ee","name":"Days","links":["6cbc2bd7.2d9724"],"x":55,"y":420,"wires":[["cdbefbd6.0e8f18"]]},{"id":"e56188a.75d9478","type":"link in","z":"3e1a306a.3b0ee","name":"On","links":["686ecda1.f670fc"],"x":295,"y":180,"wires":[["7980a09d.d45c68"]]},{"id":"1591e77c.5bfc49","type":"link in","z":"3e1a306a.3b0ee","name":"Off","links":["2174041c.b5b48c"],"x":295,"y":220,"wires":[["ed5ad22d.d75fc"]]},{"id":"22dc911d.3eeee6","type":"link in","z":"3e1a306a.3b0ee","name":"Cancel","links":["2f343b0d.f78224"],"x":295,"y":300,"wires":[["2cb00d45.3305ca"]]},{"id":"74020f4c.4ae128","type":"inject","z":"3e1a306a.3b0ee","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":330,"y":40,"wires":[["686ecda1.f670fc"]]},{"id":"431c83b7.947674","type":"inject","z":"3e1a306a.3b0ee","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":330,"y":80,"wires":[["2174041c.b5b48c"]]},{"id":"fb5b108f.5636d8","type":"inject","z":"3e1a306a.3b0ee","name":"Cancel","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"cancel","payloadType":"str","x":570,"y":80,"wires":[["2f343b0d.f78224"]]},{"id":"2174041c.b5b48c","type":"link out","z":"3e1a306a.3b0ee","name":"","links":["1591e77c.5bfc49"],"x":435,"y":80,"wires":[]},{"id":"686ecda1.f670fc","type":"link out","z":"3e1a306a.3b0ee","name":"","links":["e56188a.75d9478"],"x":435,"y":40,"wires":[]},{"id":"2f343b0d.f78224","type":"link out","z":"3e1a306a.3b0ee","name":"","links":["22dc911d.3eeee6"],"x":675,"y":80,"wires":[]},{"id":"3c271688.af442a","type":"ui_led","z":"3e1a306a.3b0ee","group":"3a35b938.33bba6","order":13,"width":0,"height":0,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"0","valueType":"num"},{"color":"green","value":"1","valueType":"num"}],"allowColorForValueInMessage":false,"name":"","x":810,"y":420,"wires":[]},{"id":"9ef817ac.b24ba","type":"ui_switch","z":"3e1a306a.3b0ee","name":"","label":"Suspend","tooltip":"","group":"3a35b938.33bba6","order":10,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"{\"suspended\":true}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"suspended\":false}","offvalueType":"json","officon":"","offcolor":"","x":420,"y":260,"wires":[["d1839bcd.7115d8"]]},{"id":"3a35b938.33bba6","type":"ui_group","z":"","name":"Center","tab":"93db86fc.a00fe","order":2,"disp":false,"width":"7","collapse":false},{"id":"93db86fc.a00fe","type":"ui_tab","z":"","name":"Sprinkler","icon":"dashboard","disabled":false,"hidden":false}]

Not used eztimer but I did a demo with cron+

https://flows.nodered.org/flow/79a66966a6cc655a827872a4af794b94

I do like the look of that flow but I’m after something a little more user friendly with the misses using it. The eztimer looks like it will do the job but there isn’t much info/examples of it out there so i was hoping someone here may have used this node in similar projects.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.