This tutorial will show how to calculate temperature delta based on the readings from the indoor outdoor warehouse thermometers.
Let’s assume you have a warehouse with two thermometers: indoor and outdoor. In this tutorial, we will configure ThingsBoard Rule Engine to automatically calculate the delta of temperatures inside and outside the warehouse based on the latest readings from temperature sensors. Please note that this is just a simple theoretical use case to demonstrate the capabilities of the platform. You can use this tutorial as a basis for much more complex scenarios.
We assume you have completed the following guides and reviewed the articles listed below:
We will create one asset that has name “Warehouse A” and type “warehouse”.
We will create two devices that have names “Inside Thermometer” and “Outside Thermometer” and accordingly with types “inside thermometer” and “outside thermometer”.
We must also create the relation between asset “Warehouse A” and device “Inside Thermometer”. This relation will be used in the rule chain to change originator of the messages from the thermometer to the warehouse itself and also the relation from device “Inside Thermometer” to device “Outside Thermometer” to fetch the latest temperature from “Outside Thermometer”.
Note: Please review the following documentation page to learn how to create assets and relations.
In this section, we explain the purpose of each node in this tutorial. There will be three rule chains involved:
“Thermometer Emulators” - optional rule chain to simulate data from two temperature sensors;
“Root rule chain” - rule chain that actually saves telemetry from devices into the database, and filters messages by device type before redirecting it to “Delta Temperature” chain
“Delta Temperature” - rule chain that actually calculates delta temperature between thermometers in the warehouse and outside;
Nodes A and B: Generator nodes
Node A: Indoor Thermometer emulator
Note: in the real case, the device type is set to the message metadata by default.
Node C: Rule Chain node
Nodes D: Rule Chain node
Node E: Switch node.
Nodes F and G: Transform script nodes
Two similar nodes that changes key names from message payload from “temperature” to “indoorTemperature” or “outdoorTemperature” depending on relation type from the previous node.
Creates a new outbound message in which it puts the new telemetry.
Node F: Change to Outdoor
Node H: Change originator node.
Node I: Save Timeseries node.
Node J: Originator attributes node.
Node K: Transform script node.
Node L: Save Timeseries node.
Download and import attached emulators rule chain file as a new “Thermometer Emulators” rule chain, root rule chain file as a new “Root rule chain” and “Delta Temperature” file. Please note that some nodes have debug enabled.
Getting started guides - These guides provide quick overview of main ThingsBoard features. Designed to be completed in 15-30 minutes.
Installation guides - Learn how to setup ThingsBoard on various available operating systems.
Connect your device - Learn how to connect devices based on your connectivity technology or solution.
Data visualization - These guides contain instructions how to configure complex ThingsBoard dashboards.
Data processing & actions - Learn how to use ThingsBoard Rule Engine.
Hardware samples - Learn how to connect various hardware platforms to ThingsBoard.
Advanced features - Learn about advanced ThingsBoard features.
Contribution and Development - Learn about contribution and development in ThingsBoard.