I had defined a virtual switch and for some reason, I can't trigger any rule out of this switch turning on or off. I checked the events of the rule, which are empty. I deleted and recreated 4.0 rules, restarted the hub. Nothing.
Other rules that trigger from physical devices or other types of triggers work as expected.
Did anybody hit such an issue or can quickly try it?
I am running v126.96.36.199.
I write and test lots of rules for people using virtual switches and have not encountered this problem. Some questions that may help figure this out:
- What driver are you using for the virtual switch? (i.e., what is the name, and is it built-in or custom?)
2)Does it show "switch" (on/off) events if you click the "Events" button on the device page to see its history? (Keep in mind that this table does not update in real-time, so refresh it if you make changes. The "Current States" area on the device page should update in real time, but the "Events" page lets you see things that for-sure generated an event--changes should, but again...)
- Can you share a screenshot of (or type out) your rule?
- Were you sure to hit either "Done" or "Update Rule" (basically the same; the latter just doesn't close the page) if you modified any triggers since creating/installing the rule? Or maybe just try it for fun anyway.
- If all else looks good: turn on trigger, action, and event logging for the rule. See if anything happens when you try to trigger the rule via the switch. Look for a subscription to a switch event for this device on the "App Status" (gear icon) page for this rule; if it's not there, consider hitting "Done" or "Update Rule" as above.
Finally, note that only changes to the switch state will generate an event, and you need an event to trigger the rule. Thus, if you run the
on() command while the virtual switch already reports "switch: on," for example, nothing will happen. (The "auto off" feature built into the virtual switch driver is an easy way around this if you want to be able to turn on a virtual switch at any time to trigger a rule and don't really care about the underlying switch state otherwise.)
Thanks for the suggestions!
I turned on the logs and indeed found the problem.
With the action, not with the trigger.
It seems like if the action of the rule fails for some reason, then the event is not even recorded for the rule. It would be cool to have it recorded with some failure reason.
In my case, it seems that my Ecobee authorization expired, so the attempt to turn on/off the thermostat was failing...
I will recover my Ecobee integration and hopefully, the rules will start working again.
Thanks again for the elaborate suggestions!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.