In my specific instance, only 1 of the 6 devices can be turned on at a time (they are all Logitech activities and I'm using @ogiewon device driver) so that should make things easier.
The issue I have is if I program it in RM, if no activity (device) is on and I use the remote to turn on an activity, the virtual switch would turn on which would then turn on the 1 activity I had selected.
So basically, if the virtual switch is turned on via RM, I don't want it to turn on the 1 device. However, if it's turned on via any other means (Alexa, dashboard etc), then I want it to turn on the 1 device I selected.
Without that requirement, this is a hubitat Group. That is exactly what that app will do. If you add all the devices to a group, it can be set to indicate if any of the members are on and if all the members are off. Turning it off will turn off all the members. The one thing you cannot do is turn on a group device to turn on only one of the member. I don't see how you would be able to do that and your other requirements. You would have to turn on one of the 6 members.
Then you would have to write a custom app to be able to do this. If you removed that one requirement, your job would be done.
EDIT: Wait...you also want to turn off one if another turns on? That would also require custom code. This is a very, VERY complex set of requirements. Just starting to pull the threads together and I'm seeing at least 4 if not more rules would have to be written. And even then, timing is going to be very difficult.
Then I would go for it! That's what I did. I've slowly been moving anything that I want "special" like this over to custom, one-off apps. It's a lot easier to get EXACTLY what you want when you go right to the source!
Wait...there is already logic in the devices themselves? Are these part of a parent/child relationship? If so, then it might be a LOT easier. You would have to use the parent device instead of a virtual one but it makes the coding so, so, SOOO much simpler. The linkage between the devices already exists. So, half the work of writing an app is already done in the drivers.
The Harmony Hub Integration already has a child device that handles most of what you're asking for... The "PowerOff" child devices indicates "on" if all of the other Activities are "off", and vice versa.
The one thing that is missing is a Default Activity if the "PowerOff" device is turned "off" (I know, the logic is reversed because of the name of this device.)
So, perhaps a simple enhancement to the Harmony Hub Parent Device to allow the user to select a "Default Device"....
Yup, I'd want a child device that's the opposite of the power off though i.e. on when "power off" is off and vice-versa. And yup, a default activity when that child device is turned on (or "power off" is turned off like you said). That actually seems like a logical behavior for the parent device (if it was treated as a switch)
Ugh....I must need another cup of coffee. I didn't make the connection from Logitech to Harmony.
But yeah, that's much easier if there is already an established parent/child relationship between the devices since the communication between the two is built into the platform. I'm sure @ogiewon can sort you out.
Yes, this is what I was thinking as well. If I add the Switch Capability directly to the Parent device, then if any Activity is "on" the Parent Device's switch attribute will be "on" as well. If all Activities are "off", the Parent Device's switch attribute will be "off" as well.
Then, add a user preference allowing the user to select one of the Activities as the Default. If you turn on the Parent, then that Default Activity is turned on.