Open bluegizmo83 opened 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
In the video as you can see if I have set the rmax to 2 meters, but still detecting more than that!
II will change the code. And need both of you to test the new code.
II will change the code. And need both of you to test the new code.
for sure! would love to, thanks a lot
https://pastebin.com/meR6aMcs @jcastro @bluegizmo83 Here is a test version. Please give me feedback if you use it.
@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?
@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
/config/esphome/salon-occupancy-test.yaml: In lambda function:
/config/esphome/salon-occupancy-test.yaml:111:19: error: redeclaration of 'std::__cxx11::string th2st'
std::string th2st = "save" + "\r\n";
^~~~~
/config/esphome/salon-occupancy-test.yaml:110:19: note: 'std::__cxx11::string th2st' previously declared here
std::string th2st = "mth2=" + str_sprintf("%.0f",x) +"\r\n";
^~~~~
/config/esphome/salon-occupancy-test.yaml:111:34: error: invalid operands of types 'const char [5]' and 'const char [3]' to binary 'operator+'
std::string th2st = "save" + "\r\n";
~~~~~~~^~~~~~~~
/config/esphome/salon-occupancy-test.yaml: In lambda function:
/config/esphome/salon-occupancy-test.yaml:129:34: error: invalid operands of types 'const char [5]' and 'const char [3]' to binary 'operator+'
std::string th2st = "save" + "\r\n";
~~~~~~~^~~~~~~~
/config/esphome/salon-occupancy-test.yaml: In lambda function:
/config/esphome/salon-occupancy-test.yaml:147:34: error: invalid operands of types 'const char [5]' and 'const char [3]' to binary 'operator+'
std::string th2st = "save" + "\r\n";
~~~~~~~^~~~~~~~
Compiling /data/salon-occupancy-test/.pioenvs/salon-occupancy-test/driver/rtc_io.o
Compiling /data/salon-occupancy-test/.pioenvs/salon-occupancy-test/driver/rtc_module.o
Compiling /data/salon-occupancy-test/.pioenvs/salon-occupancy-test/driver/sdspi_crc.o
Compiling /data/salon-occupancy-test/.pioenvs/salon-occupancy-test/driver/sdspi_host.o
Compiling /data/salon-occupancy-test/.pioenvs/salon-occupancy-test/driver/sdspi_transaction.o
Compiling /data/salon-occupancy-test/.pioenvs/salon-occupancy-test/driver/sigmadelta.o
Compiling /data/salon-occupancy-test/.pioenvs/salon-occupancy-test/driver/spi_common.o
Compiling /data/salon-occupancy-test/.pioenvs/salon-occupancy-test/driver/spi_master.o
Compiling /data/salon-occupancy-test/.pioenvs/salon-occupancy-test/driver/spi_slave.o
*** [/data/salon-occupancy-test/.pioenvs/salon-occupancy-test/src/main.o] Error 1
========================== [FAILED] Took 6.53 seconds ==========================`
If I use the file as it is, using latest
for version section in esp32
@jcastro Here is a new version. It can be compile at ESPHome 2023.7.0 https://pastebin.com/rBGWHxPn
@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!
@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.
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'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.
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.
I seem to be having the same issue. Is there any official fix/update for this?
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.