smithtek-nodered-rtc
v1.8.0
Published
A Node-RED node to set system timezone and sync RTC
Downloads
563
Readme
smithtek-rtc-node
Installation
Install the smithtek-rtc-node
using the NodeRED palette manager
.
Usage
The smithtek-rtc-node
is designed to set and synchronize system time zones and hardware clocks. It leverages system commands to update the timezone and synchronize the hardware RTC module, making it easy for users to maintain accurate system time.
The smithtek-rtc-node is an essential tool for ensuring time synchronization in environments where communication outages are common. By setting and maintaining the system's time and hardware RTC, this node guarantees that all data logged during outages is stamped with accurate timestamps. When used alongside the Smithtek Format and Smithtek Out nodes, the Passport can log and forward data indefinitely with valid timestamps, ensuring consistency and reliability for downstream systems. Additionally, this node simplifies synchronization with daylight saving time (DST) transitions, ensuring your system stays accurate year-round. With its intuitive single dropdown interface, it’s straightforward to configure, making it an indispensable component for robust data logging solutions.
The system retrieves time from NTP servers in ISO 8601 or a related standard time representation.
The time is converted from UTC to the local time selected via the drop down.
Setup smithtek-rtc-node
- Drag and drop the
smithtek-rtc-node
into your Node-RED flow. - Use an
inject
node to trigger the input message. - Select the desired timezone from the dropdown in the node's configuration.
- Inject the RTC node once, after about 5 seconds it will output the success msg.
- Restart your NodeRED flow for it to pick up the new time.
Once the flow is deployed, injecting a message into the node will set the system's timezone to the selected value and synchronize the RTC module. you only have to inject the node once. However it is advised to update at least once a year to correct for time drift. The embedded RTC module has a Accuracy: ±2 ppm (parts per million) from 0°C to +40°C. that translates to around 1 minute per year drift. At extreme temperatures (e.g., -40°C to +85°C), accuracy may slightly degrade to ±3.5 ppm, or about 2 minutes per year.
Its worth noting The system clock will adjust to the new time instantaneously, The NodeRED runtime needs to restarted for it to pick up the new time after every change.
Output
The node outputs a status message indicating success or failure for each operation:
Example output message format:
{
"success": true,
"actions": [
{
"action": "Set timezone",
"success": true,
"output": ""
},
{
"action": "Synced RTC",
"success": true,
"output": ""
}
]
}
How to Use the Node
- Drag and configure the node in your flow.
- Use an
inject
node to trigger the operation. - Monitor the output message to verify success.
Example Flow
Copy and import this example flow to see how the node works:
[
{
"id": "example-flow",
"type": "tab",
"label": "RTC Example Flow",
"disabled": false,
"info": ""
},
{
"id": "inject-node",
"type": "inject",
"z": "example-flow",
"name": "Trigger RTC Update",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 150,
"y": 100,
"wires": [["rtc-node"]]
},
{
"id": "rtc-node",
"type": "smithtek-rtc",
"z": "example-flow",
"name": "",
"timezone": "Australia/Sydney",
"x": 400,
"y": 100,
"wires": [["debug-node"]]
},
{
"id": "debug-node",
"type": "debug",
"z": "example-flow",
"name": "RTC Output",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 650,
"y": 100,
"wires": []
}
]
License
Copyright (c) 2023 www.smithtek.com.au
Licensed under the terms of the GPLv3
Acknowledgements
Special thanks to:
- Nick O'Leary and Dave Conway-Jones for their invaluable contributions to the Node-Red community.
Contact: [email protected]
Website: www.smithtek.com.au