The Shelly 1 is a wifi relay, on the electrical side it is exactly a BDR91 with a dry-contact that can be switched. Maybe the way to implement something like this might be to send an event from the custom component. In that way a user can use the event to trigger an automation that toggles the state of the device (in my case a Shelly 1, but for others maybe a Zigbee based relay).