Is there some combination of rule/tile/variable that would allow me to create a “one way switch”?
Ie, switch turns on when I press the tile, but clicking it again doesn’t toggle it. Only another rule can turn the switch off.
Thanks
Is there some combination of rule/tile/variable that would allow me to create a “one way switch”?
Ie, switch turns on when I press the tile, but clicking it again doesn’t toggle it. Only another rule can turn the switch off.
Thanks
You can just create a rule to turn the switch on with no trigger in the rule. Add this rule tile to the dashboard. So every time you tap this tile, it will send switch-on command and not toggle.
Perfect. I’ll give this a go as a way to fix the issue I have with my security buttons. Thanks!
Just to clarify, adding the Rule tile lets you set up a one-way control, but the Rule tile doesn’t display state.
It would get a bit convoluted, but you could setup a rule that maps the various switches into True/False variables… and all the variable tiles have the ability to use a Hyperlink action wherein you could use a special $.runRule("RULEID")
syntax.
This variable tile plus tapping to execute rule is really really powerful and fun!
In an even more convuleted way… Couldn’t you us the this/else rule tree? If switch is off turn light on, else if switch is on, turn light off?
I’m not sure I follow Alex. If you can elaborate, it might help (I’m still learning about the Rule Engine, Variables, etc).
@James and @josh I’ve implemented the basic variables for $Armed, $Away and $Stay. I’ve added Variable tiles to a dashboard, and I’ve implemented 3 rules that change the virtual switch in ST when I click a Variable tile. And it correctly allows me to turn on only one of the Variable tiles at a time - so far so good.
Now I’m trying to implement some rules to read the Virtual Switch from ST when it changes - so if I change state using Alexa or the ST app directly, my panel shows state correctly. Is there a way to trigger a rule based on any state change for a device? I’m only seeing that you can trigger based on the device changing to a specific static state - either on or off. That means I need 6 rules - two for each virtual switch.
Ideally I would be able to trigger on any state change, and read that state change directly into a variable. Not sure how I’d achieve that in the Rule Engine more efficiently.
You can add two triggers that have opposite conditions on a single rule:
Switch changes to 'on'
Switch changes and is not 'on'
This is effectively equivalent to:
Switch changes
Yes that’s what I’m currently doing. Which means I need 6 rules - two for each variable. I was wondering if there was a way to achieve a single “switch changes” rule. Sounds like the answer is no.
Nevermind. I just understood what you meant. Two triggers on a single rule. Clever. Thanks.
Yup. You got it. I edited the post to clarify.
So - my “one way switch” works perfectly with the Rule Engine and Variable Tiles. Exactly the behavior I originally intended. Now my security functions behave as I think anyone would expect!
@Aaron_Drysdale my comment was also more of a question for James and Josh as well. To confirm my thinking matched yours. I have a rule I created for a virtual momentary button that can activate 2 of my smartthings scenes. It activates “work” first. But if work is already active then it activates “relax”.
If I understand correctly, @Aaron_Drysdale’s need is to have 3 different tiles and tapping each will set the STHM status to the specific state, and he doesn’t want the tile to toggle if accidentally tapped twice, which can lead the STHM and Virtual Switches out of sync. So that’s why he wanted to “one-way” switch.
From your screenshot, it looks like you wanted to tap one single button/tile, and toggle the execution of work/relax scenes. (Assuming each scene will reset the other virtual switch back to off, since it is not in the rule screenshot.) BTW, I also noticed you have an additional IF_Condition with no condition in the rule, which can be simplified.
Ahh gotcha!
And yes I noticed that. But it’s working so I haven’t tried messing with it