-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
RTL8710BX - authentication error when updating OTA from 2023.5.0-dev to 2023.5.0-dev #142
Comments
Well, are you sure the password is correct? |
I'm very sure the password is correct. I'm using the same secrets.yaml for both ESPHome and LibreTiny ESPHome, and this is the only device where I have this issue. |
You're right, it doesn't explain that. |
I did flash the uf2 file (the initial one and a recreated one) over serial and the issue persists. Could it have something to do with the bootloader? My device is an EZVIZ plug, not a Tuya one. You previously had to make a few changes to make it flashable. |
Did you also flash the LibreTuya one (old version)? The one that you had no problems with (from what I understand). |
Yes, flashing over serial the old one works fine, flashing over serial the new one causes the above mentioned issues. |
Do this:
|
Unfortunately I'm not able to get UART logs because it's a power plug on 220V. |
Don't grab logs when it's on 220V, do it just like you're flashing it. Power it from the flasher (or some external power supply), it should work just like it does on 220V (well, maybe the relay won't click, but apart from this there should be no difference). |
Thank you for the suggestion :)
Here are the full logs. Reattaching also the elf and uf2. P.S. Removing the OTA password allowed me to flash more firmware OTA. |
@kuba2k2 It looks to me like the two Solis S3 stick users with OTA problems did not initially flash the UF2 image (due to the ltchiptool problems for EMW3080) but the individual 0xB000-OTA1 and 0x100000-OTA2 images. Could it be that in this case one has to zero-out certain memory area (the one for passwords?) so that it is initialised correctly? |
There shouldn't be any difference, as the UF2 is really just a wrapper for the underlying OTA1/2 images. However, only one of them is flashed with the UF2, not both (as that would overwrite the currently running binary, in case of OTA). That shouldn't cause any issues, as the OTA1/2 firmware doesn't care about the other region. There's also no specific memory area for passwords. It's just hardcoded somewhere in the program's code. |
Hi @kuba2k2, any ideea how to solve this issue? |
Sorry, no idea. It works for me, but I'm not using the OTA password. If you can, try simply removing the password or updating via web_server. |
Yeah, I removed the OTA password. |
The OTA component does challenge-response auth using an MD5 hash of pw-nonce-cnonce. ESPHome Python CLI log:
MCU log:
The MCU does not correctly calculate the resulting hash (
I traced the |
If I use a hammer (don't know how to do it via an configure option) to replace
I am still confused why this error occurs. Calculating the hash value of the password or nonce alone seems to work, also different consecutive combinations of |
I thought it's a problem with the md5 impl, I haven't had time today to try and fix it. The only place you need to change that define is in lt_defs.h. If changing it there from polarssl to mbedtls works, it's a fix. It might be caused by memory allocation of the md5 context... I'm not sure how that works exactly. |
I pushed hn/ginlong-solis@2b9af93 as a preliminary fix. Would be nice to know why Polar SSL does not work correctly. |
It's probably because parts of it belong in the ROM area (which probably uses an old version or something). In LT, both implementations call the same functions from PolarSSL and mbedTLS, appropriately (polar was renamed to mbed a long time ago). Since it fixes the issue (we don't want to use polar anyway; everything else like WiFiClientSecure uses mbed already), you can create a PR for that if you'd like. |
Thanks, I'll double-check with a clean install and create a PR then. |
libretiny-eu/libretiny#142 has been fixed in the meantime
Hi @kuba2k2,
I'm getting the below error when trying to update OTA from libretiny 2023.5.0-dev to libretiny 2023.5.0-dev:
I've successfully updated OTA from libretuya 2023.1.0-dev to libretiny 2023.5.0-dev.
With the libretiny 2023.5.0-dev firmware I'm also not able to access the web server of the device because it resets.
I'm also receiving data from it in HA but not able to control the relay.
I'm attaching the working libretuya 2023.1.0-dev firmware and faulty libretiny 2023.5.0-dev firmware.
plug-ezviz_2023.1.0-dev.uf2.zip
plug-ezviz_2023.5.0-dev.uf2.zip
And here is the config file:
I was able to update just fine a CB2S.
The text was updated successfully, but these errors were encountered: