Why si ESP8266 D1 R2 mini connecting only through hotspot?

Hello. I have two similar codes. One is through my iphone as hotspot - works. Other one is through my wifi at home. Does not work. But it is connected to the wifi, because I can see it on serial monitor + I can ping that. What is the problem?

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

/*
IPAddress ip(x,x,x,x);
IPAddress subnet(x,x,x,x);
IPAddress gateway(x,x,x,x);
*/
#define USERNAME "x"
#define DEVICE_ID "x"
#define DEVICE_CREDENTIAL "x"
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

void setup()
{
  Serial.begin(115200);
  Serial.println();

  WiFi.mode(WIFI_STA);
//  WiFi.config(ip, gateway, subnet);
  //WiFi.begin("wifi", "x");
  WiFi.begin("iPhone", "x");
 // thing.add_wifi("iPhone", "x");
  //thing.add_wifi("wifi", "x");


  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println();

  Serial.print("Connected, IP address: ");
  Serial.println(WiFi.localIP());
  //WiFi.printDiag(Serial);
  //Serial.setDebugOutput(true);

  thing["led"] << digitalPin(LED_BUILTIN);
  thing["millis"] >> outputValue(millis());
}

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

Hello @palos223,

Have you tried disabling the TLS/SSL? just add #define DISABLE_TLS before the library #includes.
If this doesn’t solves the problem, check your router security protocols configuration, maybe it is using any process that do not allow the connection of the 8266.

on the other hand… I strongly recommend you using the newest Arduino IDE Thinger.io library example codes, in order to be sure that there is no any incompatible element:

#include <ThingerESP8266.h>

#define USERNAME "your_user_name"
#define DEVICE_ID "your_device_id"
#define DEVICE_CREDENTIAL "your_device_credential"

#define SSID "your_wifi_ssid"
#define SSID_PASSWORD "your_wifi_ssid_password"

ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

void setup() {
  pinMode(LED_BUILTIN, 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(LED_BUILTIN);

  // 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();
}