You don’t have to use Core/WebCore to do this. You could create a virtual switch:
and then use the Mirror Behaviour feature in Smart Lighting to keep them in sync.