ok, i have my device with one relay and one button witch connects to mqtt.
While im connected to broker button works just fine, but when im not connected to broker the device reads the state of the button and changes the state of the switch sometimes (sometimes i mean once (sometimes two) while trying to reconnect :/) but not as it should.
Something is blocking the loop where is my btnCheck() funcion but i dont know where beacouse i usually runs code without delays and that wasnt a problem before i started exploring MQTT service.
And thats how i know thats MQTT thing
GOAL:
I want my button to controll the relay properly even while client is disconnected
heres the code:
This is related to the PR in #640. Try using the mqtt_esp8266_nonblocking example as a guide, and make sure to reduce the client connection timeout from the default 5 seconds with espClient.setTimeout()
ok, i have my device with one relay and one button witch connects to mqtt. While im connected to broker button works just fine, but when im not connected to broker the device reads the state of the button and changes the state of the switch sometimes (sometimes i mean once (sometimes two) while trying to reconnect :/) but not as it should. Something is blocking the loop where is my btnCheck() funcion but i dont know where beacouse i usually runs code without delays and that wasnt a problem before i started exploring MQTT service. And thats how i know thats MQTT thing GOAL: I want my button to controll the relay properly even while client is disconnected heres the code: