UNPKG

@redplc/node-red-time

Version:

Node-RED nodes for get System-Time or NTP-Time using with redPlc nodes

43 lines (37 loc) 2.04 kB
# @redplc/node-red-time [![platform](https://img.shields.io/badge/platform-Node--RED-red)](https://nodered.org) [![platform](https://img.shields.io/badge/platform-redPlc-ffa500)](https://flows.nodered.org/node/@redplc/node-red-redplc/) <a href="https://www.buymeacoffee.com/iiot2ka" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-red.png" height="41" width="174"></a><br> If you like my work and find it helpful, please support me with a small donation. Node-RED nodes for get System-Time or [NTP-Time](https://en.wikipedia.org/wiki/Network_Time_Protocol) using with [redPlc](https://www.npmjs.com/package/@redplc/node-red-redplc/) nodes.<br> ## Nodes - **sys-time**: Reads System-Time and store in number array. - **ntp-time**: Reads NTP-Time and store in number array. - **calc-time**: Calculates time difference or convert time. ## Usage - Install [redPlc](https://www.npmjs.com/package/@redplc/node-red-redplc/) nodes. - For logical operations use redPlc nodes. - Data is exchanged with global context variable arrays. - The variable is updated cyclically. - A very quick query of the NTP server can lead to blocking of the ip. ### Time/Date Elements Array-Index |Element|Value|Index| |---|---|---| |Seconds|0 .. 59|0| |Minutes|0 .. 59|1| |Hours|0 .. 12/23|2| |AM/PM|0=AM, 1=PM|3| |Weekday|0 .. 7, 0=Sunday|4| |Day|1 .. 31|5| |Month|1 .. 12|6| |Year|YYYY|7| |since epoc|ms|8| ## Example This example switches on a consumer (e.g. lamp) on days of the week<br> and between hour range.<br> The redPlc module **sys-time** reads the system time and saves it in the variable IA99.<br> The day of the week is stored in index 4 (0 = sunday, 1 = monday ..) and the hours in index 2.<br> The days of the week are queried with the compare node.<br> After that, the start and end hours are queried with the compare nodes in series.<br> If all queries are fulfilled, the Raspberry Pi output is switched on.<br> Select in module node **rpi-gio-out** GPIO26 as output.<br>