Problems with MQTT auto-discovery

878 views
Skip to first unread message

Ben Barker

unread,
Nov 28, 2021, 3:22:42 PM11/28/21
to TasmotaUsers
I have a series of tasmota devices
The majority of the hardware comprises of: 


Running 9.5.X and 10.0.3 firmware. 
This has been working fine over MQTT for some time, but recently I added a new device, and found that it was not auto-discovered by domoticz. On a bit more digging, I realisesed the existing devices were not being auto-discovered, once removed, either. 

Checking mosquito, I can only see a single device under "homeassistant" in the MQTT tree - despite having explicitly called setOption 19 1 on all devices  (see attached image) 

I can't though see anything different from the config of the one discovered device to all the others...

Mosquitto is version 2.0.12, configured with: 

listener 1883
log_type all
allow_anonymous true

Any ideas what may be occurring? 
 
mqtt.png

Philip Knowles

unread,
Nov 28, 2021, 3:30:39 PM11/28/21
to Ben Barker, TasmotaUsers

I think you have misread the documentation HomeAssistant discovery should be setOption19 0

 

Tasmota Integration~

Once you configure the Home Assistant integration every new Tasmota device with SetOption19 0 set, will be discovered automatically.

All Tasmota devices will be listed in their own Tasmota card in Configuration - Integrations menu in Home Assistant.

Regards

 

Phil K

 

Sent from Mail for Windows

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/d49fd469-1945-45f4-a97f-d2a50c7bc02an%40googlegroups.com.

 

Ben Barker

unread,
Nov 28, 2021, 4:01:15 PM11/28/21
to Philip Knowles, TasmotaUsers
Ah, there is a "yes but" here I think...

I am not in fact using homeassistant - but Domoticz. However, to use the MQTT autodiscovery plugin that ships with domoticz, I have to turn setOption 19 to 1. 


As a test, I set option19 it to zero across all devices  - and in my MQTT client immediately saw all my devices appear in the tree under tasmota>discovery>

But doing this, Domoticz will not see them. 

Conversely, if I enable it, I see only one device in the MQTT tree, though domoticz does see it. 


Ben Barker

unread,
Nov 28, 2021, 4:45:15 PM11/28/21
to Philip Knowles, TasmotaUsers
Interestingly - for the one working device, with logging set to 4: 

As soon as I issue setOption19 On I get a slew of logs showing my the homeassistant MQTT tree: 

22:35:15.557 MQT: stat/doorbell/RESULT = {"WebLog":4}
22:35:15.983 CFG: Saved to flash at F7, Count 109, Bytes 4096
22:35:31.708 MQT: stat/doorbell/RESULT = {"SetOption19":"ON"}
22:35:32.783 MQT: homeassistant/binary_sensor/E35FC7_SW_2/config =  (retained)
22:35:32.786 MQT: homeassistant/device_automation/E35FC7_SW_3_TOGGLE/config =  (retained)
22:35:32.788 MQT: homeassistant/device_automation/E35FC7_SW_3_HOLD/config =  (retained)
22:35:32.790 MQT: homeassistant/binary_sensor/E35FC7_SW_3/config =  (retained)

With all the other devices, I get nothing related to homeassistant in the MQTT logs at all: 

22:32:55.595 CMD: SetOption19 1
22:32:55.597 SRC: WebConsole from 192.168.1.154
22:32:55.600 CMD: Grp 0, Cmnd 'SETOPTION', Idx 19, Len 1, Data '1'
22:32:55.605 MQT: stat/spareroom/RESULT = {"SetOption19":"ON"}
22:32:56.196 MQT: tasmota/discovery/D8BFC0521CAE/config =  (retained)
22:32:56.199 MQT: tasmota/discovery/D8BFC0521CAE/sensors =  (retained)
22:33:12.265 WIF: Checking connection...

Philip Knowles

unread,
Nov 28, 2021, 4:48:30 PM11/28/21
to Ben Barker, TasmotaUsers

Have you followed the steps on here?

 

Domoticz - Tasmota

Ben Barker

unread,
Nov 28, 2021, 4:57:04 PM11/28/21
to Philip Knowles, TasmotaUsers
Yes. However, I think I am narrowing down the problem: 

I have used the standard tasmota.bin.gz binary and all works fine 
The devices I am largely using are running scripting - which is not enabled by default 

But is in the "unofficial" builds: 

It looks like something in these builds is causing MQTT autodiscovery to fail. I'll have to see if I can work out what...


Philip Knowles

unread,
Nov 28, 2021, 5:00:58 PM11/28/21
to Ben Barker, TasmotaUsers

That’s it. Domoticz isn’t automatically included in the likes of TasmoCompiler

I am not in fact using homeassistant - but Domoticz. However, to use the MQTT autodiscovery plugin that ships with domoticz, I have to turn setOption 19 to 1. 

Ben Barker

unread,
Nov 30, 2021, 4:27:50 PM11/30/21
to TasmotaUsers
Yep - that did the trick. 
I used gitpod to enable scripting (which I needed) as well as MQTT discovery, and the device was automatically discovered by Domoticz. 

There is however still an issue which I am struggling to tie down - partly because I am unsure if it lies with tasmota or domoticz: 


The devices in question are wifi dimmers - and are detected as such by domoticz. 
If I adjust the dimmer value in domoticz, I can see the light change, and also see the value in the Domoticz web UI change 

However, it I switch the switch in domoticz, though the light responds, the Domoticz UI does not update in turn.

00:17:49.466 MQT: tele/bedroom_light/SENSOR = {"Time":"2021-11-30T00:17:49","COUNTER":{"C1":0}} 00:17:50.452 SRC: MQTT 00:17:50.454 CMD: Grp 0, Cmnd 'POWER', Idx 1, Len 2, Data 'ON' 00:17:50.468 MQT: tele/bedroom_light/STATE = {"Time":"2021-11-30T00:17:50","Uptime":"0T01:10:10","UptimeSec":4210,"Heap":23,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Dimmer":44,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"barkernet","BSSId":"78:65:59:7C:9E:47","Channel":6,"Mode":"11n","RSSI":100,"Signal":-50,"LinkCount":1,"Downtime":"0T00:00:03"}} 00:17:50.474 MQT: stat/bedroom_light/RESULT = {"POWER":"ON"} 00:17:50.476 MQT: stat/bedroom_light/POWER = ON 00:17:50.488 MQT: tele/bedroom_light/HASS_STATE = {"Version":"10.0.0(tasmota)","BuildDateTime":"2021-11-29T22:05:54","Module or Template":"WiFi-Dimmer","RestartReason":"Software/System restart","Uptime":"0T01:10:10","Hostname":"bedroom-light-6487","IPAddress":"192.168.1.23","RSSI":"100","Signal (dBm)":"-50","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19} 00:17:50.558 CFG: Saved to flash at FB, Count 1444, Bytes 4096

I can see that the light is publishing RESULT and STATE messages in response to these changes, so my guess is that for some reason Domoticz is not subscribed to these topics. The strange thing is this all used to work. But unfortunately I no longer have a reference system to compare with and work out why! 

Philip Knowles

unread,
Nov 30, 2021, 5:09:56 PM11/30/21
to Ben Barker, TasmotaUsers

It might be worth checking whether Domoticz is expecting tele or stat messages for the switch state.

Reply all
Reply to author
Forward
0 new messages