HomeAssistant is the answer.
Or if you want a simple & cheap off the shelf solution, IKEA stuff has being online as an option, not a requirement, and all the devices are ZigBee or matter compatible and not locked to some proprietary WiFi cloud bullshit.