Multiple MQTT nodes affect eachother

Hello all
I found strange/unexpected by me thing.

To understand better the issue I have to present the topics in my MQTT

- shellies
  - device1
    - input
    - longpush
    - command
    - etc
  - device2
    - input
    - longpush
    - command
    - etc
  - etc

I had configured an mqtt node listening to let's say shellies/device1/longpush. I'm using this node to turn all lights in the house (when Shelly reports long push)

Recently I wanted to create a new flow that requires listening to all shelly topics. I configured it to listen to shellies/#

You can imagine how I was surprised when saving a new node (using Deploy Modified Nodes) caused turning all lights in the house off.

What happened? Saving the new node caused the first node to receive messages, incl. long push.
I admit, I figured out that this longpush topic is retained.

But question is: is it correct behavior that deploying a node causes the other node receives data triggering flows? IMO it's not expected and it shouldn't work like this. I can imagine, that since both nodes use the same connection, a request for all data triggered by a new node could potentially deliver those data to all nodes which use the same connection. But shouldn't it be filtered for the requestor only?

BTW I'm pretty sure that in the past Shelly topics representing inputs weren't retained. Inly those which represent device state. Just FYI.

There is a technical reason under the hood that I will not try to explain right now however, if you have a v5 capable broker, switching to v5 will avoid this issue.

1 Like

Great answer. Thank you.
Since my Mosquitto broker offers v5 protocol, I switched the connection node to this version as you advised. It works as expected now.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.