当前位置 : 主页 > 编程语言 > python >

Node-RED中配置周期性执行、指定时间阶段执行、指定时间执行事件

来源:互联网 收集:自由互联 发布时间:2023-03-22
场景 在inject节点可以设置重复触发的周期性事件。 比如每两秒输出一次时间。 注: 霸道的程序猿 获取编程相关电子书、教程推送与免费下载。 实现 1、周期性执行 json示例数据 [{"i

场景

在inject节点可以设置重复触发的周期性事件。

比如每两秒输出一次时间。

Node-RED中配置周期性执行、指定时间阶段执行、指定时间执行事件_nodered

注:

霸道的程序猿 获取编程相关电子书、教程推送与免费下载。

实现

1、周期性执行

Node-RED中配置周期性执行、指定时间阶段执行、指定时间执行事件_bc_02

json示例数据

[{"id":"71107f63.c2686","type":"inject","z":"f8f370d9.7ccc3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":280,"wires":[["6866ece6.3b1964"]]},{"id":"6866ece6.3b1964","type":"debug","z":"f8f370d9.7ccc3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":420,"y":300,"wires":[]}]

2、指定时间阶段周期性执行

Node-RED中配置周期性执行、指定时间阶段执行、指定时间执行事件_json数据_03

json数据

[{"id":"2ee46c27fe222be5","type":"inject","z":"4bc32962b964d23d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"*/1 0 * * 1,3,5","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":190,"y":360,"wires":[["26092280afbca76a"]]},{"id":"26092280afbca76a","type":"debug","z":"4bc32962b964d23d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":400,"y":380,"wires":[]}]

3、指定时间执行

Node-RED中配置周期性执行、指定时间阶段执行、指定时间执行事件_nodered_04

json数据

[{"id":"9e4a370a93991fdc","type":"inject","z":"4bc32962b964d23d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 12 * * 1","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":190,"y":500,"wires":[["4af3067548fcc9f6"]]},{"id":"4af3067548fcc9f6","type":"debug","z":"4bc32962b964d23d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":380,"y":540,"wires":[]}]
网友评论