MQTT all device polling -- wildcard use?

With 'mqtt in' the use of a wildcard is possible, like stat/+/STATUS11
How to request all devices with 'mqtt out' using a wildcard like cmnd/+/STATUS11 ?

it seems that request doesn't polls all the mqtt devices. So, what is the best workaround?


MQTT doesn't have the concept of publishing using wildcards.

One workaround would be to have your devices subscribe to a 'broadcast' cmd topic - eg cmd/all as well as their individual comment topics.

That way you can pick whether you send a command to a single device, or to all.

Are these Tasmota devices? Tasmota provides a "group topic" for this situation.

Yes, it's with Tasmota.
" GroupTopic" seems to be the way, but not all devices has the same naming.
Older have 'sonoffs', newer 'Tasmota'.

Any idea how to change the GroupTopic for specific device? Can't find a UI on the device page, so it needs to be firmware upgrade?

There is a GroupTopic command, which of course you can send by MQTT to each device.

I've never used this feature so not sure of the required format.

Thanks for sharing your idea!
Indeed the Tasmota device have that "GroupTopic" setting. Older seems to have only one, but newer I found up to four.
Setting it is quiet simple, open the device UI console with http://<ip>/cs.
Enter to "Enter Command" GroupTopic and the current is shown, enter GroupTopic <new name> to set a new one.

I'm glad you got it working.

It might help others if you share with us the device mqtt topic settings, the value you used for GroupTopic and the final mqtt topic that you can send a command to the whole group with.

With tasmota the GroupTopic is excellent to work with a number of devices very easily. But you need to know the individual settings for each device. Since there is no wildcard to get all the individual settings, you have to ping each device individually. The best way is to open the device's UI console and set the required GroupTopic.
With the new Tasmota firmware, GroupTopic is set to tasmotas.

A simple mqtt request would look like this:

The group devices would respond like this:

27.7.2023, 16:03:44 node: debug 4
stat/pumpe/STATUS : msg.payload : Object
{ Status: object }

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