MQTT Multi-Topic subscribe

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
guyd
Posts: 81
Joined: Fri Jul 20, 2018 6:08 am

MQTT Multi-Topic subscribe

Post by guyd » Tue Jul 24, 2018 6:15 pm

Hi,
I wish to subscribe ( as in "regular" Python ) to several topics, when # as wildcard will not solve, for example:
Home/Windows/#
Home/Light/#

but not to :
Home/# ( which includes many more ).

In Python a list of topics can be defined as TOPICS=[(top1,qos1),(top2,qos2)]
Using same method in MicroPython does not apply.

Any leads?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: MQTT Multi-Topic subscribe

Post by pythoncoder » Wed Jul 25, 2018 4:45 am

You can answer these questions by taking a look at the source code and by examining the examples provided. It's a "micro" implementation. You need to issue a subscribe command for each topic.
Peter Hinch
Index to my micropython libraries.

guyd
Posts: 81
Joined: Fri Jul 20, 2018 6:08 am

Re: MQTT Multi-Topic subscribe

Post by guyd » Wed Jul 25, 2018 4:52 am

Hi,
Thank you for answering.
Didnot see in examples multiple subscriptions- but I'll give it a try.

Guy

Post Reply