Berry: Using mqtt.subscribe() causes mqtt commands to be duplicated on eclipse-mosquitto V2

11 views
Skip to first unread message

andre...@gmail.com

unread,
Apr 18, 2026, 5:20:42 PM (6 days ago) Apr 18
to TasmotaUsers
Hi Chaps,

any thoughts on this? My mistake or a bug?

Home Assistant upgraded my Mosquitto Broker to Version 2, and caused one of my Berry scripts to fail.

Here is a minimal script replicator:

autoexec.be
import mqtt
def mqttIn(topic, x, payload)
print('Entered mqttIn')
return false
end
mqtt.subscribe('cmnd/' + tasmota.cmd('Topic', true)['Topic'] + '/+', mqttIn) # eg 'cmnd/esp32-dev-07/+'



mosquitto_pub -t cmnd/esp32-dev-07/status -m 3 => generates stat/esp32-dev-07/STATUS3 twice.
Also, prints 'Entered mqttIn' twice to console.
Likewise mosquitto_pub -t cmnd/esp32-dev-07/power5 -m toggle executes twice, hence does not toggle.

mosquitto_sub -h hfcs1 -p 1884 -v -t cmnd/esp32-dev-07/status - shows one message sent from broker.

Change mqtt.subscribe() to cmnd/esp32-dev-07/status, and it only duplicates 'status' commands.

Hard code the topic: mqtt.subscribe('cmnd/esp32-dev-07/status', mqttIn), and it behaves the same.

Change to 'return true' and it consumes the mqtt command, and does nothing, as expected.

I'm using an isolated broker for testing.
    eclipse-mosquitto:1.6-openssl works correctly.
    eclipse-mosquitto:2 shows the duplication problem.

Checked on Tasmota 15.3.0

FYI - I use this to detect if certain Tasmota commands are being sent, and run some logic if they are. Hence, this is a kind of interposer.

Many thanks
Andrew
Reply all
Reply to author
Forward
0 new messages