Use MQTT with Tasmota Power Socket

  • Platform information:
    • Hardware: _Raspberry 3B
    • OS: _raspbian 5.4.35-v7+
    • openHAB version: 2.5.0-1

Hello,

I have been trying since few hours to use OH with MQTT.
I found various instructions on the Internet, but they either do not work or are out of date

I have some Tasmota power sockets which are controlled by MQTT.

Actually i have an RPI3 with raspbian where openhab is installed on.
I have installed mosquitto and mosquitto-clients over shell and also installed follow services /add ons:
MQTT Embedded Broker, MQTT system broker connection, MQTT Broker Moquette

Does anyone can help me what i really need to get OH connected to a Tasmota device?

This is my current device which i want to connect to:

Thanks,

Webfeger

Most answers you find on the forum will use the (openHAB external) MQTT broker Mosquitto and not the embedded broker nor Moquette.
I would suggest the same.
Additionally you do need a Broker Thing,m which makes the (bridge) connection from openHAB to the broker.
For all clients (the Tasmota devices) you would need to create generic MQTT Things, who ch connect to the MQTT BROKER thing.

Tasmota (assuming a recent version) supports automatic discovery using the Home Assistant MQTT topic standards. If you enable that on the Tasmota device than in openHAB all you need to do is go to the Inbox -> + -> MQTT and the tasmota device will be discovered and Things created for it automatically. This assumes you have the Broker Thing created and successfully connected to the same broker as the tasmota devices of course.

1 Like

Thanks for info. I’ll try it with generic MQTT

Does there exist a howto how i eactly create a correct channel for tasmota device ?
I still dow’t know how the broker will find this device because i never saw a place where i can enter the ip-address of the tasmota device.

You would do well to review some basics on how MQTT works. https://www.hivemq.com/mqtt-essentials/

That’s not how MQTT works. You configure your Tasmota devices to connect to the MQTT broker. You configure your openHAB to connect to the MQTT broker (the Broker Thing). They never connect to each other directly.

The way you configure an MQTT Channel is the same no matter what broker you are using and no matter what devices are publishing/subscribing. You need to learn what topics your Tasmota device publishes to and configure your Channel to subscribe to that. You will likely need to apply a transformation to extract and transform the message Tasmota publishes into a format that is suitable for the openHAB Item it will be linked to. For the topics the Tasmota device subscribes to you need to figure out what format messages need to be in that it accepts. Then configure the Channel to publish to that topic. You will likely need to apply a transformation to convert the Item state to the format that the Tasmota device understands.

All things considered, it would be way less complex and less work for you to just use the automatic discovery. All that’s done for you.

Thanks for Help!!

i figured out that MQTT settings on tasmota was wrong. Thats why i never got it working.