This sounds like a job for @bob_dickenson’s Proxy Design Pattern discussed here.
You create a Proxy Item that you put on your sitemap to represent the state of the switch. Then you create rules that trigger on the Proxy Item and relays state changes to your CORelay. You set up other rules to receive state changes from the relay and postUpdate changes back to the Proxy Item so it represents the current state.