ESP8266 [socket] Cannot read from socket. After Arduino library update


#1

Arduino library update over the weekend and now I cannot connect to my local thinger.io server, which worked fine before the update.

Anyone else having this issue and how did you resolve it?


#2

Here is the debug info from trying to connect to the thinger server. It is the same for local server.

[NETWORK] Connected to WiFi!
[NETWORK] Getting IP Address…
[NETWORK] Got IP Address: 192.168.1.77
[NETWORK] Connected!
[_SOCKET] Connecting to iot.thinger.io:25200
[_SOCKET] Using secure TLS/SSL connection: no
[_SOCKET] Connected!
[THINGER] Authenticating. User: wifidht22a Device: dht22a
[THINGER] Writing bytes: 39 [OK]
[THINGER] Auth Failed! Check username, device id, or device credentials.
[_SOCKET] Is now closed!
[_SOCKET] Connecting to iot.thinger.io:25200
[_SOCKET] Using secure TLS/SSL connection: no
[_SOCKET] Connected!
[THINGER] Authenticating. User: wifidht22a Device: dht22a
[THINGER] Writing bytes: 39 [OK]
[THINGER] Auth Failed! Check username, device id, or device credentials.
[_SOCKET] Is now closed!


#3

show me your arduino code plz


#4

#define DEBUG

#define DISABLE_TLS

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>

#include “DHT.h”

#define USERNAME “xxxxxxx”
#define DEVICE_ID “dht22a”
#define DEVICE_CREDENTIAL “1234dht22a”

#define SSID “xxxxxxx”
#define SSID_PASSWORD “xxxxxxx”

#define DHTPIN 2 // GPIO 2 pin of ESP8266
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

void setup() {

Serial.begin(115200);

dht.begin();

thing[“dht22”] >> [](pson& out){
out[“humidity”] = dht.readHumidity();
out[“celsius”] = dht.readTemperature();
out[“fahrenheit”] = dht.readTemperature(true);
};

}

void loop() {

thing.handle();

}

The above code connects to the thinger.io server.
The code below is to my local server.
Both give the same DEBUG output.

#define DEBUG

#define DISABLE_TLS

#define THINGER_SERVER “192.168.1.67”

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>

#include “DHT.h”

#define USERNAME “wifidht22a”
#define DEVICE_ID “dht22a”
#define DEVICE_CREDENTIAL “1234dht22a”

#define SSID “xxxxxxx”
#define SSID_PASSWORD “xxxxxxx”

#define DHTPIN 2 // GPIO 2 pin of ESP8266
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

void setup() {

Serial.begin(115200);

dht.begin();

thing[“dht22”] >> [](pson& out){
out[“humidity”] = dht.readHumidity();
out[“celsius”] = dht.readTemperature();
out[“fahrenheit”] = dht.readTemperature(true);
};

}

void loop() {

thing.handle();

}


#5

if the same debug result , try to edit thingerclient.h file

#ifndef THINGER_SERVER
    #define THINGER_SERVER "iot.thinger.io" **//= change this**
#endif
#ifndef THINGER_PORT
    #define THINGER_PORT 25200
#endif
#ifndef THINGER_SSL_PORT
    #define THINGER_SSL_PORT 25202
#endif
#ifndef THINGER_TLS_FINGERPRINT
    #define THINGER_TLS_FINGERPRINT "C3 90 0E 8B CB 2D 7A 32 1B 55 5C 00 FA 7B 39 5E 53 BC D2 8F"
#endif
#ifndef THINGER_TLS_HOST
    #define THINGER_TLS_HOST "thinger.io" **//= change this**

==========================================================


#6

Will give it try and get back to you.


#7

No change. I think something changed in the ESP8266 libraries that broke the socket.
But I am not sure. It fails on ESP8266 01 and a NodeMCU that I have.


#8

Worse thing is it was working fine with no issues before last weekend.
All I wanted to do was add some data buckets.


#9

How about adding this at the first line of your code? (below that debug-line before any of the libraries) Do not edit the .h file itself


#10

When I get a chance I will give it a try. Thanks