cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Thingworx + ESP8266

Telles
12-Amethyst

Thingworx + ESP8266

Hi, Team.

I programming this sketch. I got it assembly the packge to my Thing. But the values don´t update.

If I get the URL in Monitor Serial, copy and paste in navigator. The properties of TW are updated. 

Maybe the problema is in http.begin...

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoHttpClient.h>
#include <WiFiClientSecureBearSSL.h>

const char* ssid = "InfoAxis_NET1";
const char* password = "InfoNet1";

char server[] = "";
char appKey[] = "";

char thingName[] = "Box";

char property1[]="pressao";
char property2[]="temperatura";

#define ACCEPT_TYPE "text/csv"

void setup(){
Serial.begin(115200);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED){
delay(1000);
Serial.print(".");
}

}

void loop() {

if(WiFi.status() == WL_CONNECTED){

HTTPClient http;

String pressao = ("200");
int a = pressao.length();
Serial.print("Tamanho da String: ");
Serial.println(a);
String URL = String(server)+ "/Thingworx/Things/" + thingName + "/Properties/" + property1 + "?method=PUT&value=" + pressao + "&appKey=" + String(appKey);
http.begin(URL);
http.addHeader("Accept",ACCEPT_TYPE,false,false);
http.addHeader("Content-Type","application/json",false,false);
int httpcode=http.sendRequest("PUT",pressao);
Serial.println(httpcode);

Serial.println(URL);
Serial.println(pressao);

http.end();

}

delay(30000);
}

RT_10003402_0-1631731561923.png

 

 



Thanks to all.
Regards.
Telles.

 

2 REPLIES 2
Telles
12-Amethyst
(To:Telles)

Up, team!

slangley
23-Emerald II
(To:Telles)

Hi @Telles.

 

Can you provide the version of ThingWorx you are running?

 

We also need more information.  Are you seeing any error messages?  What are you connecting to on the edge?

 

Regards.

 

--Sharon

Top Tags