This is a nice hack, but I'm always very wary of playing with large voltages because it's too easy for things to go wrong. Instead, for controlling mains devices, I recommend a Sonoff S20: https://esphome.io/devices/sonoff_s20.html I usually flash ESPurna onto it (Tasmota and ESPhome are also good choices), it's very easy to do and it's extremely reliable and hopefully has a lower chance of fire than anything I'd mak…
It's when you get above 400V+, then the physics of electricity gets tricky.