Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

MQTT - Retained Messages
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

MQTT - Retained Messages

by Nikolai1024 on Mon Feb 15, 2016 11:41 am

Hi,
Do you have any sample code or maybe you can provide and example of getting Retained Messages from MQTT. I would like to be able to get last feed values when I reset my feather or loose connection and reconnect.

Also, I'm using HTTP POST to submit my value to Aidafruit.io. Is there anything I need to set there?

Thanks
Nick

Nikolai1024
 
Posts: 3
Joined: Thu Jan 21, 2016 4:10 pm

Re: MQTT - Retained Messages

by adafruit2 on Tue Feb 16, 2016 10:02 pm

if you're doing REST you can always get the current message
the adafruit.io MQTT broker will, on connection, give you the retained message
Adafruit_MQTT will by default receive the retained message as the first one
*however* it only works for one feed right now - we have to add callback support to do more, no ETA - its in progress!

adafruit2
Site Admin
 
Posts: 19221
Joined: Fri Mar 11, 2005 7:36 pm

Re: MQTT - Retained Messages

by Nikolai1024 on Tue Feb 16, 2016 10:56 pm

Great. I'll experiment with code to see if I can grab that value in MQTT. Looking forward to support for all feeds. Thanks.

Nikolai1024
 
Posts: 3
Joined: Thu Jan 21, 2016 4:10 pm

Please be positive and constructive with your questions and comments.