Page 1 of 1

Tasmota MQTT Domoticz

Posted: Monday 15 March 2021 8:34
by FredZ
Hello all

Been struggling with this for four days and can't seem to see the wood for the trees.

Scenario:
Domoticz
Version: 2020.2
Build Hash: b63341bc0
Compile Date: 2020-04-26 23:47:55
dzVents Version: 3.0.2
Python Version: 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]

It is install on a debian buster VM

Sonoff 4CH_PRO_R3
Flashed with Tasmota 9.1.0

MQTT
have installed mosquitto server/client on the buster server. Only a default install. No alterations.

In the dom log I see the line

Code: Select all

2021-03-15 19:52:20.236 (Tasmota MQTT) MqttClient::onConnect: MQTT Server: localhost:1883 as Domoticz_1615788868_6218
In the Sonof consol I get

Code: Select all

07:56:54 WIF: Checking connection...
07:56:56 MQT: Attempting connection...
07:56:56 MQT: Connect failed to 192.168.1.25:1883, rc -2. Retry in 10 sec
192.168.1.25 is the ip of the dom vm where mosquitto is installed.

The Sonoff/Tasmota has defaults for MQTT with the host set to 192.168.1.25

I'm obviously missing something as i'm going round and round in circles getting knowwhere.

If someone would be so kind as to point me in the direction of a howto/information I would be most appreciative as I'm about to file yet another device in the draw as unusable. I have a large collection already.

Your comments would be most helpful.

Regards

Fred

Re: Tasmota MQTT Domoticz

Posted: Monday 15 March 2021 9:01
by eddieb
make sure mosquitto is running and listening
root@domoticz:~# netstat -atnp | grep LISTEN | grep mos
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN 588/mosquitto
tcp6 0 0 :::1883 :::* LISTEN 588/mosquitto
the message in your tasmota devices says it cant connect to your mosquitto server, double check if that port 1883 is reachable ...

Re: Tasmota MQTT Domoticz

Posted: Monday 15 March 2021 9:34
by waaren
FredZ wrote: Monday 15 March 2021 8:34 If someone would be so kind as to point me in the direction of a howto/information I would be most appreciative as I'm about to file yet another device in the draw as unusable. I have a large collection already.
To confirm both the MQTT service and domoticz MQTT config are OK:

Open a CLI session on your domoticz server and issue below command

Code: Select all

sudo mosquitto_pub -h 192.168.1.25 -m '{"command" : "addlogmessage", "message" : "MyMessage to log" }' -t domoticz/in
You should see in the domoticz log that it received and processed the command.

btw. If the mosquitto_pub command is not recognized you should install the mosquitto clients first; using:

Code: Select all

sudo apt install mosquitto-clients

Re: Tasmota MQTT Domoticz

Posted: Monday 15 March 2021 15:40
by djreesing
I had a similar problem after updating mosquitto. Seems to from version 2.0.0 onward the default config will only bind to localhost and refuses connections from other machines than mosquitto is running on.

To fix this edit the /etc/mosquitto/mosquitto.conf file and add:
listener 1883
allow_anonymous true

Note that his will give access to the mqtt broker for all devices on your network

Re: Tasmota MQTT Domoticz

Posted: Monday 15 March 2021 16:05
by waltervl
djreesing wrote: Monday 15 March 2021 15:40 I had a similar problem after updating mosquitto. Seems to from version 2.0.0 onward the default config will only bind to localhost and refuses connections from other machines than mosquitto is running on.
See also viewtopic.php?f=28&t=35706 and https://www.domoticz.com/wiki/MQTT#Installing_Mosquitto