UbidotsEdge
Introduction
The UbidotsEdge is a recipe in the IntelligentEdge, designed to upload CDP Logger's data into the Ubidots IoT cloud at https://ubidots.com/ using MQTT.
Note: The Ubidots cloud part needs no configuration for accepting the data. Nodes will be auto-created with the EdgeName and variables sent by the UbidotsEdge.
UbidotsEdge serves as a data communication pipeline between CDP control systems, such as edge devices, and central telemetry and dashboard service in the Ubidots cloud platform. It leverages MQTT for data transmission, ensuring efficient data handling.
Configuration
Configuration Entry | Description |
---|---|
EdgeName | Represents the unique identifier of the edge node. |
RootTopic | The MQTT topic root under which data will be published (preconfigured). |
APIKey | The Ubidots API Key is needed for authenticating with the Ubidots platform. Register for trial at https://ubidots.com/ to get the API Key. |
The UbidotsEdge block requires a CDP Logger to also be present in the system. Optionally an MQTTBroker from MQTTIO can be added to the system for testing as a fallback when there is no Ubidots cloud connection set up.
Note: The Ubidots cloud is intended for slow telemetry data (up to 4 requests/second) and the UbidotsEdge down-samples all data from CDP Logger to 1 Hz. It is recommended to configure the logged values with Delta
option to reduce unneeded data changes further for such telemetry data.
API Key and Fallback Broker
The API Key is the primary credential for interfacing with Ubidots. If the API Key is not set or is invalid, UbidotsEdge defaults to a fallback MQTT broker at the local address 127.0.0.1:1883.
Architecture
ParametersUpdater
Responsible for updating parameters and ensuring that the EdgeName, RootTopic, and Ubidots Token received from Ubidots using the APIKey are consistently routed within the system.
ExternalControlBroker
Manages the REST mechanism for Ubidots Token retrieval.
ValueUploader
A sub-component that handles the upload process. It uses a ValueLogReader with RangeScanner to read logger data and a JSON encoder to format the data before publishing it to Ubidots via MQTT.
MQTTClient
This component manages the MQTT connection, subscribing and publishing to the Ubidots MQTT broker with the configured client parameters.
Operation Flow
ParametersUpdater
initializes with the set EdgeName, RootTopic, and APIKey.ParametersUpdater.ExternalControlBroker
retrieves the Ubidots Token from Ubidots and configures the MQTT client parameters.ValueUploader
reads logged values, encodes them in JSON format, and prepares them for upload.MQTTClient
connects to the Ubidots MQTT broker and publishes the encoded data.
Integration with CDPLogger
The UbidotsEdge block works in conjunction with CDP Logger to send logged data to Ubidots. It automatically reads values logged by the default CDPLogger at <application IP>:17000 and publishes them to Ubidots in the "multi variable single value" JSON format:
{ "temperature": 10, "humidity": 90, "pressure": 78, "timestamp": 1634311791000 }
Example CDPLogger Configuration
configure: - uri: . add: - name: CDPLogger model: CDPLogger.CDPLogger values: PeriodicLogFrequency: 0.1 add: - name: SineA model: CDPLogger.LoggedValue values: Routing: ..Sine.Output - name: SineB model: CDPLogger.LoggedValue values: Routing: ..Sine1.Output
Note: The example logger is set to sample data every 10 seconds as Ubidots is intended for slow telemetry data. Consider adding a Delta value for each LoggedValue where it seems reasonable to reduce unneeded samples.
In this setup, the CDP Logger logs values from the Sine and Sine1 outputs, which are then automatically picked up by UbidotsEdge for transmission to Ubidots. The measurement names in Ubidots cloud will be the LoggedValue
names SineA and SineB in the CDP Logger configuration.
Advantages
The IntelligentEdge block UbidotsEdge offers a streamlined, code-free approach to interfacing CDP applications with cloud-based IoT platforms. Its configuration-driven architecture reduces complexity and enables quick setup, making it an ideal solution for simple data transmission in IoT and edge computing applications.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.