Easy IoT for Particle photon/electorn devices

7 years 10 months ago - 7 years 10 months ago #3680 by rdavidsson
Hello Easy IoT,

I´ve been using Easy IoT Cloud for almost a year now with great results, working very well etc. After maintenance I haven´t been able to use your cloud because I cannot use the EIoTCloudRestApi library (it is only for ESP8266). The library is not compatible with the WEB IDE for Particle devices ( www.particle.io ). Do you have a solution for this?

Regards,

Ragnar

Please Log in or Create an account to join the conversation.

7 years 10 months ago - 7 years 10 months ago #3681 by EasyIoT

rdavidsson wrote: Hello Easy IoT,

I´ve been using Easy IoT Cloud for almost a year now with great results, working very well etc. After maintenance I haven´t been able to use your cloud because I cannot use the EIoTCloudRestApi library (it is only for ESP8266). The library is not compatible with the WEB IDE for Particle devices ( www.particle.io ). Do you have a solution for this?

Regards,

Ragnar


Hi Ragnar,

after upgrade old REST API was disabled for security reasons. Now you can use only REST API V1. Detailed spec is on this link:
iot-playground.com/blog/2-uncategorised/...-cloud-rest-api-v1-0

REST API V1 is more powerful than old REST API. Most important it uses security token to allow access to API. You can use new REST API V1 similar as old REST API. First you need to add new token in WEB interface (Configure->Tokens->Add token). After you add new token use this token in REST call in HTTP request header EIOT-AuthToken: [token]. I'm sure particle supports this. URL of request is also changed. Look at REST API V1 spec. Also you can help with ESP8266 library. The part to set value EasyIoT Cloud parameter is:
bool EIoTCloudRestApi::setParameterProperty(String parameterId, String property, String value)
{
	WiFiClient client;
   
	while(!client.connect(EIOT_CLOUD_ADDRESS, EIOT_CLOUD_PORT)) {
		debug("connection failed");
		wifiConnect(); 
	}

	String url = "POST /RestApi/v1.0/Parameter/"+parameterId+"/"+property+"/"+value;

	client.print(String(url+" HTTP/1.1\r\n") +
               "Host: " + String(EIOT_CLOUD_ADDRESS) + "\r\n" + 
               "EIOT-AuthToken: "+String(_token) + "\r\n" + 
			   "Connection: close\r\n" + 
               "Content-Length: 0\r\n" + 
               "\r\n");

	return parseResponse(&client);
}

I'm sure it can be easily translated to Particle IDE.


Also you can use MQTT protocol - it's standard for IoT devices.

Please Log in or Create an account to join the conversation.

7 years 4 months ago #3856 by rdavidsson
Hi again,

I´m still not getting it to work, that is, I don´t get any values to the cloud. I really want to use EasyIoT as I think your interface is the best!

The code I´m using to send the temperature value is like this (value0):
void sendtoeasyiot()
{

clientIOT.connect(EIOT_CLOUD_ADDRESS, EIOT_CLOUD_PORT); 

clientIOT.print(String("POST /RestApi/v1.0/Parameter/"+ String(EIOT_CLOUD_1_INSTANCE_PARAM_ID) + "/"+String(value0, 2) + "HTTP/1.1\r\n") +
               "Host: " + String(EIOT_CLOUD_ADDRESS) + "\r\n" + 
               "EIOT-AuthToken: "+String(token) + "\r\n" + 
			   "Connection: close\r\n" + 
               "Content-Length: 0\r\n" + 
               "\r\n");
}

Before setup I´m using this:
TCPClient clientIOT;
#define EIOT_CLOUD_1_INSTANCE_PARAM_ID      "XXX"   
#define EIOT_CLOUD_ADDRESS     "cloud.iot-playground.com"
#define EIOT_CLOUD_PORT        40404
#define token                  "The token I added in the cloud"

Best regards,
Ragnar

Please Log in or Create an account to join the conversation.

Time to create page: 0.233 seconds

Forum latest

  • No posts to display.