-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing MQTT_LOGIN & MQTT_PASSWORD still indicates connected to MQTT broker. #7
Comments
Interesting. I'll have a look at that, thanks for the report. |
I had a similar issue, I fudged the IP address for MQTT, but it still said "Connected to MQTT broker" in the serial monitor. Looking at the code, I would blame the upstram library, because it only returns |
@timmillwood thanks for digging into this, this JUST bit me again a few weeks back Any chance I could trouble you for a link to the offending lines in |
If you follow the call path from this point in HAIntegration.cpp: if (mqtt.begin(MQTT_BROKER, MQTT_LOGIN, MQTT_PASSWORD) == true) {
Serial.print("Connected to MQTT broker\n");
} else {
Serial.print("Could not connect to MQTT broker\n");
} calls:
which calls:
which sets a call back function:
Attempts to connecting to the mqtt server only happens in the
function which is called in the HAMqtt:loop() function. Probably would would be better is to interpret the result from mqtt.begin not as a successful connection but a successful instantiation of the object. So maybe change this line: Serial.print("Could not connect to MQTT broker"); to this: Serial.print("Could (re)instantiate MQTT object"); The (re) is because it looks like you would get a false if you tried to call mqtt.begin() twice as well. |
I found this note in the ArduinoHA documentation this morning that confirms intent.
|
If MQTT_LOGIN & MQTT_PASSWORD left blank:
Application still indicates that it connects to the MQTT Broker but Controls do not work.
If I add the LOGIN and PASSWORD everything works fine.
The text was updated successfully, but these errors were encountered: