Dynamic variables as inputs?

What I want to do is loop through a list of presence devices, and allow options set for each. I haven't messed with dynamic pages, but I haven't seen anything about dynamic inputs, like:

n = 0
input "person{$n}","text", "Input some text"

I don't care whether the name of the variable is dynamic, or it uses a map, but I need a different "text" for each person.

Any way to get to my goal on this?

Sure, that will work as you expect.

Except your syntax is wrong:

input "person${n}", ...

or even just

input "person$n", ...

Literally LOL...


edit: I totally made it up.... So Im shocked.

1 Like

Stuck again. So I do:

input "person${n}", ...

But when I try to do something like:

log.debug person${n}

I get an error. What's the trick?

Several years ago I worked with another community member in ST land on an alarm integration where we used a dynamic page with dynamic inputs. Here is the code if you want a working example.

Basically it prompts for the number of child device to create and then allows you to define details on those child devices.

1 Like

log.debug "person$n"