Multiple triggers to cause an action

Posted on
Mon Jul 10, 2017 9:54 pm
Gangotti offline
User avatar
Posts: 81
Joined: Dec 23, 2014
Location: Las Vegas, NV

Multiple triggers to cause an action

It would be great if you could use multiple devices to trigger single actions, for example: If device 1 is on AND device 2 is off then trigger action A. in this instance both devices need to be on to trigger the action. you could take it a step further and say if device 1 OR device 2 is on trigger Action B. In this instance either device would trigger the action. I find that I am building many virtual devices just to contain a little bit of operational logic to run my trigger and schedules. To build that into the Triggers section would make it very flexible. Thoughts?

Posted on
Mon Jul 10, 2017 11:59 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Multiple triggers to cause an action

Although all this logic being together in one trigger would look nicer in the list of triggers, the actual logic or time taken to build the trigger would be no quicker than doing it with separate triggers. You're still creating up to eight conditions with different actions.

You don't need virtual devices either, though I know they can be used in this situation if desired.

My preference if in this situation is (up to) eight triggers: (written in pseudocode here for readability)

WHEN DevA.deviceStateChanged
CONDITION DevA.onState = On
AND
CONDITION DevB.onState = Off
ACTIONS = This and That.

Duplicate the trigger seven more times and tweak On/Off to suit.

Having written all this, I presume you're aware you can add multiple nested conditions to a trigger? Hold the option key on keyboard when pressing + button in the condition UI.

Also having said all that, I know adding else() functionality to triggers is already on the wish list.

Does any of that help?


Sent from my iPhone using Tapatalk Pro

Posted on
Tue Jul 11, 2017 4:45 am
Japple55 offline
Posts: 224
Joined: Sep 26, 2015
Location: NE Tennessee

Re: Multiple triggers to cause an action

howartp wrote:

Having written all this, I presume you're aware you can add multiple nested conditions to a trigger? Hold the option key on keyboard when pressing + button in the condition UI.


Did not know that! Thanks Howard.

Posted on
Tue Jul 11, 2017 6:46 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Multiple triggers to cause an action

howartp wrote:

Having written all this, I presume you're aware you can add multiple nested conditions to a trigger? Hold the option key on keyboard when pressing + button in the condition UI.


This was also totally new news to me. Gotta try it!

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue Jul 11, 2017 6:56 am
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: Multiple triggers to cause an action

But (as has been posted elsewhere) being able to tie a different set of actions to each condition collection would REALLY let me cut down on the number of triggers...

Posted on
Tue Jul 11, 2017 9:03 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Multiple triggers to cause an action

Gangotti wrote:
It would be great if you could use multiple devices to trigger single actions, for example: If device 1 is on AND device 2 is off then trigger action A. in this instance both devices need to be on to trigger the action. you could take it a step further and say if device 1 OR device 2 is on trigger Action B. In this instance either device would trigger the action. I find that I am building many virtual devices just to contain a little bit of operational logic to run my trigger and schedules. To build that into the Triggers section would make it very flexible. Thoughts?


What you are describing, or at least how you are describing it, is not feasible. A trigger is fired based on an event (a state change): device 1 BECOMES on device 2 BECOMES off, etc. What you are describing aren't triggering events unless you really mean that device 1 turns on and at the exact same moment device 2 turns off.

If you mean if device 1 goes on and device 2 is off, then the second part of that statement is a condition and can be represented in the Conditions panel as howartp describes above (no virtual devices required). But if that's not what you meant, then can you describe more specifically what you're looking to do?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jul 11, 2017 3:41 pm
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: Multiple triggers to cause an action

I suspect he really wants the OR condition; for example I have to have 18 triggers in my security folder that all do the same thing; update the house state to not secure if any one of the window switches opens and another 18 which all do the same thing; run a script to check all 18 window switches for closed and set the house state to secure if they are all closed. It would be a lot cleaner if there were a single trigger that would fire when ANY window sensor becomes "open", and a second single trigger that fires whenever any window sensor becomes closed. As you say the AND case (fire when A becomes open AND B is open or vice versa) can easily be handled with the current condition strategy; I could even use that technique rather than the script in the 18 "Secure on all closed" triggers I've got now, but making sure it got updated if I want to add a new nonwindow sensor somewhere would be a hassle, where the script only needs to be updated once. But it's still a huge list of triggers, especially since you don't have nested folders to stuff them in.

Posted on
Tue Jul 11, 2017 3:46 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Multiple triggers to cause an action

If you want to OR 18 devices as in your scenario then a virtual device is the way to go.

Two triggers, one virtual device, no hassle to add a new window.


Sent from my iPhone using Tapatalk Pro

Posted on
Tue Jul 11, 2017 3:53 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Multiple triggers to cause an action

howartp wrote:
If you want to OR 18 devices as in your scenario then a virtual device is the way to go.

Two triggers, one virtual device, no hassle to add a new window.


Sent from my iPhone using Tapatalk Pro

In fact...

No triggers or Scripts needed - your virtual device IS your house state, or part of it.

If any window is open, your virtual device is On, otherwise it is Off (or vice-versa; can't remember which way the logic works). No triggering on if(window becomes open) etc.


Sent from my iPhone using Tapatalk Pro

Posted on
Tue Jul 11, 2017 4:07 pm
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: Multiple triggers to cause an action

Can I create virtual devices out of Plugin devices (specifically PiBeacon GPIOs)? I always thought they were restricted to Insteon devices as a source. If they can, I can also use them on my GhostXML power sources as well.

Posted on
Tue Jul 11, 2017 4:09 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Multiple triggers to cause an action

I *think* from memory it's anything that supports onOffState but don't quote me on that.

(edit: Zwave sensors definitely work in them, it's not just Insteon)

Sent from my iPad using Tapatalk Pro

Posted on
Tue Jul 11, 2017 4:35 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Multiple triggers to cause an action

Any device that is an indigo.dimmer, indigo.relay, or indigo.sensor which has an onState property (if you have an onOffState in your states list, it gets automatically populated into the onState property) that's not null will show in the list of available devices (now you can use SupportsOnState). So, if your plugin implements any of those device types then it should show in the list.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jul 11, 2017 4:46 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Multiple triggers to cause an action

OK, the option click on + thing.

How is this:

Code: Select all
If ALL of the following are true
      Condition one
      Condition two

different from

Code: Select all
If ALL of the following are true
      Condition one
                 If ALL of the following are true:
                  Condition two


Or does it only become important when there are more things, or ANY instead of ALL?

Ooh, ooh, that's it, isn't it? Allowing ANYs nested inside ALLs? And vice versa?

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue Jul 11, 2017 4:52 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Multiple triggers to cause an action

Ooh, ooh

Yup! :-)


Sent from my iPhone using Tapatalk Pro

Posted on
Tue Jul 11, 2017 4:55 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Multiple triggers to cause an action

Yes - conditions can be arbitrarily complex by creating nested hierarchical groups of any, all, and none.

(That was my very first major functionality addition to Indigo way back in Indigo 4).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Who is online

Users browsing this forum: No registered users and 5 guests