MQTT Only Sends to Most Recent Subscribed Client

Using Node Red to control 12 machines via MQTT.

Have Mosca MQTT Broker Node, and the MQTT Out node to send a message on topic "Movement".

The machines use a Particle Photon connected via wifi to receive the commands sent from MQTT on that topic.

All 12 devices should receive the command and move together.

The problem is... When I turn on 1 machine, it connects properly, and moved. When I turn on a 2nd machine, the 1st machine stops moving, and only the 2nd machine moves. When I connect a 3rd.. neither the 1st or 2nd moves... just the 3rd. So on and so forth for all machines. Doesn't matter what order I bring them online... only the last connected devices receives any command from the MQTT broker.

I have noticed in the Node Red debug... every time I turn on a new device... the MQTT Broker sends an... "unsubscribe" topic, a "clientDisconnected", and a "clientConnected" topic in that order.

Like each new device is disconnecting the previous one? I've dug through and found that the maxConnections is set to 10000000. Not really sure what to do here, as there aren't many options.

Have a look at the Mosquitto logs - you are probably duplicatiing node names

See what MQTT client name each device is connecting with


Well that was an easy fix, heh... that was the issue. Thank you!

No problem - its an easy mistake if you are duplicating nodes through SD Cards or VM clones etc etc