Feature Request: Ability to initialize variables


#1

Request ability to initialize variables. By selecting “Nothing selected” in initial value and being able to enter an initial value. Just like it looks once the values get populated, see below:

I wrote a piston for window state for my hvac control piston… It was a pain to either cycle all contact sensors or enter a value into “Variables” manually. I have 2 dozen contact sensors.


Thermostat Mode Change based on Outdoor Temp with Window Sensors
#2

That feature is already implemented. If you define variables, and leave them blank (not set), you can save the piston, and edit the initial variable by clicking on the highlighted pencil below:


Clicking on the pencil opens a popup window:

temp


Once you hit ‘Save’, it populates both locations


#3

that was exactly what i did, I would rather do it while creating the piston. try click the notepad, select value, and then type or paste the value 24 times, it is a pain in the rear.
if i can enter the value while creating the variable, much better; and then i can duplicate the variable 24 times with the starting value already set… :smiley:


#4

Yes. It would be nice to be able to set a starting value for a variable that only initializes it when you save the piston (rather than each time the piston runs as it currently does).


#5

One more tidbit that has saved me lots of time in the past…

In the body of your piston, instead of using the code:
IF variable is closed
you can create a double negative:
IF variable is not opened

Depending on the rest of your logic, it might work right from the start, without you initializing any of the variables.

Using the last example above, if the variable is either closed or (not set) when the new piston is saved, it would run perfectly without being initialized.


#6

Good point. I was testing with an uninitialized integer and it always seemed to evaluate to 0, but I wasn’t at all sure I could rely on that.