Driven by the lazy to turn off the lights when in bed, an attempt was made to upgrade the existing lighting fixtures to be intelligent. Choose ESP8685-WROOM-3 (i.e., ESP32-C3), the smallest vertically mounted ESP32 module, was selected. The power supply section uses an LS05-13B05R3 flyback module.
The final power consumption is 0.8W when off and 1.9W when on. It is worth noting that, to ensure interoperability with traditional switches, the relays are configured to be in the default on state. This results in the system activating the relays approximately 400ms after power-on, but still exhibits a significant delay. Furthermore, the overall capacitance is too large, and the power-off hold time is too long, causing the fast-switch to fail to reset and turn on the lights properly when the module is in a remote off state. Therefore, in future versions, it is necessary to reduce the output capacitance and also ensure that the relay control logic is in the on state by default to minimize power-on delay. (Bluetooth relay is also enabled in the configuration file because the installation location of the ceiling light is indeed suitable for collecting Bluetooth sensor messages.) The circuit meets EN55032 CLASS B and IEC/EN61000-4-2 Contact ±6KV / Air ±8KV ESD, IEC/EN61000-4-5 line to line ±2KV.

Here’s the configuration yaml of ESPHome:
1 | substitutions: |