Consulta lectura datos desde data bucket - Reading data from data bucket

Hola @Julian_Farchi,

Por el momento no es posible recuperar el valor directamente desde el servidor de Thinger, aún no está disponible esa funcionalidad, pero no tardará en llegar =D.

Por el momento, se me ocurren dos cosas que podrías hacer: La primera es almacenar el valor en la memoria flash del dispositivo usando la librería eeprom.h o mediante la memoria SPIFFS del WeMos, te dejo un ejemplo de código en el que puedes ver cómo hacerlo:

#include "FS.h"

void setup() {
  Serial.begin(115200);

  // always use this to "mount" the filesystem
  bool result = SPIFFS.begin();
  Serial.println("SPIFFS opened: " + result);

  // this opens the file "f.txt" in read-mode
  File f = SPIFFS.open("/f.txt", "r");
  
  if (!f) {
    Serial.println("File doesn't exist yet. Creating it");

    // open the file in write mode
    File f = SPIFFS.open("/f.txt", "w");
    if (!f) {
      Serial.println("file creation failed");
    }
    // now write two lines in key/value style with  end-of-line characters
    f.println("ssid=abc");
    f.println("password=123455secret");
  } else {
    // we could open the file
    while(f.available()) {
      //Lets read line by line from the file
      String line = f.readStringUntil('\n');
      Serial.println(line);
    }

  }
  f.close();
}

void loop() {
  // nothing to do for now, this is just a simple test

}


Otra opción, que no he probado nunca pero es viable, es crear un access point con permisos de acceso al data bucket y utilizar un cliente en el dispositivo para recuperar el JSON completo desde el data bucket mediante una http request como esta:

https://api.thinger.io/v1/users/jt/buckets/SensePoint/data?items=1&max_ts=0&sort=desc&authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREVNTyIsInVzciI6Imp0In0.y_cwNQqIak5oQQhElcmO0hEYKEodds3UB8SHW7Rlmko

Al solicitarla, el servidor devuelve el siguiente JSON:
[{“ts”:1532878930886.0,“val”:{“batery”:3416.0,“humidity”:36.4385,“temperature”:27.8396}}]

Solo sería necesario recorrerlo para extraer la variable que quieres. Esta idea me gusta, quizá podríamos hacer un tutorial!!

Un saludo!