The problem is that at boot the relay turns on then off then on again causing any connected devices to flicker.
The relay control pin is connected to GPIO0 which is needed for boot and so the initial state during boot time is unknown.
I set the GPIO0 as output and wrote 1 to the pin at the beginning of the setup().
Also according to this schematic https://github.com/IOT-MCU/ESP-01S-Rela ... 20v4.0.pdf, GPI0 is connected to a pullup resistor
Any help would be much appreciated.