Notifications
Clear all

Adafruit IO MQTT retain value

1 Posts
1 Users
0 Likes
712 Views
(@avrphreak)
Member
Joined: 3 years ago
Posts: 7
Topic starter  

Hello,

I am working on a project where i have 2 remote ESP-32's with BME280 sensors which send their data to Adafruit IO.

On a third ESP-32 i want to obtain the data from AdafruitIO and display this data on a nextion display.

But on this third ESP i also connect to Openweather to obtain weather data which is also shown on the display.

All things seperately are working, however when i join the programmes platformIO gives an error.

identifier "HTTPClient" is undefined

 

I believe that this due to a conflict in the libraries. I used the AdafruitIO library which seems to co-install a whole bunch of other libraries.

So as an alternative i tried the more lightweight AdafruitMQTT library.

I can get this to work, publish data to a feed and read from a feed.

However my intention is to have the reading ESP go to sleep and only check for data when woken up.

The issue i run into now is that i can only read the value from the feed as it changes, i would like to be able to read the last uploaded value and disconnect again (i believe this is called retain).

The uploading ESP's will also publish only every 15 minutes or so, so i don't want to run into sync issues here.

The more elaborate AdafruitIO library does work this way, but i run into the aforementioned issue with the HTTPClient.

A lot of googling later i came to the conclusion that there should be a form of retain functionality in AdafruitIO MQTT by using the /get in the feed.

But i am unable to get this working.

Is there maybe anyone who can help me on this, i'm really stuck here.

Maybe i should switch MQTT brokers and use a different library?

 

Any help is greatly appreciated!


   
Quote