I tried that but the behaviour is different from the card switch: it toggles each light individually and not as a group.
I resolved the problem some time ago by writing a script that counts the lights on and off and makes a decision to switch on our of all the entities - but was wondering if there is a simpler way.