Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Read button status on adafruit.io
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.

Read button status on adafruit.io

by IoTAll on Tue Jul 23, 2019 7:03 am

Hi!

I am making a low power project when the feather is doing few tasks, sending data to and from Adafruit.io and then going to sleep for few hours.

I also have one on/off button on Adafruit.io dashboard and I get the change of status on the feather with the subscribe command through MQTT. This works well too.

I would like the project to read the on/off button status on the Adafruit.io dashboard when it wakes up.
Is this possible to do and if yes how?

Thanks!

IoTAll
 
Posts: 152
Joined: Wed May 31, 2017 6:34 pm

Re: Read button status on adafruit.io

by IoTAll on Tue Aug 06, 2019 7:55 pm

Hi!
Does anyone know if this is possible?
Thanks!

IoTAll
 
Posts: 152
Joined: Wed May 31, 2017 6:34 pm

Re: Read button status on adafruit.io

by GrosPlombs on Wed Mar 04, 2020 10:06 pm

I found that you can "poll" a feed by writing a value to it. This is explained in the Adafruit IO MQTT API documentation under the topic Using the */get topic. Here is a link.
https://io.adafruit.com/api/docs/mqtt.html#adafruit-io-39-s-limitations.
You can define a new AdafruitIO_Feed and append /get to your feed name like this:
Code: Select all | TOGGLE FULL SIZE
AdafruitIO_Feed *digital2 = io.feed("YOUR-FEED/get");


and write to it like this (\0 is a dummy value I chose):
Code: Select all | TOGGLE FULL SIZE
digital2->save("\0");


This will trigger the feed to update your message.
You should be able to figure it out from the API docs because I was able too! :)

GrosPlombs
 
Posts: 1
Joined: Wed Mar 04, 2020 9:35 am

Please be positive and constructive with your questions and comments.