Cannot read from socket


#1

I am using NodeMCU 1.0 with Arduino IDE 1.8.5.
NodeMCU dont show up in Thinger Console.
Username, Device_id and Credential are correct in sketch

Sketch is very basic:

define _DEBUG

#include <ESP8266WiFi.h>
#include <ThingerWifi.h>

#define USERNAME “jjl”
#define DEVICE_ID “Miniput”
#define DEVICE_CREDENTIAL “******”

#define SSID “HomeBox-1A7E”
#define SSID_PASSWORD “**********”

ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

void setup() {
Serial.begin(115200);
pinMode(BUILTIN_LED, OUTPUT);

thing.add_wifi(SSID, SSID_PASSWORD);

// digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
thing[“led”] << digitalPin(BUILTIN_LED);

// resource output example (i.e. reading a sensor value)
thing[“millis”] >> outputValue(millis());

// more details at http://docs.thinger.io/arduino/
}

void loop() {
thing.handle();
}

When running the sketch I got these debug messages:

[_SOCKET] Connecting to iot.thinger.io:25202
[_SOCKET] Using secure TLS/SSL connection: yes
[_SOCKET] Connected!
[THINGER] Authenticating. User: jjl Device: Miniput
[THINGER] Writing bytes: 29 [OK]
[_SOCKET] Cannot read from socket!
[THINGER] Auth Failed! Check username, device id, or device credentials.
[_SOCKET] Is now closed!

What does “Cannot read from socket!” mean and how do I make it work ?

Thanks in advance.
Jens


#2

Hello @jjl,

there was a problem with new ESP8266 bootloaders revision (2.5.x), you can fix it downloading our beta library master at github. Please take a look at this post ffor more information: Connection Issues regarding ESP8266/Node MCU devices

Best!


#3

Hi.

thinger.io version 2.9.2 did not fix the problem
Then I tryed version 2.7.1 and now I can connect to Thinger, but not with SSL !!

[NETWORK] Connecting to network HomeBox-1A7E
[NETWORK] Connected to WiFi!
[NETWORK] Getting IP Address…
[NETWORK] Got IP Address: 192.168.1.37
[NETWORK] Connected!
[_SOCKET] Connecting to iot.thinger.io:25200
[_SOCKET] Using secure TLS/SSL connection: no
[_SOCKET] Connected!
[THINGER] Authenticating. User: jjl Device: Miniput
[THINGER] Writing bytes: 31 [OK]
[THINGER] Authenticated
[THINGER] Writing bytes: 2 [OK]

/JJ


#4

Hello @jjl,

Please read the post that I sent you in the last entry. You have to download 2.11.0 beta version of Thinger.io Arduino library, that is only available in our GitHub repository.

Best regards


#5

Sorry for not doing the right thing.
Do you have a direct link to the beta file ?
I have installed this one: https://github.com/thinger-io/Arduino-Library but it did not work.
Thanks for your help

/JJ


#6

Hello @jjl

Actually that is the right one. What is the problem right now?

It is also posible that your router is locking the TLS communication… sometimes the only way to work with that cases is using #define DISABLE_TLS command.

Can you paste here the output of your network debug?

best regards!