How many broker to create for 5 sonoff basic


I’m a complete newbie, i wanted to know if i have 5 sonoff basic flash with tasmota
is it ok to configure only 1 MQTT Broker then for each sonoff i create Generic MQTT Thing?

should i also create different mosquitto user for each sonoff?


No, one broker and user is enough.

MQTT was designed to handle multiple messages / topics. Basically everything can push or subscribe to a topic. Let’s say you have five devices, you can simply let them push to 5 different topics

SONOFF1 = broker/switches/sonoff1
SONOFF2 = broker/switches/sonoff2

SONOFF5 = broker/switches/sonoff5

In some cases you might wan’t to have more than just one broker. For example if you have a device that isn’t in your private network (like a gsm driven webcam or presence sensor in your garden). Then you could have a second broker that’s available from the internet (CloudBroker).

All the sonoff basic can connect using one username and password?
I don’t need different username for each sonoff?

I don’t use authentication on MQTT, but I think you can have one user and use that to connect to the broker. It is just a security layer, so no one can interact with your MQTT devices if they don’t have the username/password.

Thank you.

got it.

But check that the sonff devices are announcing themselves as different client ids. They should be as part of the firmware.

As if two devices have the same client Id, one will keep disconnecting. .