You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
i'm using a battery powered ESP8266 and PubSubClient (latest version) with Home Assistant on Raspi3 and Mosquitto Broker.
Normally, all is working fine.
Now, if in case of a blackout the mosquitto Broker is unreachable, the connect function of PubSubClient has a timeout of 5 seconds.
this is too long for my battery powered equipment.
I tried to use setSocketTimeout(1) before using connect() but nothing is changing.
Setting MQTT_SOCKET_TIMEOUT to 1 in PubSubClient.h also does not change anything.
The text was updated successfully, but these errors were encountered:
for Windows in: C:\Users\xxxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src\WiFiClient.cpp
line 80 and 87 _timeout = 1000; (original 5000)
WiFiClient::WiFiClient(ClientContext* client)
: _client(client), _owned(0)
{
_timeout = 1000; // was 5000
_client->ref();
WiFiClient::_add(this);
setSync(defaultSync);
setNoDelay(defaultNoDelay);
}
`
I'm wondering why it is hardcoded, so one normally can't change.
I know, it is not the best way to make changes in libraries, but i had no better idea.
For me, a timeout of 1000ms is sufficient, maybe in other applications it could be too low.
I use the lib on a thermostat with an ESP8266 with another library OpenTherm and the heater requires as I understand that at least EVERY 1SECOND a call is done to the routine. The effect is in my case, I think,that if my thermostat loses contact with the server the heater is turned on. So I want this routine to be non-blocking with the connect command OR return within say 800ms,
Hi,
i'm using a battery powered ESP8266 and PubSubClient (latest version) with Home Assistant on Raspi3 and Mosquitto Broker.
Normally, all is working fine.
Now, if in case of a blackout the mosquitto Broker is unreachable, the connect function of PubSubClient has a timeout of 5 seconds.
this is too long for my battery powered equipment.
I tried to use setSocketTimeout(1) before using connect() but nothing is changing.
Setting MQTT_SOCKET_TIMEOUT to 1 in PubSubClient.h also does not change anything.
The text was updated successfully, but these errors were encountered: