What the top level comment is asking for, completely unrelated to the article mind you, is to have a smart device in the form factor of a light switch that you can hook into your home assistant system.
The problem they likely have (I have it too) is that you set HA up and it can control smart plugs, smart thermostats, etc, but it can't control 99% of the existing lights in your house because they are wired to dumb lightswitches. Instead of some mechanical finger flicking a switch or something, why not uninstall the existing light switch and replace it with a smart one.
I think the problem with this setup is that it needs to be wifi connected, and if you embed an esp32 inside a wall it will get exactly zero signal. Maybe with external antennas hidden in the switch outer case.