MQTT blocking connect mqttStart() behavior #187
sleepypig2003
started this conversation in
General
Replies: 1 comment
-
There is an ongoing discussion about this here: Allow offline mode #61 For arduino we use Pubsubclient. On the PC we use Paho single threaded as mqtt client. Pubsubclient has a blocking timeout when it's trying to (re)connect to the MQTT broker. There's just not an overall solution for this issue yet. A great deal of the functionality depends on the broker being active. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I noticed that the behavior when openhasp lost the mqtt connection is that it clears the UI, stops everything and displays a progress bar.
I think when this is running on a switchplate with a local relay, like the lanbon8, this would prevent users from operating the local relay (turn on/off lights), when homeassistant is off.
Is there a way we can have mqttStart() to immediately exit if the connection fails? This way openhasp just keeps retrying.
The two other changes I am thinking of:
hasp_mqtt_pubsubclient.cpp:
void mqttStart()
...
haspProgressMsg(F(D_MQTT_CONNECTING));
haspProgressVal(mqttReconnectCount * 5);
...
what do you think if I put a return on failure? ie.
...
default:
LOG_WARNING(TAG_MQTT, F("Unknown failure"));
return;
}
ps. I also noticed there are threaded mqtt code in openhasp - unsure if this was the intended direction this was going to go to
Beta Was this translation helpful? Give feedback.
All reactions