patrick3399 / Hi-Link_mmWave_Radar_ESPHome

Hi-Link LD1115H, LD1125H, LD017, LD016 mmWave Radar with ESPHome Example Code
247 stars 36 forks source link

LD1125H Rmax not being restored #17

Open bluegizmo83 opened 1 year ago

bluegizmo83 commented 1 year ago

The ESPHome code for restore_value for Rmax is set to TRUE, but after every power cycle of the ESP32 it does not restore the value. For example, if I have Rmax set to 2 meters, In Home Assistant the value looks restored after a power cycle as it still shows 2, but the sensor reads beyond 2 meters until I move the slider then set it back to 2 again. I'm not sure if the sensitivity sliders are really restoring their values or not, because adjusting the sensitivity barely seems to do anything anyway, so it's hard to tell for those.

jcastro commented 1 year ago

Yes! I was about to report this as well. Here's a video showing this behavior. In my case, I don't think I've restarted the ESP32, but it seems to "randomly" start to read more distance than the one that's set. Hope this helps @patrick3399

https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome/assets/190036/48ebac98-d494-422f-9bf7-57126828493c

In the video as you can see if I have set the rmax to 2 meters, but still detecting more than that!

patrick3399 commented 1 year ago

II will change the code. And need both of you to test the new code.

jcastro commented 1 year ago

II will change the code. And need both of you to test the new code.

for sure! would love to, thanks a lot

patrick3399 commented 1 year ago

https://pastebin.com/meR6aMcs @jcastro @bluegizmo83 Here is a test version. Please give me feedback if you use it.

jcastro commented 1 year ago

https://pastebin.com/meR6aMcs

@jcastro @bluegizmo83

Here is a test version. Please give me feedback if you use it.

Sure! Do you mind sharing what you changed so I can attach it or change it on my config?

jcastro commented 1 year ago

@patrick3399 I've tested it but I can't compile, even if I change version to recommended in the esp32: section

`HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

jcastro commented 1 year ago

If I use the file as it is, using latest for version section in esp32

https://pastebin.com/TUM9CPVL

patrick3399 commented 1 year ago

@jcastro Here is a new version. It can be compile at ESPHome 2023.7.0 https://pastebin.com/rBGWHxPn

jcastro commented 1 year ago

@jcastro Here is a new version. It can be compile at ESPHome 2023.7.0 https://pastebin.com/rBGWHxPn

Thanks! this one compiled correctly. Testing the new code as we speak!

bluegizmo83 commented 1 year ago

@jcastro Here is a new version. It can be compile at ESPHome 2023.7.0 https://pastebin.com/rBGWHxPn

I just tested this version as well. Still has the same problem. I set the RMax to 1 meter for testing, and it stops detecting at 1 meter as it should, but then as soon as the sensor is power cycled, it starts reading well passed 1 meter again, like its not remembering the setting, even though Home Assistant still shows the RMax value is set a 1 meter.

jcastro commented 1 year ago

I've tried to restart it (using the ESPHome restart button) and it seems to save and restore it correctly. How are you powering off and on the ESP32 board? I will try to reproduce it too!

bluegizmo83 commented 1 year ago

I've tried to restart it (using the ESPHome restart button) and it seems to save and restore it correctly. How are you powering off and on the ESP32 board? I will try to reproduce it too!

I'm currently powering the ESP32 board via the usb port with a power bank. Unplugging the usb power and plugging it back in is how I've been power cycling it.

Edit: OK this is really weird! After that first power cycle, now the rmax won't take effect at all! I tried to go back and set it to 1 meter again and it's still detecting out to 2.6 meters no matter what I set the rmax to. I even tried re-uploading the same esphome code and rmax settings are still not taking effect

Edit2: OK after several more power cycle test... sometimes after a power cycle, changing the rmax value in home assistant as no effect until I power cycle the ESP32 it again, then it takes effect. Sometimes it remembers the last value and functions as it should, and sometimes it doesn't. I don't get it.

patrick3399 commented 1 year ago

Oh,There is a ESPHome setting to prevent the Flash overwrite, so make the change and wait 3 minute to restart. Maybe it can make the setting correctly.

Surgikill commented 6 months ago

I seem to be having the same issue. Is there any official fix/update for this?