This respository includes the ESP32 scripts of the Smart Fan project.
You can found more detail here.