What are you ultimately trying to achieve with this? It lools like your trying to create a way to assign code/s rarher than using codes that are saved in memory.
I would like to make a stand alone alarm in Esphome, that is still working when my HA server is down.
I was thinking to make some variables that I can update by the webserver.
And then using this varaible for disarming the alarm panel.
I think thee "codes: " configuration requires fixed integers only and you cant or atleast not easily.
A workaround would be to create plenty of extra additional or single use codes and then add a template select entity. The options for the Select will be each of your extra codes.
Next, in your
on_state:
then:
- lambda: !lambda |-
ESP_LOGD("TEST", "State change %s",
Your going to add a condition that checks for each/any of your extra codes. If a code has been selected(activated) then Unlock or whatever. Likewise if no codes are selected then the condition doesnt pass and the codes do nothing.
You could even add a text sensor to apply a name or memo for activating the code and also put it on a 12/24hr timer and have it automatically disable extra codes.