Virtual Switch Rule Triggering Sporadically

I created a virtual switch called PS4 to expose to Alexa to allow me to turn my Roku TV on, switch inputs, and set volume using Roku Connect.

I have the virtual switch set to be turned on by Alexa via a routine and the Hubitat rule turns the switch back off at the end.

I say “Alexa, turn on PlayStation”, and she dings as if she’s complied, but nothing happens. It may take 1 or 2 more times before all the actions in my rule execute without issue.

It doesn’t seem like an Alexa problem, because all of my other routines involving Hubitat devices respond promptly the first time. So I feel like it has to be an issue with either my virtual switch or my rule. Any ideas what could be the problem or ideas for how to troubleshoot?

I don’t see any issue with the rule as written. It seems to match with what you are describing.

I would recommend that you turn on logging on the device and the rule. This will allow you to confirm that the switch turns on when you expect it to. It would also allow you to confirm that the rule runs as expected.

I turned on all logging and went to the rule events to see what happened.

It says “Virtual Switch - PS4 on” but nothing happened. Is there a way I can dive in deeper to why the rule seems to trigger but not do anything?

What happens if you hit Run Actions?
Is the rule paused?

Recorded 4 attempts in the logs. 2 of them worked (2nd and 4th try). 2 of them didn’t. They look the same in the logs.

I tried Run Actions, and it kind of did the same thing. Didn’t work a few times, and then worked.

Maybe it’s an issue with the reliability of Roku Connect.

That sounds like a possibility. I am not familiar with that integration, but if it has a community page, you might want to see if others have had similar issues. You could also ask the question there.

Does Rule Machine execute each step regardless of a failure to execute one of the steps? I suppose I could remove the step that turns the virtual switch off, and check if the switch is turned on after issuing the command? I think if I do that, I could tell if the actions are being executed.

Yes, unless it “crashes”. If that occurs, there will be an error in the log.

I looked again at your screenshot above and this is the event log for the switch. There is also a log screen that can be accessed with he “hamburger” drop-down on the top left. You will get more information from there.