Add Raspberry Pi System stats (CPU, RAM, Storage) to HabPanel
In the previous chapter we already did the first actions in HabPanel without the introduction to HabPanel. We will go on at the same dashboard as the chapter before without more details about HabPanel itself. There will be an introduction when we add the first devices to HabPanel.
In this chapter we will add tiles with CPU load, Memory usage and the used storage space to see how loaded the Raspberry Pi is. First we need to create items in OpenHab, that will represent this values. To do so, go to the OpenHab start page and select the “PAPER UI” tile. In the Paper UI, you can configure many things for OpenHab like devices (“things”), counter of this devices (“items”) or install the interfaces to the devices (“bindings”).
To get the values of our Raspberry, we need to install a binding first. In the navigation bar, click on “Configuration” and “Bindings” and select the second tab called “Bindings”. After that search for “system” in the search bar.
You will see the “System Info Binding” as a search result. That is the binding we need to get our values. click on the “INSTALL” text next to it. The binding will be installed. When the installation is done, the “INSTALL”-Text will be replaced with “UNINSTALL” and the icon of the binding is turning blue.
Now, click on “Inbox” in the navigation and after that on the big blue circle with the plus to add a new thing to OpenHab that will be our Raspberry Pi.
You will get to a dialog where you have to choose the binding you like to use to add. Select the “Systeminfo Binding”.
It will find a thing called “Local computer”. Click on the blue checked circle of that entry.
Now you can name the thing we will add. I name it “Raspberry SmartHome”. You can name it like you want. When you confirm the dialog, the thing is added to your OpenHab environment. You can verify that at the “Configuration” => “Things” page. You will find your Raspberry as a thing added to OpenHab.
Now we need to create items. Items are representing a value (“channel”) of a thing that we can use to show on HabPanel or we can use in a rule script later. To do this, click on the thing at the “Things”-Page. A new page will be shown, that will show all values we can add an item for. First we will add an item for the free and available memory in percent. To get this, click on the blue circle in front of the “Available (%)” channel.
A new popup will be shown, that will ask you if you like to use an existing item for that channel or if you like to create a new one. This is our very first item, so we need to select “Create new Item…” from the dropdown list.
Another popup will appear. We will use the default values and click “Link” at the bottom right corner.
We will do the same, including the select of “Create new item…” for the following channels:
- Physical Memory => Used (%)
- Storage => Available (%)
- Storage => Used (%)
- CPU => Load
After we did this, change via Navigation to the page “Configuration” => “Items”. You should see this:
If that is the case, we successfully added the items we need to create the tiles we like to create on the HabPanel.
Now we need to configure HabPanel, so go to the HabPanel on the OpenHab starting page and open the “System” dashboard we created before. Hover the mouse over the “System” text at the top right and click on the pencil that will appear at the right of the text to edit the dashboard.
Click on “Add Widget” at the top right and select “Knob”.
A new tile will appear. Click on the three dots at the top right corner of the tile and select “Edit”.
In the first “General” tab of the popup you can define the Name of the knob that will be displayed on the tile. We will name it “CPU Load”. In the “openHAB item”-Combobox select the item, that ends with “Cpu_Load”. Finally enable the comboboxes “Disable interaction” and “Show name (below value)” and click “Save”.
You can now move the knob to another position on the page by moving the pointer over the “knob” text at the top left of a tile and after that drag the tile somewhere else. You can also change the size of the tile like mentioned in the chapter before.
Click at “Save” and after that on “Run” on the top left corner when you are done. You should now see the current load of the Raspberry symbolized by a circle. The whole page, including the logs, may look like this now:
Repeat the steps before with using the items ending with “Memory_Used” and “Storage_Used” to add knobs for memory and storage. This should look like this afterwards:
Save and Run the changes and you will have this nice page that is showing you the load of the Raspberry as well as the latest log entries.