Hi Steven,
Welcome to HA!
Sadly, you have designed a flashing light that is very likely to fail badly.
At switch-on, current may flow through the “220V transformer” and the “bulb”. If we assume the “bulb” is (say) three resistive filament lamps (and not LED or CF), and assume there is enough current for the “220V transformer” to operate, when the ESP01 ESP8266 module turns the relay on, the contacts short out the “220V transformer” primary, turning off the relay, and turning on the “220V transformer” again. The ESP01 then boots, connects, turns the relay on again, and you have a oscillator.
You are likely only considering in-phase current though - if the “220V transformer” really is a wound step-down transformer, the magnetic field will collapse when the relay shorts out the primary causing a back-EMF spike which might well arc the contacts together.
Worse:
- The “220V transformer” is unlikely to be a linear power supply (transformer + rectifier + smoothing), but a complex high-frequency buck converter. These are usually capacitive loads.
- The bulb is unlikely to be a simple resistive filament, but a complex high-frequency dedicated chip. This could be a capacitive or inductive load.
Without a Neutral connection any power for the “220V transformer” has to flow through the load (bulbs). With incandescent bulbs, this wasn’t ideal, but with LEDs and their multiple boost-buck, capacitive-dropper, etc complex driver chips, the result is often unpredictable. And yes, I’ve tried “ballast” devices (usually a capacitor and bleed resistor).
Mixing complex loads together often causes flashing (as capacitors charge, inductors field collapse, or even as microprocessors brown-out). This ranges from annoying to BOOM as components overheat and fail badly.
Basically, DON’T.
Add a neutral or move the location of the module to somewhere it has one.
I’ve been installing similar automation in the UK since X10 started in the US and with very few exceptions, “No Neutral Required” means “Will Not Work Reliably”.
Further bad news is the ESP01 board you show is likely a clone-of-a-clone-of-a-clone so may be troublesome to get ESPhome working reliably. I’ve seen devices fail to flash, have only 1Mb of flash (some designs assume ESP8266 have 4Mb), or fail randomly in service. The worse boards had a second microprocessor controlling the relay via a serial interface - that is if they remembered to flash the micro (not the ESP01)!
My suggestion is buy something like a Shelly, or a Sonoff device. Several types can be flashed with ESPhome (e.g I have a Shelly running a custom towel heater), and are designed to be safe. The new Sonoff Mini4RM work well with Matter.
If this helps,
this post!