The “Open Home Automation Bus” (openHAB) is an open-source, technology-agnostic home automation platform that serves as the heart of the smart home. In addition to
400+ add-ons for several types of technologies, openHAB offers a special MQTT add-on (“binding”) for connecting to systems like Tasmota.
You can monitor, control and manage Tasmota modules from your openHAB system by following the guide below. If you are new to openHAB, you must learn the basic concepts and everything about the initial setup. The following articles do not cover the basics outside the scope of Tasmota integration.
Requirements:
- Working OpenHAB installation.
- MQTT broker available (e.g. Eclipse Mosquitto via openHABian)
- Configured Tasmota device (accessible from your local network)
- Working and tested connection between openHAB and the MQTT broker
- A basic understanding of MQTT
- Standalone MQTT client (e.g. MQTT Explorer) to observe and identify messages on the MQTT broker (optional)
If you haven’t already done so, you first need to install and enable MQTT and the JsonPath transform, from the openHAB Paper UI Add-ons section.
MQTTv2 Integration
The configuration is spread over several openHAB configuration files. To begin with, you must set up an MQTT connection and Tasmota. You must have a separate one for each Tasmota device you use.
The sample configuration shows the full non-default topic definition. Simply set the elements of the Tasmota MQTT topic of interest to your real-world device. Here are some examples of the most commonly used topics: See the “Discover Interesting Topics” section below for information on how to view raw MQTT data. Some Tasmota themes are JSON encoded and you can extract this data using the JSONPATH transform.
You should replace the example device topic name provided (such as “Tasmota_TH”) with the one you chose for your module.
.items File – For every property your device exposes, you will have to define an item, linked to corresponding channel of your Tasmota thing.
The topic “LWT” (“Last Will and Testament”) receives normal “online” messages from the module and “offline” messages generated by the MQTT broker just after the module has disconnected. These messages are converted to valid on/off states by MAP transformation. Of course, you can implement Unreachable instead of Reachable if you prefer.
Maintenance Actions
No home automation system setup is complete without maintenance automation.
Add the following items to your openHAB setup to enable actions on Tasmota devices with the push of a simple sitemap button.
Comparing your device firmware with the current Tasmota GitHub Release
It would be nice to know the firmware version of your device. A direct comparison to the current release is even better. This can be achieved by combining maintenance actions with openHAB’s http bindings, JsonPath transforms, and the GitHub API.
Just extend the maintenance setup with the following items and configurations (make sure you have the binding addon http and the transform addon jsonpath installed).
Discovering Interesting Topics
You can easily find additional or additional topics of interest by reading the Tasmota wiki and subscribing to topics in modules. Subscribe to all topics in the module using the MQTT wildcard topic string /tasmota_XYZ/# (the string depends on the topic /FullTopic configured by the user).