Hi all! I would appreciate some of your advice on how best to handle some logic that involves rules that have triggers that are also changed by rules.
Specifically for me, I'm trying to sync some modes/scenes between HomeKit and Radio Ra2. I'm using a Virtual Switch, which has to work as a trigger both ways - i.e. if a scene is turned on in HomeKit, it turns on the Virtual Switch, which will then trigger a rule in Hubitat to turn on other devices on the Hubitat side (and press some buttons on Ra2 Keypads, etc.). On the flip side, if a button from a RA2 keypad is pressed, this has to turn on the same Virtual Switch so that anything on the HomeKit side can also run.
I'm new to Rule Machine, so I'm trying to figure out how to handle this virtual switch that can be used as the TRIGGER for a rule, but also needs to be turned ON by some other rule, which then causes a feedback loop.
Example: Someone in our house uses their phone or Siri to turn on "Home" setting. This turns on a virtual switch called "(VS) Home". In Hubitat, I have a rule (1) that uses that "(VS) Home" as a trigger, which then calls a "Home" rule (2) that sets the lights, presses some buttons on the Ra2 Main Repeater, changes the mode to Not Away, etc.
However, I also have some keypads on the RA2 side that are also triggers for a separate rule (3) that will call the "Home" (2) rule, as well as turn on the "(VS) Home" switch, so that HomeKit is synced, However, this press will ALSO call the first rule (1), causing the (2) rule to run twice.
Would love some thoughts on some techniques on how to handle this kind of logic. I hope I've explained it clearly - if I haven't please ask, and I'll try to clarify. I'm SURE there are simpler ways of doing or thinking about this, and/or better tools that I should be using to sync these mode/scenes.
And on a grander scheme, I would love to know your other techniques for those of you syncing HomeKit and Hubitat/Ra2.
Thanks so much in advance.