Two Switches in one Toggle on Android widget

I’m seeing this question everywhere on the internet, yet they all show YAML configs to solve this. But I’d like to have this on an Android action widget (in my case, switch both relays of a Shelly with one widget) and I haven’t seen this in the threads I found.

Just use a helper and an automation. Then point your widget to the helper.

Okay so the website prevents me from posting pictures but I made an “Input button” helper" and an “Automation”, and I can add the button as an Android widget. Works great.

The only problem is that I don’t see the current state of the lights (On or Off). I suppose I need something more complex like a “Combine the state of several sensors”.
Optionally I would also rather it turns it all to “On” if one of the lights is already On for some reason, and only turn all Off if they are all On. Where could I go to write code that does this, and link it to a helper button ?

Also, the widget often “crashes” (as in, I tap it and the lights switch, but it doesn’t refresh itself and I can’t tap it anymore).

Edit : Managed to do it with a Building Block of Choose ! Now I just need a way of displaying the state on the input button.

You need to.set a group helper. It will then show as on or off, you wont need an automation then.