Defining a variable


#1

1) Give a description of the problem

I have multiple similar pistons. To simplify duplication, I use the “define” area quite a bit. I cannot figure out if it’s possible to use this to define the name of a variable. Easier to show in pic form…

2) What is the expected behaviour?

Can I use this area…

image

… to define which variable (the actual variable, not it’s value) over here…

image

… so that I can define the variable…

TESTVARIABLE = @maxtemp_bedroom

…have a bit of code saying something like…

if temp changes
set TESTVARIABLE to (current-time)
endif

…and this would actually change the value of @maxtemp_bedroom to the current time ?

The reason for this is to be able to alter a single definition at the start of the piston without needing to alter multiple references.

Don’t even know if this is possible, I certainly can’t find a way, so thought I’d probably get a quick “nope, forget it” if it’s a no go! =p

3) What is happening/not happening?

n/a

4) Post a Green Snapshot of the pistonimage

n/a

5) Attach logs after turning logging level to Full

n/a

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

No, what you are asking is not possible. You want a variable to contain the name of a variable rather than the value. Not possible.

Still not sure why you would want to do this. I also have several pistons that are nearly identical but just used for either different rooms or different locations. In your example, I would just have in the piston a maxtemp variable used throughout, create three copies of the piston (bedroom, frontroom, and hallway) and then in the define, set maxtemp to the appropriate values. Same for the devices being controlled. Define a variable at the top used throughout and then only edit those definitions from one piston to the next. Everything else would be the same.


#3

Thanks, thought so. =)