because you’ve put delay in a lambda, you’re actually calling the C++ delay function, which takes milliseconds as a parameter. That’s probably why it seems so short. I’m not sure this is a good idea in ESPHome code. You may actually be crashing your ESP32 as delays interfere with ESP watchdog timers and WiFi processing.
Maybe try coding it in yaml, i.e. using an ESPHome delay. Note the ESPHome delay is a non-blocking, i.e. other code will run in the background.
Thanks. Yes, you’re correct there. It is crashing it.
I was using the delay in initial testing and all is fine, but I need to be able to adjust the length of the delay from HA, and that is where I am stuck.
The values are being passed from HA to ESPhome OK, I just can’t find a way to assign them as variables to use in the delay.
oh yeah, sorry, when delay is templated like this, it assumes milliseconds, so assuming your delays are in seconds, multiply by 1000 as per the example in the docs, so
I use values for different purpose. I don’t need delay. I need set temperature on both sides (HA & ESP).
It’s not general thermostat. It’s solar panel controller (hot water system).
I need set remotely and localy difference temperature for turn on the pump.
Could you refresh your second post in this thread?
Heya
Wrote a little instructable with a little project I done passing variables from home aasistant to esphomehttps://www.instructables.com/id/ESPHOME-SONOF-S26-Timed-Light/
/Updates: In the end I implemented with a timer inside ESPHome and works as expected. Even so, I don’t understand why lambda does not work with the delay.
I have the below implementation, and after a few runs, the switch stuck with ON state. Any ideas what I am doing wrong?
For small values (1-5s works as expected), but when I multiple with 60000 to have minutes it beginnings to not work anymore as expected.