It’s a whole new rabbit hole of home automation. The basis is a server running on a Raspberry Pi. My home is automated in so many places using home assistant automations.

That said, have a look at what Shelley offers as you can have a cover switch drive a light.

https://www.shelly.com/en-us/product.../shelly-uni-us