From the ESPHome docs
You are better off using a more up-to-date version of the DFRobot code found here