[SOLVED] MQTT for SONOFF/TASMOTA this is difficult

And don´t know exactly what you mean but I am using a sonoff tasmota basic device and these settings I copied above are the once from that device, it is up and running I can access it via this IP address and I can see the console showing me wrong connections. Copy of this console output is also three messages above.
So Yes I assume the Broker (this sonoff tasmota device) is up and running

To exchange messages tasmota and oh use mqtt. It’s a light weight messaging system.
It needs to be installed and running on your network before the information can pass between tasmota and OH.

Are you using openhabian?

Yes the latest OH2 and installed the MQTT Binding and restarted the device

You need to install mosquitto
the option in is openhabian-config

Hm Sure?
The only thing I can see is under add-ons/Bindings - here the MQTT Binding (installed)
and there is something under add-ons/Actions - MQTT-Action (not installed)

Not in openhab
On the raspi console its self
sudo openhabian-config

See

This sounds reasonable, but didn´t read this before…

I assume you mean this
MQTT Broker eclipse Mosquitto, right?

So just install and restart?

That’s the one install follow in the instructions and leave everything as default
then reboot

So done, but in the Openhab.log I am still getting this error and the sonoff console also showns not connected ( both restarted)

and this is the Openhab.log

Good.

There should now be a file in your conf/services folder called mqtt.cfg
Can you show me the contents of that file, please?

This is the broker
image

and this is the mqtt.cfg
I assume I need to replace “broker” with the broker ID but what is the broker ID?

image

What is the ip address of your raspberry pi?
In the tasmotta you need to chage the host to the ip address of your pi
In the mqtt.cfg you need to change the broker.url=tcp://xxx.xxx.xx.xxx to the ip address of your raspberry pi

don´t understand, I thought the broker is the sonoff tasmota?

OK but the pi IP is 192.168.1.3 and the sonoff is using the .4.
The PI password/user is still openhabian

No, your broker is mosquitto, tasmotta and OH are clients

So Tasmotta:

Host: 192.168.1.3
port: 1883
client sonoff1
Benutzer: doesn’t matter
Passwort: doesn’t matter

mqtt.cfg

broker.url=tcp://192.168.1.3:1883
#broker.user=
#broker.pwd=
broker.clientId=openhab

Restart tasmotta
Restart OH

Loooks better on tasmota but not on pi

this the cfg

this is pi

this is tasmota

Please show me the content of your mqtt.cfg files. ALL of it, please

Your tasmota is connected but OH has a problem.

I’ll be back n 1 hour

This is all standard just added the few lines:

Define your MQTT broker connections here for use in the MQTT Binding or MQTT

Persistence bundles. Replace with an ID you choose.

URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883

#.url=tcp://:1883

broker.url=tcp://192.168.1.3:1883
#broker.user=openhabian
#broker.pwd=openhabian
broker.clientId=openhab

Optional. Client id (max 23 chars) to use when connecting to the broker.

If not provided a random default is generated.

#.clientId=

Optional. True or false. If set to true, allows the use of clientId values

up to 65535 characters long. Defaults to false.

NOTE: clientId values longer than 23 characters may not be supported by all

MQTT servers. Check the server documentation.

#.allowLongerClientIds=false

Optional. User id to authenticate with the broker.

#.user=

Optional. Password to authenticate with the broker.

#.pwd=

Optional. Set the quality of service level for sending messages to this broker.

Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2

(Deliver exactly once). Defaults to 0.

#.qos=

Optional. True or false. Defines if the broker should retain the messages sent to

it. Defaults to false.

#.retain=

Optional. True or false. Defines if messages are published asynchronously or

synchronously. Defaults to true.

#.async=

Optional. Defines the last will and testament that is sent when this client goes offline

Format: topic:message:qos:retained

#.lwt=

of course they do all have the # was somehow dissappeared by copying

So this is now remaining for mqtt.cfg

image