I think you’re underestimating the computing power of these devices. If it has WiFi, it has an operating system.
You’re looking for something like ESPhome maybe. It’s a project from the same people that do home assistant. There’s a web server (and/or local API) available that allows you to toggle outputs locally, your browser directly to the microcontroller.