-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[MQTT] Allow client ID + longer user/pass credentials #2972
Conversation
@uzi18 Would be appreciated if you can have a look at this. |
I made a test build: ESPEasy_mega-20200328-6-PR_2972.zip Also noticed these changes do add up to the build size (surprise!) so I will also try to add #ifdef wrappers to some code for the minimal setup. |
Connection to Losant works with Unfortunately the connection is immediately dropped (a Losant quirk), because the LWT message with retain is still sent despite the checkboxes being unchecked. I suspect this is a separate issue to this PR, as the behaviour is replicated with normal releases when I extend the length of the controlleruser and controllerpassword within SecurityStruct.h . |
OK, thanks for testing. |
c240eca
to
ab84b38
Compare
@TD-er I see huge changes - first eye on this did not reveal anything suspicious, will look more into new save/load strings routines. |
Do you have a link? |
Losant will drop the connection if any message is sent with the retain flag set. It will accept a (pointless) LWT message without the retain flag and treat it like any other message. Testing against another broker indicates that despite both "Send LWT to broker" and "Will Retain" being unchecked, a LWT message is still being sent with the retain flag set. I am pretty sure this was also the case when I modified other recent builds to extend the length of controlleruser and controllerpassword. Older builds (before these checkboxes were available) worked fine with Losant when I made the changes and just hard-coded the LWT retain flag to 0. |
I've discovered there might actually be a problem with the implementation of the long password though. When I change an MQTT setting (eg enable to disable and back again), I need to re-enter the complete long password or the new connection will fail with invalid credentials (ie the password is not retained after a setting change). Possibly this is by design, but I don't think it used to be this way. |
Depends on what you changed. |
From successful connections (cycling connected/dropped due LWT retain flag), disable/submit, then enable/submit results in connection failed with wrong credentials. Blanked-out password (5 dots) is still visable in form field. Re-entering the password resumes the successful connection/dropped cycle. |
When checking the "Use Extended Credentials", the user name + pass field for the controller can be extended up-to 128 bytes. This limit is only applicable to the text field, so it can later be extended to longer when needed. All user + pass fields for all controllers must be within the 1 kByte (including 1 extra byte per field)
ab84b38
to
95010a3
Compare
I found an issue with handling the rendering of combo boxes. |
The function `executeInternalCommand` now takes roughly 3 kByte less in the binary. Expansion of the macro resulted in quite some additional binary size. Now the logic is moved to a separate function.
In an attempt to make the ESP respond faster as we have a lot of reports related to timeouts and lost connections lately.
I've made a few other changes and also a new test build: ESPEasy_mega-20200328-15-PR_2972.zip Please let me know if it is behaving badly. (or not :) ) |
Nope; no change with the new build unfortunately. Still:
|
That's strange as I have tested it here. Which controller do you use? |
C005; OpenHAB/HA MQTT. You've got me wondering if I've got a hardware issue with these unreproducable errors. I'll dig up a D1 mini I've got in the garage somewhere and get back to you... |
Well sometimes it can also be some corrupted settings, so doesn't have to be a hardware issue. |
Just re-checked with a fresh-out-of-the-antistatic-bag D1 mini; this build still loses the long password for me. In all cases I am flashing the blank image before the test image, and setting up from scratch. I've even re-downloaded the PR test release. The long password is retained over a soft or hard reset, or power-cycle, so really this isn't that big an issue. Might trip people up though having to repopulate the password when it looks like it's filled-in. Losant accounts are free at https://accounts.losant.com/create-account if you need an example public broker with a long password to test against. |
Just to be sure, you only toggle the enable checkbox and not the "Extended credentials" checkbox? |
Yep; only touched the enabled checkbox. |
@denisfrench I tried to reproduce the issue you reported, but I was not able to. So I will merge this this evening, unless anyone has any objections about it? |
I'm still getting the lost password after disable/enable on a custom build from the merged source, which I can't explain, but can live with. Probably related is that the long password was not successfullly set by custom.h despite #define DEFAULT_USE_EXTD_CONTROLLER_CREDENTIALS being set to true. Should I raise a separate issue about sending the LWT message when disabled in the UI, or was this unable to be reproduced as well? |
I guess that last part of setting defaults in the Custom.h could be it. |
Also moved all 'global' MQTT settings to the controller settings.