pondělí, června 26, 2017

Wemos D1 and Xively.com

AFAIK there's no Arduino/Wemos library for posting (PUTing actually) data to Xively.com. So let's create the PUT by our own! I'm using ESP8266HTTPClient as client. It can't handle https connection to Xively, but this is not centrifuge for enhancing uranium... On the Xively side, you can limit perms to update only, source ip...

  String payload = "{ \"current_value\": \"" + String(temp1,2) + "\", \"id\": \"my-channel-name\" }";
  http.begin("http://api.xively.com/v2/feeds/my-feed-id/datastreams/my-channel-name/");
  http.addHeader("X-ApiKey", "my-X-ApiKey");
  int httpCode = http.PUT(payload);
  // check httpCode if you want to
  http.end();

Žádné komentáře:

Okomentovat