How to force piston to run for test purposes?


#1

I have a simple piston that I would like to simulate so I can debug the logic. My hope is that the logging would then help me figure out why it is not working.
I tried to include a ‘test variable’ but cannot understand how to force this to value of 1 (preset value is 0). This would satisfy IF statement and run the action.

  1. How do I force a defined variable to a value? I cannot figure it out?
  2. What is the best way to test a piston? This would help me test my own pistons and understand how WebCoRE works.

#2

Got an example of what you’re trying to do? I personally use virtual devices when creating pistons (production and testing). Substitute your real devices when the piston works as desired.


#3

Hit the test button. Unless you’re using triggers, that’ll do the trick. Triggers are trickier, as certain things need to happen. I just open/close that door or turn on/off that switch…


#4

I add an OR time is any to be able to test a piston. Then I can just remove that afterwards


#5

Hmmm, I looked for virtual devices to use as eibyer mentioned but could not find what you were referring to?
I am trying to use a variable as shown below. When done, I will remove the variable and change ‘or’ to ‘and’. If I can ‘force’ the variable to a value of 1 the piston should run and operate just as the other conditions do.

This is a trigger so I can’t use test button as ady624 mentioned.
Thanks for your help.


#6

You can edit variables from the piston view page. If that’s all your trying to accomplish?


#7

This is what I had posted for someone else previously.


#8

I now understand how I can use virtual devices for purpose of debug. Great idea!
As for the variables, I cannot find out how to force a local variable to a value…say ‘1’.
Maybe I’m not sure what the piston view page is.
I’m thinking this is the first page when I go into the piston, right? The only place I see the local variable is in the code and I can only change the initial state when I click on it.


#9

Select the edit button next to the variable


#10

I’m working on a piston that triggers based on presence. For testing purposes I’ve created a virtual presence sensor and added it to the set of presence sensors the piston watches.

I can’t figure out how to force the presence to “present” and thus trigger my piston to run. What’s the best way to change the state of the virtual sensor and cause the piston to run?

Edit: I’m an idiot. I can just toggle the state on the virtual sensor in the SmartThings app. DUH :slight_smile: