Multi gang Zigbee switch driver help

Hey, I want to write a driver for wired TuYa 3 gang switch and I'm not sure how to approach this.

I saw @markus creating the Virtual devices in his Generic Switch driver but do I understand correctly that each of these child devices has own endpoint (parsed from the device event) and the parent device is just sending events to the correct child?

My confusion is that at some point I have to actually build the command to the device, but when the parent device is handled by my own driver and child devices (relays) are generic switches how do I do that?

Or do I need to even bother what the child device is? Isn't it just acting as a state holder?

I'll be very grateful for any guidance!

In general switch devices with multiple relays have multiple endpoints. I usually link the EP by making it part of the child device ID, that way when I get the call from the child device it's easy to keep track of which EP it's for. It also make it easy to know which child to send status updates to.

Thanks for the explanation! But what's the exact role of the Child device?

It contains the state and also is what controls each individual EP.