App level variable


(Morgan) #1

Is there a way to define an app level variable? I’m trying to fix the Power Allowance app, so it won’t just create a delay and then turn off a switch after a time period, even though it was been turned off and back on.

I didn’t know if there was a way to define a app level variable, I can check or if I’m going to use the schedule and create a time, and then cancel all schedule when i turn off the switch.

Anyone with any ideas?


(Col Hack) #2

The SmartApp class defines ‘state’ hash. You can add your variables to the hash like this: state.MyVariable = 12345