Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi, Team.
How I can fix it?
The Thing to attach on Mashupe is offline.
Regards.
Telles.
Solved! Go to Solution.
Unfortunately, I have to chance the microcontroller to ESP32 and solved the problem!
Regards.
Telles.
That indicates that the 'Remote type Thing' this entity represents is not connected.
This Thing is expecting a connection and information from maybe Kepware or a ThingWorx Edge Agent
Hi, PaiChung!
I´m using the Trail Version, and I don´t need communicate with Kepware yet or Edge Agent.
Regards.
Telles.
Then you can just ignore that, the Thing will function fine even without being connected.
Not sure if this was a pre-created Thing, but else if you use a ThingTemplate that isn't based on RemoteThing or IndustrialThing you wouldn't see that at all because it won't expect connectivity.
Hi!
Understood!
Also I´m use the Trial version to do this.
My ESP32´s code can generate the URL to TW, but return -1. If I copy and paste the same URL in the browser and refresh the Property in Thing, it has updated.
Follow my code and print screen.
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
const char* ssid = "";
const char* password = "";
char* server = "https://pp-210616174386.portal.ptc.io"; // your server instance address
char* APIKEY = ""; // your security key
//Thingworx details
char ThingName[]= "Box";
char ServiceName[]= "SetValue";
char Property1[] = "pressao";
char Property2[] = "testpressao";
#define ACCEPT_TYPE "application/json"
#define LED 2
int i = 0;
void setup () {
pinMode(LED,OUTPUT);
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Conectando...");Serial.println("");
}
}
void loop() {
if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status
HTTPClient http; //Declare an object of class HTTPClient
String d = String(i++);
int h = d.length();
String fullRequestURL = String(server) + "/Thingworx/Things/" + ThingName + "/Properties/" + Property1 + "?method=PUT&value=" + d + "&appKey=" + String(APIKEY);
http.begin(fullRequestURL);//Specify request destination
http.addHeader("Accept",ACCEPT_TYPE,false,false);
http.addHeader("Content-Type","application/json",false,false);
int httpCode = http.PUT(d);/*Send the request*/digitalWrite(LED,HIGH);delay(200);
Serial.println(fullRequestURL);
Serial.print("Valor da variavel: ");Serial.println(d);
Serial.print("Retorno do httpCode: ");
Serial.println(httpCode);Serial.println("");digitalWrite(LED,LOW);delay(200);
if (httpCode > 0) {//Check the returning code
String payload = http.getString();//Get the request response payload
Serial.println(payload);//Print the response payload
String l = String(i);
int h = l.length();
Serial.println(l);
String fullRequestURL = String(server) + "/Thingworx/Things/" + ThingName + "/Properties/" + Property2 + "?appKey=" + String(APIKEY);
http.begin(fullRequestURL); //Specify request destination
http.addHeader("Accept",ACCEPT_TYPE,false,false);
http.addHeader("Content-Type","application/json",false,false);
Serial.println(fullRequestURL);
int httpCode = http.PUT(l);//Send the request
if (httpCode > 0) { //Check the returning code
String payload = http.getString();//Get the request response payload
Serial.println(payload);//Print the response payload
}
http.end();//Close connection
}
delay(2000);//Send a request every 30 seconds
}
}
Regards.
Telles.
is there anything in the logs in ThingWorx application log?
Unfortunately, I have to chance the microcontroller to ESP32 and solved the problem!
Regards.
Telles.