I recently created a mqtt trigger automation for one of my Inovelli Blue 2-1 switches. I noticed that whenever I pressed the button, my automation was triggered twice.
I am using Zigbee2MQTT, the Mosquito Broker addon, and the MQTT integration.
After looking into it, I noticed that the Mosquito Broker was receiving once and publishing twice to home assistant “zigbee2mqtt/Office - Switch - Load/action”:
2025-12-18 09:43:30: Received PUBLISH from mqttjs_7b8046bf (d0, q0, r0, m0, 'zigbee2mqtt/Office - Switch - Load', ... (1756 bytes))
2025-12-18 09:43:30: Sending PUBLISH to 17QCVjqKXrFtXTMffYBIMb (d0, q0, r0, m0, 'zigbee2mqtt/Office - Switch - Load', ... (1756 bytes))
2025-12-18 09:43:30: Sending PUBLISH to mqttjs_7b8046bf (d0, q0, r0, m0, 'zigbee2mqtt/Office - Switch - Load', ... (1756 bytes))
2025-12-18 09:43:30: Received PUBLISH from mqttjs_7b8046bf (d0, q0, r0, m0, 'zigbee2mqtt/Office - Switch - Load/action', ... (13 bytes))
2025-12-18 09:43:30: Sending PUBLISH to 17QCVjqKXrFtXTMffYBIMb (d0, q0, r0, m0, 'zigbee2mqtt/Office - Switch - Load/action', ... (13 bytes))
2025-12-18 09:43:30: Sending PUBLISH to 17QCVjqKXrFtXTMffYBIMb (d0, q0, r0, m0, 'zigbee2mqtt/Office - Switch - Load/action', ... (13 bytes))
2025-12-18 09:43:30: Sending PUBLISH to mqttjs_7b8046bf (d0, q0, r0, m0, 'zigbee2mqtt/Office - Switch - Load/action', ... (13 bytes))
I
(17QCVjqKXrFtXTMffYBIMb is home assistant’s device id here)
When I looked into what home assistant was subscribing to, I noticed it subscribed to both “zigbee2mqtt/+/action” and “zigbee2mqtt/Office - Switch - Load/action”, which is why the Mosquito Broker publishes twice to home assistant. When the device is first created, only the first subscription exists, but as soon as an automation is created to trigger on the MQTT topic for the device, home assistant creates the second topic subscription.
So, why is it also subscribed to zigbee2mqtt/+/action? I have template triggers that look at this topic to record some data like “Last Physical Zigbee Press”
Is this expected behavior by Home Assistant? It seems that it would be really easy to accidentally create multiple subscriptions for the same topic, and therefore trigger automations multiple times. I’ve noticed that the nodered client seems to just subscribe to “zigbee2mqtt/#” and internally parses out the messages to the nodes that use it.
Mosquitto Broker has a deprecated “allow_duplicate_messages” that defaults to true and says " It can be safely set to true if you know in advance that your clients will never have overlapping subscriptions, otherwise your clients must be able to correctly deal with duplicate messages even when then have QoS=2.", but it seems that Home Assistant, or maybe the official MQTT integration, does not “correctly deal with duplicate messages”