I have a delay variable I want to use in an ESPHome device. I’ve gone through a few YAML tutorials and see them using key/value pairs to set variables, but that doesn’t work in the config for ESPHome. It looks like I have to set up a substitution, like this:
substitutions:
VentFanDelay: 120 #delay in seconds
And then, later, I use it by typing:
${VentFanDelay}
Is that right? It seems I can’t just set it early in the file with a line like:
VentFanDelay: 120 #delay in seconds
since that always gives me an error. And, since I can’t do that, it looks like I can’t just reference it by using the variable name, VentFanDelay
.
Is using a substitution the correct or preferred way to do this, or is there a way to use variables like I would in a language like Python, where I just define it and use the variable name later?
And, once I set this variable (or substitution), is there a way to change the value through the web interface? And once I change it, how persistent is the new value? Does it stay until I reboot the chip? Is there a way to store it so it survives a reboot?
Addendum:
While it might be possible to set it through HA, I’d like to do it through the website for several reasons. While, ultimately, this will work with HA, it’s a critical system and needs to be operational every day, and I don’t want it to depend on HA, which can take several days to fix and get up and running if an update breaks something. This is part of a system that involves 3 ESPHome devices and I want them to work both with HA and directly with each other, so I have an option and don’t lose functionality when HA is down.