In one of our last articles we showed how easy it is to install OpenHABian and how the smart pool controller is integrated in OpenHab.Thanks to the many inquiries, I would like to discuss the configuration and functionality of the smart home server with you today: We install a binding, search for things, create an item and display the content via HabPanel without having to write a single line of program code.
The aim is to prepare everything for an ESP with ESP-Easy via in a follow-up article MQTTto integrate into our smart home.
We have OpenHAB here Installed. The web interface is already accessible immediately:
If you have never used or seen OpenHAB before, it is helpful to use "Demo", some examples are already pre-installed. We choose "Standard" and start with an empty system.
You can check out the demo data at any time here operate via GitHub.
Immediately afterwards we are asked for the GPS position, this is important for the function of several bindings. However, we can still change this later.
After a short time, OpenHab has adopted the settings we have specified and, after refreshing the page, also shows several buttons:
At this point I would like to point out that the available documentation the developer is quite complete and many tutorials for setting up OpenHAB are also available in German, which is why we do not fully configure OpenHAB here and do not go into all the installed bindings.
There are various options for installing additional packages. For each we need access to the command line: Open the "Powershell"" CMD "or Putty and connect with via SSH with OpenHABian. You will find the IP address in your router, the registration in our test network looks like this:" ssh email@example.com "Then we see:
We follow the advice of the header and start with "sudo openhabian-config"
I recommend here urgent the software about "30 | System Settings"first to configure and then to update. Adjust the menu items to your needs (password!), one or the other restart may be necessary. An update / upgrade is also recommended.
Under "20 | Optional Components" we can install additional software:
We need Mosquitto because our smart home needs a broker for MQTT, and are then asked for a password:
I would like to suggest a more advanced user to assign a password, beginners are better off without the point because the option is problematic in some respects. After configuration with openhab-config, a restart is mandatory.
Back to the web interface: Open the PaperUI
As we can see, the inbox is still empty because we have not yet installed any extensions (binding).
OpenHab differentiates between physical and virtual objects and names these things and items. Things have channels, items have values. Here's an example:
An ESP with BME280 is a thing. The thing has channels such as Temperature or humidity. These channels can be linked to items. An item receives its value via the channel. The item is the virtual counterpart to the thing and basically represents the "packaging" or the framework for the values. Items can also be thought of as functions. This may be somewhat confusing for beginners.
Things can be found by OpenHAB with the right binding in the inbox (above in the screenshot). You must define items yourself if you do not use simple mode. We will explain this using examples.
First, adjust the setting so that the channels are automatically linked, activate the Simple mode.
Don't forget "Save" at the bottom of the page so that the settings are applied.
So we start with the installation of bindings to find the first things in our smart home with Auto-Discovery.
Under "Add-ons -> Bindings" you will find a wide selection of plugins that we can load:
Popular examples are astro-binding, NTP binding or network binding. For later use of MQTT, you should also install the appropriate binding. As a simple example, I'm showing NTP binding today. After installation, the entry (Thing) appears in the Inbox.
Many readers will now wonder where the hardware stands for the Thing because Things are actually physical objects. Well, that's right. However, it is also possible to use web services or similar. I deliberately skipped this in the above statement so as not to create even more confusion.
In the Inbox, add the found Thing (Local Time) OpenHab by clicking on the blue button
And then choose "Add as Thing". This binding only works correctly if you have specified the GPS position of your system. We now find the Thing under "Control"
You can configure the Thing by clicking the small icon in the upper right corner. You will then see the two channels of the thing and have the option to change the NTP server in the blue button above.
Since simple mode has been used, an item has been created automatically. In most tutorials on the web, the items are created manually. Manually created items are preferred by most users. However, to do this, you must create the files and entries manually. You will not find automatically generated items as specified in the documentation under /etc/openhab2/items, but are stored in a JsonDB. The path of the database is /var/lib/openhab2/jsondb
In short, we now have a thing with two channels and linked items.
The actual (and manual) way to configure OpenHab would be to install the bindings, define things with channels, create the items, and then create the sitemaps.
Since a manual creation of the Things, Items and Sidemaps requires a lot of programming effort, a "Home Builder" is now supplied with which the scaffolding for the smart home can be created relatively comfortably. You can find it in the web interface:
How this is used to create items and sitemap manually, we will show you in a follow-up post.
To display the value of the item without programming knowledge, we use HABPANEL today. When I click on the panel, a small assistant starts, I have taken screenshots here:
We need a new dashboard
For your smart home, simply name the dashboard accordingly
It should be mentioned that the configuration is normally only stored locally on your computer. If you want to use the panel on several devices it makes sense to store this under "Panel Settings" on the right.
When you reload the page, you will only find the empty dashboard:
Click on the dashboard to get to this page:
When you hover over the box with the name at the top right, a small icon (pen) appears. Now we can add widgets:
We choose Clock to automatically generate a clock and dummy to explain the principle behind the items:
You can configure the widget using the three dots in the upper right corner. There are not many options for the NTP widget:
Different with dummy:
In the dropdown menu "openHAB Item" you will find all created items, regardless of whether they were created in the database or in the * .items file (i.e. manually). After a final saving, we select "Execute" in the dashboard to display the new widgets:
Although the values are updated automatically, the time in the dummy widget is only updated every 60 seconds. This is because in the Thing NTP the time is only queried every minute:
We have now reached the end of today's post. Since OpenHAB covers a huge subject area, we will deal with individual points in subsequent contributions. In the next post on this topic we measure a temperature with ESP-Easy, transfer the value via MQTT and present the result in the BasicUI and HABPanel.
Until the next post :)