Fun With Dick and Jane (Temperature and Humidity) July 21, 2016 09:32
If you are new to the Advanced Topics, then you might want to start with an overview here.
Let's build a custom User Interface to display the Temperature and Humidity of a particular hive.
We will go to our trusty Node-RED interface in our System Recorder and create a new tab by clicking on the + sign in the upper right corner.
For now we can leave the name of the tab at Flow 1.
All the data that comes into the System Recorder from the sensors is dandled by a "message broker" called "MQTT". You can read about MQTT messaging here. Go over to the left hand list of nodes and find the mqtt input node. Drag the node into the main window.
Double click on the node. A dialog box will pop up.
Click on the pencil icon to the far right of "Server" and the server config dialog will open.
Enter localhost for the server, leave everything else inchanged.
Now, back in the mqtt dialog.
Enter "Lagarto-SWAP/simple/status/#" without the quotes for the Topic. This is basically telling Node-RED to subscripe to all data changes (status/#) coming into the System Recorder over the wireless radio link. (# is a wildcard).
We also gave the node the name "Get Data", you are free to call it anything you want.
Just for grins (and to help diagnose problems if they arise), let's add a debug node from the left column under "Output". We'll wire it up to the ourput of Get data.
Double click on the debug node and change "msg.payload" to "msg.topic", then click OK.
Click Deploy in the upper right corner.
Select the Debug tab on the right just under Deploy and click the "Button" just to the left of the debug node. Now any messages that come into Get Data will be displayed in the right side debug panel.
Here two messages have come in from the Get Data node. Note that their full message topics are Lagarto-SWAP/simple/status/Monitor/Voltage_43 and Lagarto-SWAP/simple/status/SWAP/RAWWeight_43.
Remember the how Get data had the Topic "Lagarto-SWAP/simple/status/#" with the wild card "#"?
Now let's go ahead and add the Switch element from the Function nodes and configure it so:
Notice that we have defined two outputs, one for messages that contain "Temperature_21" and another for messages that contain "Humidity_21".
Now lets wire up a couple of debug nodes, deploy and test the system.
If everything is working OK, we can scroll down the list of nodes on the left and find the UI (User Interface) nodes. Drag a couple of the gauge nodes over and wire them up as shown.
Double click on the top gauge and configure it so:
The Tab name is important and it should be the same as the tab name for the Humidity gauge. The name "Temperature" should be meaningful. The min and max values will control the appearance of the gauge as we will see later. The temperature that we are using is in C, so -10 to 30 seem reasonable.
Do the same for humidity, setting the limits as 0 and 100.
Now go to http://bees032.local:1880/ui/ and select "Hive 21" from the menu on the left. Remember the "Hive 21" we entered in the setup dialog earlier?
That's it! You have now configured your System Recorder to extract specific temperature and humidity information and display that information in your first custom User Interface. Congrats!
To the Heart of the Matter July 21, 2016 07:42
At the heart of the System Recorder, there is an Open Source program called Node-RED. You can learn more about Node-RED here. We'll assume that the name of the System Recorder is bees032, and that you can access your system recorder by going to http://bees032.local/
If that is working, then you should be able to go to the Node-RED console at:
On the left is a menu of nodes, while the main window gets the data, does some filtering on that data and then sends the data to the InfluxDB database.
IT IS BEST TO NOT MESS WITH THIS FLOW SINCE IT IS WHAT MAKES THE WHOLE SYSTEM WORK.
Next up, we'll show how to make a custom User Interface to display temperature and humidity.
Trying Out Advanced Features July 21, 2016 07:35
The System Recorder is an amazing piece of hardware. In this series of posts I will talk about the heart of the recorder and how it can be adapted for custom applications.
Remember, none of the material in this Blog is required to use the system. This is only for those that want to be adventurous.
OK, as a Flight Attendant once said, "fasten your seat belts, we're about to go Really Fast".