Webcore - Use switch Auto-off in device page or programatically turn it off?

Is it better to have triggering switches set to auto-off in the device page or is it better to reset the switch in my piston?

What are you judging by?

Usually I like logic in 1 place, otherwise you have to keep in mind 1st order, and then 2nd or 3rd order behaviors...

I guess this comes from my not-so-sure understanding of triggers. If a device triggers my piston to run, and then I reset that device mid-piston, does that state change trigger the piston again? I know that the piston won't run because of the state of the device. But when the piston is triggered the second time, what happens to the first running piston?

There are several possibilities:

a) you are subscribed to device:switch attribute.

  • You are correct every time switch attribute changes, the piston will get an event

b) you are subscribed to device:switch:on.

  • you only get only on events (assuming you use the proper comparison)

Event are typically processed by webcore in order, on, then off is seen by the piston as two sequential events.

None of this is a problem per se. Whether this piston does the turn off or some other piston/app/device, this piston will still get the same events...

There is more on this in the webcore wiki articles:

1 Like

That clears it up for me. Thanks.