I try to connect my ESP32 to wifi / Thinger.io. But my ESP32 seem to stay offline.
Using a standard Wifi code the ESP32 is connecting
But with the standard code for ESP32 / Thinger.io it fails.
What can be the issue?
I try to connect my ESP32 to wifi / Thinger.io. But my ESP32 seem to stay offline.
Using a standard Wifi code the ESP32 is connecting
But with the standard code for ESP32 / Thinger.io it fails.
What can be the issue?
One step further, but still some issues
I’m now connected with wifi.
Is this because I add disanle TLS?
#define DISABLE_TLS
But now I have Auth Failed!
What can cause this?
Hi,
Write again the device credentials, if it’s neccesary delete it and create again, this not seems to be an issue with the platform.
And don’t post a printscreen of your code, post it as preformated text, the forum’s posting window has the option to do it, this makes easier for us to read the code, and maybe easy for you to post it.
Hope this helps
Deleting the device and re-create it did the trick.
Now the next step in learning IoT
Thanks
Hello, I have the same problem and I have tried your advice hundreds of times and it connects when it wants.
The worst is when it connects, if I make a small modification, it stops working.
Hello @Detector_incendio,
You should have something wrong in your source code, that is sending a lot of endpoint calls to the server. If this happens there is a protection mechanism that locks the device, so take care with that.
If need help do not hesitate on posting here your source code.
best
HI, @JorgeTrincado, this is my code:
#define _DEBUG_
#define _DISABLE_TLS_
//Libraries
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>
#include "DHT.h"
//Web parameters
#define W_SSID "my wifi ssid"
#define SSID_PASSWORD "my wifi password"
//Thinger.io pareters
#define USERNAME "my user name"
#define DEVICE_ID "my device"
#define DEVICE_CREDENTIAL "my credentials"
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
//DHT parameters
#define DHTPIN 4 // GPIO04 (D2)
#define DHTTYPE DHT22 //sensor model
DHT dht(DHTPIN, DHTTYPE);
//Port configuration
#define flame 5 //Flame sensor -- GPIO05 (D1)
#define rele 14 //Rele -- GPIO14 (D5)
//rele activator
bool fire = true;
void setup() {
//port setup
pinMode(flame, INPUT); //flame sensor
pinMode(2, OUTPUT); //internal led
pinMode(rele, OUTPUT); //rele
Serial.begin (115200);
//begining
dht.begin();
thing.add_wifi(W_SSID, SSID_PASSWORD);
// remote control
thing["button"] << [](pson & in) {
digitalWrite(rele, !in);
digitalWrite(2, in);
};
// data transmission
thing["dht"] >> [](pson & out) {
//calibration factors
float cal_temp = 0;
float cal_hum = 0;
//data sending
out["Temperature"] = dht.readTemperature() + cal_temp;
out["Humidity"] = dht.readHumidity() + cal_hum;
out["fire"] = fire;
};
}
void loop() {
//input
fire = digitalRead(flame);
//transmission
thing.handle();
if (!fire) {
thing.call_endpoint("Warning");
}
}
I hope this will be useful for you
Hola @Detector_incendio,
there are two problems on this code:
1- digitalWrite is waiting for an integer or bool but you are placing a PSON, that may be empty, it is better if you make a casting or similar, and also could be interesting to protect your code of empty psons that will appear when the API is refreshed. Place this resource instead of your “button” one:
thing["button"] << [](pson & in) {
if(in.is_empty()){
in=digitalRead(rele); //if it is empty we can retrieve current status from the pin port
}
digitalWrite(rele, in?LOW:HIGH);
digitalWrite(2, in?HIGH:LOW);
};
2-Big mistake in the loop! as I was assuming in my previous message, your code is calling “warning” endpoint recurrently, always that fire==0. that is why the server is locking your device. You have to include here a mechanism that calls the endpoint only one time, or one time each X seconds
int last_fire_value=0;
loop{
//input
fire = digitalRead(flame);
//transmission
thing.handle();
if (!fire && !last_fire_value) {
thing.call_endpoint("Warning");
}
last_fire_value=fire;
}
Hope this helps you