Closed atd closed 4 years ago
I manage to figure out both issues:
- MQTT connection does not work
It does when using last release https://github.com/AnaviTechnology/anavi-thermometer-sw/releases/tag/1.0.1
I made a git bisect
and first bad commit is 4b83874d31a2074beb862d15db8bfde9df58fe1a
So maybe we need to update some library? cc @cederlys
- OLED Display is only on when USB to UART is disconnected. It remains blank and the red D1 led remains on
I was booting ANAVI Thermometer with the USB to UART device attached. Removing it before booting fixes this one
I can see that you don't have any MQTT username and password set. The handling of that changed in 0b88565a4aa7d59a6b. Are you sure you have configured your MQTT broker to accept anonymous MQTT connections?
But I find it strange that you claim that 4b83874 is the commit that introduces your issue. That commit adds a will, but shouldn't change how the username and password is handled. This code works fo me, but I am using a username and password.
Are you sure you have configured your MQTT broker to accept anonymous MQTT connections?
Previous commit 7c486c3ae0366c799289d86ca6253a1d8fd2bd38 works fine. So I guess it does :smile:
Besides, I can connect with MQTT Explorer without any problem (no user and password)
Hi @atd, @cederlys,
Sorry for stepping in the discussion later. I've just tested. I confirm with the latest revision I am also unable to connect to a MQTT broker anonymously (without username and password). Otherwise the MQTT broker accepts anonymous connections. I am try to debug it further right now.
Thanks, Leon
Hi @atd, @cederlys,
According to MQTT protocol version 5.0, the MQTT broker must allow 23 UTF-8 encoded bytes for ClientID. Some brokers MAY allow a longer ClientID but there are no guarantees: https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901059
I was testing with the default configurations of mosquitto version 1.5.7 with anonymous access (no username/password for clients) and I had issues in the cases when the ClientID was long.
I have fixed the issue in e900f4fe948eca5cf7af685204126c92f30f945c by reducing length of the ClientId below 23 bytes. As a safety net during development, I have also set a default non-empty clientID, just in case that during feature debugging MQTTConnection::set_spec is never called. Some MQTT brokers might not accept connections from clients with empty ID.
@atd, I added your credentials in a "Reported-by" trailer in the commit. Thank you for noticing and reporting this very specific issues. Could you please test and confirm that it works for your case?
@cederlys thank you again for your huge contributions to the project and for the major changes related to MQTT connections and MQTT last will and testament.
Thanks, Leon
I can confirm that e900f4f works ok
Thank you Leon
I have just uploaded the sketch from
master
branch using the instructions in the documentation, but I have to issues:I have double checked the library versions and everything seems to be ok
The output from Arduino IDE when uploading
The output from the serial monitor:
Mosquitto server logs: