前言
最近工作太忙,没时间更新教程。今日得以空闲,没事来写两篇教程给大家学习一下。
今天这篇教程是关于定时任务的,非常简单而且易用。
1. 安装模块
打开节点管理,在安装里输入,node-red-contrib-scheduler,然后点击安装。


2. 了解模块的作用
安装好以后,会发现这个节点有3个输出,分别是msg,value,text。一般我们只需要value就行。

详细点开以后,会看到这些配置参数,一般我们设置好经纬度和定时时间即可。

3. 开始使用
案例1,上海,黄昏的时候打开花园灯,早上7点关闭,每天都执行


节点流程
[{"id":"f6cc9801.bbb3d8","type":"scheduler","z":"63da8941.7cd5c8","outtopic":"","outpayload1":"","outpayload2":"","name":"定时器","lat":"31.53","lon":"120.52","start":"sunrise","end":"sunset","starttime":"6000","endtime":"420","duskoff":"0","dawnoff":"0","outtext1":"","outtext2":"","sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"repeat":false,"atstart":true,"x":1090,"y":940,"wires":[[],["cdc6cb5.53c7738"],[]]},{"id":"e98edf6c.945fb","type":"knxUltimate","z":"63da8941.7cd5c8","server":"dcc22daf.66f09","topic":"1/1/1","outputtopic":"","dpt":"1.001","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"花园灯","outputtype":"write","outputRBE":false,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":1450,"y":940,"wires":[[]]},{"id":"cdc6cb5.53c7738","type":"change","z":"63da8941.7cd5c8","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"str","to":"false","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":940,"wires":[["e98edf6c.945fb"]]},{"id":"dcc22daf.66f09","type":"knxUltimate-config","z":"","host":"224.0.23.12","port":"3671","physAddr":"15.15.22","suppressACKRequest":false,"csv":"","KNXEthInterface":"以太网","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":false,"stopETSImportIfNoDatapoint":"stop","loglevel":"info","name":"Gateway","localEchoInTunneling":true}]
案例2,柏林某企业,白天走道区域感应控制,夜晚加班时间禁用感应,并且打开走道灯


流程案例
[{"id":"f6e3115c.7a563","type":"scheduler","z":"63da8941.7cd5c8","outtopic":"","outpayload1":"","outpayload2":"","name":"上班时间","lat":"52.30","lon":"13.25","start":"sunrise","end":"sunset","starttime":"540","endtime":"1020","duskoff":"0","dawnoff":"0","outtext1":"","outtext2":"","sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":false,"sat":false,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"repeat":false,"atstart":true,"x":820,"y":1160,"wires":[[],["6c4037db.c94858"],[]]},{"id":"6c4037db.c94858","type":"change","z":"63da8941.7cd5c8","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"str","to":"false","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":1160,"wires":[["86b2d270.2c76d"]]},{"id":"86b2d270.2c76d","type":"knxUltimate","z":"63da8941.7cd5c8","server":"dcc22daf.66f09","topic":"1/1/2","outputtopic":"","dpt":"1.001","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"感应模式","outputtype":"write","outputRBE":false,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":1160,"y":1160,"wires":[[]]},{"id":"3c76b3b9.5fea7c","type":"scheduler","z":"63da8941.7cd5c8","outtopic":"","outpayload1":"","outpayload2":"","name":"加班时间","lat":"52.30","lon":"13.25","start":"sunrise","end":"sunset","starttime":"1020","endtime":"540","duskoff":"0","dawnoff":"0","outtext1":"","outtext2":"","sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":false,"sat":false,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"repeat":false,"atstart":true,"x":820,"y":1260,"wires":[[],["8d49b526.48fe18"],[]]},{"id":"8d49b526.48fe18","type":"change","z":"63da8941.7cd5c8","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"str","to":"false","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":1260,"wires":[["7d567399.5504fc","2c041599.d3fa0a"]]},{"id":"7d567399.5504fc","type":"knxUltimate","z":"63da8941.7cd5c8","server":"dcc22daf.66f09","topic":"1/1/4","outputtopic":"","dpt":"1.001","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"手动模式","outputtype":"write","outputRBE":false,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":1160,"y":1260,"wires":[[]]},{"id":"2c041599.d3fa0a","type":"knxUltimate","z":"63da8941.7cd5c8","server":"dcc22daf.66f09","topic":"1/1/3","outputtopic":"","dpt":"1.001","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"走道灯","outputtype":"write","outputRBE":false,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":1150,"y":1300,"wires":[[]]},{"id":"dcc22daf.66f09","type":"knxUltimate-config","z":"","host":"224.0.23.12","port":"3671","physAddr":"15.15.22","suppressACKRequest":false,"csv":"","KNXEthInterface":"以太网","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":false,"stopETSImportIfNoDatapoint":"stop","loglevel":"info","name":"Gateway","localEchoInTunneling":true}]
这个节点相当好用而且稳定,大家可以自己试试,唯一的缺点就是不可以过滤节假日,由于全球的节假日太多了,所以这也是情理之中。
网友评论