# MQTT all device polling -- wildcard use?

**URL:** <https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086>\
**Category:** General\
**Created:** [26 July 2023 12:39 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086 "2023-07-26T12:39:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [26 July 2023 12:39 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086/1 "2023-07-26T12:39:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [26 July 2023 12:47 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086/2 "2023-07-26T12:47:12Z")

</div>

Hi,

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.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 July 2023 12:52 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086/3 "2023-07-26T12:52:20Z")

</div>

Are these Tasmota devices? Tasmota provides a "group topic" for this situation.  
[https://tasmota.github.io/docs/MQTT/#mqtt-topic-definition](https://tasmota.github.io/docs/MQTT/#mqtt-topic-definition)

---

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [26 July 2023 13:15 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086/4 "2023-07-26T13:15:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 July 2023 13:22 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086/5 "2023-07-26T13:22:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [26 July 2023 15:12 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086/6 "2023-07-26T15:12:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 July 2023 15:46 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086/7 "2023-07-26T15:46:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [27 July 2023 14:14 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086/8 "2023-07-27T14:14:06Z")

</div>

@jbudd  
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:

![GroupTopic](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/2/b24b579641b55a5824ffb94c385a33337683e77d.png)  
The group devices would respond like this:

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

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 August 2023 14:14 UTC](https://discourse.nodered.org/t/mqtt-all-device-polling-wildcard-use/80086/9 "2023-08-10T14:14:22Z")

</div>

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