Virtual Switch in Rule

If I have a rule that is triggered if a virtual switch changes to off, but I have one or more routines that turn the switch off, and one of those routines runs when the switch is already off, will the rule run? I wouldn’t think so because the switch hasn’t changed off. Instead, it was already off. Off. I’ve been testing this. But it’s not always consistent. Although that could be my lousy Wi-Fi the last couple of days more than anything else. :slight_smile:

@Richard_Belthoff, the rule and the routine runs independently. In your rule for example, if the virtual switch is changed to off, then the rule will be triggered due to this switch off event, unless you have IF condition(s) in the flow to further decide if the action(s) should be taken (rule is still considered as "triggered’, but may not do anything depending on the logic.)

If you can post screenshots of your rule and routines I may be able to better understand the setup and why it wasn’t consistent.

1 Like

Rule is as simple as if the virtual switch changes to off turn off alarm. Inconsistency might just be from my over testing it. I’m really just wondering what the “changed to off” means with the IF statement and a virtual switch. If it’s already off, an automation that runs when someone arrives, for example, and the automation “turns off” the virtual switch should not trigger the rule, right, cause the virtual switch was already off and it didn’t “change to off”? Thanks.

It actually depends on the device driver how it handles this situation. In this particular scenario, the Virtual Switch will still send out an “switch-off” event event though it is already in the “off” state, and therefore the rule will be triggered.

1 Like

By the way, this thread over on SmartThings is why I’m asking: https://bit.ly/2K4ru8h. The updated DTH doesn’t seem to work any longer with checking whether the alarm is already on or off in a SharpTools Rule. I used this before to see if the alarm is already off. If it is, I ended the rule to avoid the alarm announcing again that it’s off. I’m now doing this with the virtual switch instead. Although I need to look into this further because a Tasker profile just worked that still checks the status of the alarm. Weird. It might be a polling issue or a status reporting issue. I’ll keep experimenting. I still would like to know, though, if running an automation that turns off the switch that is already off will trigger the rule. Thanks.

Missed this while I was typing my reply. That’s what I am afraid off. Thanks.

1 Like