然后vi编辑下面这一堆文件,如果有的话,没有就不用改。
vi /data/cache/platformio/platforms/espressif32/platform.json
vi /data/cache/platformio/packages/framework-arduinoespressif32/package.json
vi /data/cache/platformio/packages/framework-espidf/package.json
vi /data/cache/platformio/packages/tool-esp_install/package.json
vi /data/cache/platformio/packages/tool-esptoolpy/package.json
vi /data/cache/platformio/packages/toolchain-riscv32-esp/package.json
vi /data/cache/platformio/packages/toolchain-xtensa-esp-elf/package.json
vi /esphome/platformio.ini
vi /platformio.ini
sed -i.bak 's#https://github.com#https://gh-proxy.com/https://github.com#g' /data/cache/platformio/platforms/espressif32/platform.json
sed -i.bak 's#https://github.com#https://gh-proxy.com/https://github.com#g' /data/cache/platformio/packages/framework-arduinoespressif32/package.json
sed -i.bak 's#https://github.com#https://gh-proxy.com/https://github.com#g' /data/cache/platformio/packages/framework-espidf/package.json
sed -i.bak 's#https://github.com#https://gh-proxy.com/https://github.com#g' /data/cache/platformio/packages/tool-esp_install/package.json
sed -i.bak 's#https://github.com#https://gh-proxy.com/https://github.com#g' /data/cache/platformio/packages/tool-esptoolpy/package.json
sed -i.bak 's#https://github.com#https://gh-proxy.com/https://github.com#g' /data/cache/platformio/packages/toolchain-riscv32-esp/package.json
sed -i.bak 's#https://github.com#https://gh-proxy.com/https://github.com#g' /data/cache/platformio/packages/toolchain-xtensa-esp-elf/package.json
sed -i.bak 's#https://github.com#https://gh-proxy.com/https://github.com#g' /esphome/platformio.ini
sed -i.bak 's#https://github.com#https://gh-proxy.com/https://github.com#g' /platformio.ini
另外可在esphome 容器内 添加pip国内源以便加速pip依赖项。
pip3 config list
#pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/
#pip config set global.index-url https://repo.huaweicloud.com/repository/pypi/simple/
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
pip config set global.extra-index-url "https://pypi.tuna.tsinghua.edu.cn/simple/ https://mirrors.aliyun.com/pypi/simple/ https://mirrors.cloud.tencent.com/pypi/simple/ https://pypi.doubanio.com/simple/ https://repo.huaweicloud.com/repository/pypi/simple/"
pip config set install.trusted-host "mirrors.aliyun.com repo.huaweicloud.com pypi.tuna.tsinghua.edu.cn pypi.mirrors.ustc.edu.cn mirrors.cloud.tencent.com pypi.doubanio.com"