Is there someway to have rule triggers be based on events from multiple devices within a single trigger block?
Is there someway to take action on multiple devices within a single action block without having to add each device as a separate device with its own action?
I am trying to recreate a webCoRE automation that will turn on and off several different lights depending on which light was turned on or off. I know I can do it with separate rules and blocks but with 5 different lights that is going to take some time.
webCoRE piston if it helps (button numbers for devices shown because it is a double tap):
Short answer to both questions is no.
This is one of the big differences between webcore and sharptools and it was really hard to get used to.
There’s a feature request that may be of interest Select multiple devices in rule triggers and actions
You could aggregate the lights into a variable then use the variable in the rules but you’ll still have to enter all the triggers.
If you create the rule for the 3rd and 4th If blocks first you can copy and edit to create the other rule which will save entering the list of devices again.
The way I’m getting around this and not creating super long rules is to call a scene (which is easier to do in Sharptools since you don’t have to query to get the scene ID). You just need to create an ‘on’ and an ‘off’ scene for each state you’d like to call. By doing this, I’ve found it saves time when multiple triggers call the same set of lights. When any of the scenes have dimmers that you want to change the dimmer level later on, the level only needs to be adjusted in one place (ST scene) and not in each block of actions.
For the trigger, you can enter each of the buttons individually and the rule will trigger if any of them get pushed/held. What I don’t see (which we had in WC) is the ability to trigger based on a double click of the button.
Do you have an example for what you mean by aggregate the lights into a variable? I was trying to figure out a way to maybe do it that way but couldn’t figure it out.
Oh that’s very helpful I think that might be the easiest way to handle these!
For double press (at least for me) all of my light switches had extra buttons. So the light has on/off state and then button #1 (double up) and button #2 (double down) that would be used in the webCoRE rule.
It does look like the functions are there in sharptools I’m just not sure if they are going to work / function the same. I’ll be testing that out in the next few days:
How do you populate the $lights variable though? Or would it be another rule with a bunch of ORs with each condition being a light on or off turning the variable true / false?
It’s not as easy as creating and using scenes but a lot of people are struggling with reaching the 200 scene/routine limit in ST. If that’s not an issue for you then scenes may be the easiest route.
You will still have to add all the devices twice per rule but if you often control these devices as a group (all on or all off) then the variable makes it easier without adding every device to every rule.
$ lights Variable Rule
Triggers
$lights on changes to true
$lights on changes to false
If
$context.event.value is true
THEN
turn on light 1
turn on light 2
turn on light 3
turn on light 4
turn on light 5
ELSE
turn off light 1
turn off light 2
turn off light 3
turn off light 4
turn off light 5
Rule to recreate webcore pistons
Triggers
device 1 button 1 gets pushed
device 1 button 2 gets pushed
device 2 button 1 gets pushed
device 2 button 2 gets pushed
device 3 button 1 gets pushed
device 3 button 2 gets pushed
device 4 button 1 gets pushed
device 4 button 2 gets pushed
device 5 button 1 gets pushed
device 5 button 2 gets pushed
If (any)
(context variables are much quicker to add than device events plus they execute faster since it doesn’t have to poll the actual device status)
context.event.deviceName [device 1] button 1
context.event.deviceName [device 2] button 1
context.event.deviceName [device 3] button 1
context.event.deviceName [device 4] button 1
context.event.deviceName [device 5] button 1
Then
set variable $lights True (on)
Else
set variable $lights False (off)
Thanks, that makes sense. Kind of a lot of work so hopefully its a feature that gets added in the future.
The scene way is easier, but for me personally I really like to have all my automations in one spot (i even do simple closet light on / off automations in webCoRE) so that I know whats going on and can easily troubleshoot.