Workflow: additional variables in transitions

I frequently find that I would like to check another device variable as part of a workflow transition. Would it be possible to add some additional device variables with user defined names (or some simple generated name) that could be used when the watch for the transition is checked? We already have “new” and “old”. Could we have “var1”, “var2”, etc.? These are not triggers for the transition - they are there to be used in the expression. They are watches that are not used to trigger the transition, but are updated to the correct value when the main watched variable is updated.

I can do this with a function in the expression that does the luup.variable_get(), but that’s awkward and hard to debug in the limited window available.

I can also add states to cover these cases, but then the workflow gets cumbersome. An example where this would be useful is in detection of nobody home with multiple presence sensors. I need a transition for each one indicating presence is no longer tripped, and each of these transitions needs to check that the others are already off before declaring nobody is home. I could have 2^n states for the ‘n’ sensors, but this gets complicated quickly as n increases.

Or is there a better way to do this in workflows? I could have a combination switch and trigger off of that, but it seems that something built in to the workflows would be nice.

It sounds that the Bags[] mechanism could be used ?
Bags[“any name”] can be initialized in any state Lua code and used in expressions.

I don’t think I need anything additional. Take a look at the attached snapshot. Is it guaranteed that the ‘Susie’ device with ‘Triggeronly’ set will always be the trigger as long as the ‘John’ variable is set to “0”? In other words, this will only transition when Susie’s Tripped goes to “0” (from any other value) and at the same time John’s Tripped is equal to “0”. Correct?

thanks!

[quote=“jswim788, post:3, topic:197092”]I don’t think I need anything additional. Take a look at the attached snapshot. Is it guaranteed that the ‘Susie’ device with ‘Triggeronly’ set will always be the trigger as long as the ‘John’ variable is set to “0”? In other words, this will only transition when Susie’s Tripped goes to “0” (from any other value) and at the same time John’s Tripped is equal to “0”. Correct?

thanks![/quote]

yes correct. logical AND of all conditions and the triggeronly flag forces this one to be the trigger

Thanks for confirming this. This makes it easy to get the trigger condition I need. The workflows are really useful - thanks for implementing this feature.