I am looking to query the last 24 hours of data from a feed. Im using arduino language and can successfully publish and subscribe via MQTT and adafruitmqtt library.
My goal is to retrieve the last x data values within the 24 hours from my feed via mqtt, but I'm not sure if this is possible. The data points are json strings that are time stamped. Once I get them back into my program, I will split the json and sum values (an interesting problem for later).
I see in the documentation that there is "Get activity by type" and query parameters such as start and end time. I don't understand how to implement it though.
Currently, I am subscribed and retrieve the last value each time and save it to download:
Code: Select all
//from mqtt_2_subs_esp8266 example:
Adafruit_MQTT_Subscribe *subscription;
while ((subscription = mqtt.readSubscription(5000))) {
// Check if its the onoff button feed
if (subscription == &onoffbutton) {
download = (char *)onoffbutton.lastread;
Thanks!