Here’s my work towards an Accessory Switch device type, maybe it could be of some help: https://gist.github.com/mckeed/182cc9689299e20af17b
It’s set up to allow either entering the device id of the target switch in the device preferences, or you could make a companion SmartApp that lets you select the accessory and target switch and just calls accessory.associate(target)
.
I’ve just been too super busy to test this and finish up proper support for these, sorry.