ThingerWebConfig with THINGER_SERVER

Hello,
On an esp8266, I tried the wifi auto-connect using ThingerWebConfig to connect to my thinger.io server by defining its IP address as THINGER_SERVER. My esp8266 joins the wifi network and gets an IP address, however the state of my device, created in my thinger.io, is shown as Diconnected “red” . Below is the used code for your reference.

#define THINGER_SERVER "xxx.xxx.xxx.xxx"  
#define THINGER_USE_FUNCTIONAL
#include <DNSServer.h>
#include <WiFiManager.h> 
#include <ThingerWebConfig.h>
#include "Adafruit_MCP23017.h"

Adafruit_MCP23017 mcp0;
uint8 pin;
ThingerWebConfig thing;
void setup() {
Serial.begin(115200);
mcp0.begin(0);
    for ( pin = 0; pin  < 16; pin ++)
    {
        mcp0 .pinMode(pin, OUTPUT);
    }
 pinMode(pin, OUTPUT);
    thing["RELAY"] << [](pson & in) {
    if (in.is_empty()) in = (bool) mcp0.digitalRead(pin);
    else mcp0.digitalWrite(pin, in ? HIGH : LOW);  
  };
}
void loop() {
  thing.handle();
}

The code is working fine (my device shows Connected “green”) when I used ThingerESP8266 (with hard-coded SSID, password,USERNAME, DEVICE_ID, DEVICE_CREDENTIAL) instead of ThingerWebConfig.
Any advice or help is appreciated.
Thank you very much.
Sam.

Hello @Sam_Carli,

Try to connect a serial port and obtain the connection traze by adding cpp #define _DEBUG in the first code line, with that information we will be able to help you better.

However I have a web config code with some additional parameters that works well, if we can’t solve your I will share with you.

Best

Thank you very much for your support. In the debug trace I can see the following:
BSSL:_connectSSL: start connection
BSSL:Connection will fail, no authentication method is setup
:wr 218 0
:wrc 218 218 0
:ack 218
:rn 536
:rch 536, 536
:rd 5, 1072, 0
:rdi 536, 5
:rch 1072, 536
:rch 1608, 123
:rd 81, 1731, 5
:rdi 531, 81
:rd 5, 1731, 86
:rdi 450, 5
:rd 1631, 1731, 91
:rdi 445, 445
:c 445, 536, 1731
:rdi 536, 536
:c 536, 536, 1195
:rdi 536, 536
:c 536, 536, 659
:rdi 123, 114
BSSL:_wait_for_handshake: failed
BSSL:Couldn’t connect. Error = ‘Certificate is expired or not yet valid.’
:close

May be some certification issue??

Hello @Sam_Carli,

Let me suggest starting again from the ThingerWebConfig example:

// Requires WifiManager from Library Manager or https://github.com/tzapu/WiFiManager
#include <ThingerWebConfig.h>

ThingerWebConfig thing;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);

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

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

  /*
    Steps for getting the ESP8266 WebConfig working:
    1. Connect to Thinger-Device WiFi with your computer or phone, using thinger.io as WiFi password
    2. Wait for the configuration window, or navigate to http://192.168.4.1 if it does not appear
    3. Configure the wifi where the ESP8266 will be connected, and your thinger.io device credentials
    4. Your device should be now connected to the platform.
    More details at http://docs.thinger.io/arduino/
  */
}

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

Try just with this example and then build your code over it.

best!

Hello,
Thank you so much! I will try this code over the weekend.
Best regards