Having trouble with virtual switches and locks

I have a virtual switch, Door Unlock Switch.

I have a rule to unlock all the doors when it is turned on, and turn it off.

I turn the switch on using the device page. No switch on and off events get generated and no lock events are generated. I am looking on both the device event pages and the log. The locks are still locked.

I can unlock each individual lock on the device pages, but they still show as locked even though I checked all of them out and they are unlocked. Also there are no unlock events generated on the device event pages. There are unlock events in the log:



Everything seemed OK until I created new door lock/unlock rules in Rule Machine on Sunday.

Any suggestions? I've rebooted the hub, shut down the hub and powered it back up, and done a z-wave repair. A lot of the battery operate devices show "dead", but usually those eventually catch up after a reboot and repair. I can try to remove the lock rules and try again.

I ran into a somewhat similar situation when using virtual switches to change colors of a bulb through Alexa. I found the virtual switch was turning off before the other action in my rule was executing. A half second delayed off solved my issues. Just an idea...

2 Likes

Yes, it's likely the timing. My virtual switches all use a 1 second delay or longer, depending on the scenario, before turning off.

1 Like

Thanks @bjcowles and @SmartHomePrimer, I will try adding a delay before turning off the virtual switch.

But I would like to try to understand why that would be a problem. Is the switch turning off quickly after it has been turned on the issue? Or does the switch turning off and then all the locks being unlocked quickly in succession cause timing issues (and why would that be)? And why do the locks not show their events on the device event page?

Inquiring minds want to know :wink: .

Likely you're not getting an event log because there is no chance for there to be an unlock event. The rule truth (the switch) is telling itself to become false, before it has a chance to act on the other actions.

1 Like

OK, that makes sense...I assumed all actions for the rule would complete.

That explains why I didn't get device events when I flipped the virtual switch, but doesn't explain why I didn't get device events when I went to each lock device page and unlocked there. It's like the whole event mechanism is getting thrown off because that rule didn't complete. I'll have to experiment some more tonight...

Everybody talks about WAF, but I'm going through HAF right now :wink: .

1 Like