Files
libretiny/docs/projects/esphome.md
2022-07-31 13:05:24 +02:00

1.7 KiB

ESPHome

!!! note Read Getting started first.

Because ESPHome does not natively support running on non-ESP chips, you need to use a fork of the project.

Assuming you have PlatformIO, git and Python installed:

  1. Open a terminal/cmd.exe, create esphome directory and cd into it.
  2. git clone https://github.com/kuba2k2/libretuya-esphome -b platform/libretuya (you need the platform/libretuya branch)
  3. Go to Boards & CPU list, click on your board and remember your board code.
  4. Create a YAML config file for your device. You can either:
    • use python -m esphome wizard yourdevice.yml - type answers to the six questions the wizard asks
    • if your board isn't available in the wizard yet, use the manual YAML method below
    • write a config file manually:
      esphome:
        name: yourdevice
      
      libretuya:
        board: wr3  # THIS IS YOUR BOARD CODE
        framework:
        	version: latest
      
      logger:
      api:
        password: ""
      ota:
        password: ""
      
      wifi:
        ssid: "YourWiFiSSID"
        password: "SecretPa$$w0rd"
        ap:
          ssid: "Yourdevice Fallback Hotspot"
          password: "Dv2hZMGZRUvy"
      
  5. Compile and upload ESPHome:
    • python -m esphome compile yourdevice.yml - this will only compile the code
    • python -m esphome upload yourdevice.yml - this will upload the previously compiled code
    • python -m esphome run yourdevice.yml - this will compile and upload the code

!!! info If you want to flash manually:

The binary file, ready for uploading, will be in `.esphome/build/yourdevice/.pioenvs/yourdevice/`.

Refer to your board README to find appropriate flashing instructions.