Sonoff issue with message "device was disconnected"

@Costas
Hello. Thanks for your interest.

I’ve enclosed a code snippet which would “work” if the api key was correct and the feed and data element id were correct. What is escaping me is how to set up the webhook especially the set up of the header with the API Key.

The library I use works well as is. I also have a variation I use with the yun using calls to the curl command.

Sorry about the formatting. But I hope you get the idea.

#include "RestClient.h"
RestClient client = RestClient("api.xively.com");
void setup() {
  // put your setup code here, to run once:
  String GetData = GetXivelyData();

}

void loop() {
  // put your main code here, to run repeatedly:

}

void GetXivelyData(){
      client.setHeader("X-ApiKey: XYZ");
      client.get("/v2/feeds/FEEDID/datastreams/datastreamsID.csv", &Response);
      return Response;
}

Formatting is easily rectified… check back at your last post editing to see how I added in the needed backticks in front of and at the end of the code for proper forum viewing.

Got it. Thanks.

Hi @Costas. Did you have any luck finding out how I might set the header using webhook prior to the main get it out?

From a web browser have you tried with the header in the url?

https://api.xively.com/v2/feeds/FEEDID/datastreams/datastreamsID.csv{“X-ApiKey: XYZ”}

Or some combination of this.

I did set up an account with xively but it wasn’t very intuitive as to how you add MCU’s and if the trial version gives full access.

Hi @Costas

Was this personal or professional Xively you tried? Personal is the one I use and is free. The professional one is very expensive and aimed at corporate.

Sorry - the suggestion did not work. I take it you have not figured how to set up a header? I think I have been down this route before when looking at the webhook solution and came to the conclusion I could not figure how it could be done. Fine if the key can be incorporated with the HTTPS call but xively doesnot seem to support this.

Not to worry if nothing comes to mind immediately. I have been reading around otherposts with the esp device dropping off and it does seem to be the quantity of data shoved down the line and the option is as suggested in this post and others to send less more often using timers. With the xively calls I will need to make sure I split them up as well to give everything a chance to catch up. Thanks for your help.