smithtek-node-red-format
v1.4.0
Published
A custom node for Node-RED to format messages with timestamps.
Downloads
15
Readme
smithtek-node-red-format
Installation
Install the smithtek-node-red-format
using the NodeRED palette manager
.
Usage
The smithtek-node-red-format
node is tailored for the SmithTek cloud platform. Its primary purpose is to transform and enrich JSON messages with essential metadata, such as timestamps. It also auto-detects and formats GPS data in the messages, providing seamless integration for users to set up their GPS locations on the SmithTek cloud platform.
Setup smithtek-node-red-format
- Drag and drop the node into your Node-RED flow.
- If using multiple sensor data sources, connect a
join
node before this node. - Ensure the input message is in JSON format.
The node will append an epoch timestamp to your JSON message. This timestamp can be sourced from the system's CPU time or from the global context "gnstime" if available. If the node detects GPS properties like "position", "lat", and "lng", it will format the GPS data accordingly.
Tick the box for global context timestamp Not ticked it will use the CPU timestamp
Warning
The CPU time is not suitable if your PassPort restarts during a store and forward operation and the WAN network is not available. You must make sure your network connection reliable.
Output
The node outputs the enriched JSON message. If GPS properties are detected, the output will also be formatted to include this data in the requisite SmithTek cloud format.
Functionality
- Timestamp Addition: Every message is enriched with an epoch timestamp.
- GPS Data Handling: Automatic detection and formatting of GPS data, if present in the input.
How to Use the Node
- Integrate the
smithtek-node-red-format
node into your flow. - Feed it the expected JSON format containing your sensor data.
- Connect this node's output to the next component in your flow to get the enriched message.
Standard Sensor Data:
{ "sensor1": 1234, "sensor2": 4567 }
json objects with the gps detection must include the "position" "lat" "lng"
properties. the position can have any value to ensure it is a valid key/pair
{ "sensor1":1234, "sensor2":4567, "position"1 "lat":52.12345 "lng":0.1234 }
License
Copyright (c) 2023 www.smithtek.com.au
Licensed under the terms of the GPLv3
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"... [The rest of your license text]
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