Update 2022/09/26 !!! Attention !!! With Tasmota version 12.x and later, HomeAssistant Autodiscovery is removed from Tasmota in favour of a new Tasmota-Autodiscovery. At the moment this is not compatible with OpenHAB.
It is still possible to add channels manually, but to use HomeAssistant Autodiscovery your only chance is to use an older Tasmota version up to 11.1.0
[OH3] Tasmota via MQTT Autodiscovery
This tutorial is meant to show how to setup openHAB3 and Tasmota with HomeAssistant Autodiscovery
Overview
This tutorial assumes you have
openHAB3 installed
MQTT up and running (if not, have a look at this great tutorial from hafniumzinc)
Tasmota installed on your device and already connected to Wifi
This tutorial will show you how to:
- checking pre-requisites
- prepare Tasmota-Settings for Autodiscovery
- activate Tasmota HomeAssistant Autodiscovery Feature
- create new Thing from Inbox
- create Items from Thing and add to semantic model
Im my example I used a Sonoff S20 with attached Temperature-Sensor, but this should work with all Tasmota-flashed devices.
Automatic discovery is currently supported for: - Buttons - Lights - Relays - Sensors - Switches - Fans
1. checking pre-requisites
To be able to use MQTT-Autodiscovery, you need the MQTT-Binding
And a connected MQTT Broker
And you need at least two transformations from Settings → Transformations
JSONPath and Jinja
2. prepare your Tasmota-Device for Autodiscovery
As far as I know autodiscovery was working since Tasmota version 6.x but it is highly recommended to use an actual Version. At the time this is written, Tasmota 9.2.0 is the latest and greatest. Your version can be found on the device mainpage of your Tasmota-Device
UPDATE 2022/09/26 From Tasmota 12.x and later HomeAssistant Autodiscovery is no longer supported by Tasmota. Please use an earlier version to be able to follow this tutorial until openHAB is updated to support the new Tasmota-Autodiscovery again.
First go to Configuration → Configure MQTT and insert your broker-settings
Be sure you use a unique Client-Name and Topic, not used by another MQTT-Device in your network.
Second go to Configuration → Configure Other , set the DeviceName and enable MQTT
3. activate Tasmota HomeAssistant Autodiscovery Feature
Autodiscovery-Activation has to be done via the Tasmota-Console, there is no WebUI for this
So please navigate back to you main-menu and select → Console
Now enter ‚SetOption19 1‘ and hit enter
Tasmota should respond with something like that
4. create new Thing from Inbox
Back in openHAB you should get a new discovered device automatically in your inbox
If you click on the Inbox Label, you get directly in the Inbox with the new device
Then clicking on the new autodiscovered device will ask you to create a new thing
You can edit your new Thing-Name and then proceed by clicking OK
Now the new Thing is created and you can find it in the list of Things to have a look at the details
Thing-Details
Thing-Channels
from this view, you can add the new thing to your semantic model and create corresponding items
5. create Items from Thing and add to semantic model
In the channel-view click on ‘Add Equipment to Model’
(1) select where in your model the new equipment should be located
(2) + (3) configure the Relais and the Temperature-Sensor
Now the new Device is completely integrated
and can be used in the semantic model, too
For example you will get the Temperatur of the sensor in the automatically created properties-tab on the homepage, along with other Temperature-Items
or you can control the relais from the Equipment-TAB → Equipment