Skip to content

Commit

Permalink
[docs] Use official ESPHome version, add LT dev version guide (libret…
Browse files Browse the repository at this point in the history
…iny-eu#223)

* Update ESPHome documentation

* Update note format

* Switch to https github format, give manual PR checkout instructions until a better method is found.

* Fix yaml sample spacing

* Fix indent

* Add addon migration info

* Replace spaces with tabs

---------

Co-authored-by: Kuba Szczodrzyński <[email protected]>
  • Loading branch information
Cossid and kuba2k2 authored Jan 6, 2024
1 parent 1e3a82f commit 140cf07
Showing 1 changed file with 54 additions and 25 deletions.
79 changes: 54 additions & 25 deletions docs/projects/esphome.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
!!! tip
See the [Cloudcutter video guide](https://www.youtube.com/watch?v=sSj8f-HCHQ0) for a complete tutorial on flashing with [Cloudcutter](https://github.com/tuya-cloudcutter/tuya-cloudcutter) and installing LibreTiny-ESPHome. **Includes Home Assistant Add-On setup.**

Because ESPHome does not natively support running on non-ESP chips, you need to use a fork of the project.
LibreTiny is now natively supported by ESPHome in versions 2023.9.0 and later.

There are three basic ways to install and use LibreTiny-ESPHome. You can choose the option that best suits you:
There are three basic ways to install and use ESPHome. You can choose the option that best suits you:

- ESPHome Dashboard (GUI) - for new users, might be an easy way to go; config management & compilation using web-based dashboard
- command line (CLI) - for more experienced users; compilation using CLI commands, somewhat easier to troubleshoot
- [Home Assistant Add-On](https://github.com/libretiny-eu/esphome-hass-addon/pkgs/container/libretiny-esphome-hassio) - using LibreTiny-ESPHome in Home Assistant, alongside your normal ESPHome installation - click the link for more info
- Home Assistant Add-On - using ESPHome in Home Assistant as an add-on

!!! tip
You can use LibreTiny-ESPHome for ESP32/ESP8266 compilation as well - the forked version *extends* the base, and doesn't remove any existing features. Keep in mind that you might not have latest ESPHome updates until the fork gets updated (which usually happens at most every few weeks).
!!! warning "Important"
If you have the LibreTiny-ESPHome add-on installed in Home Assistant, migrate your YAML files over to the official ESPHome add-on.

The standalone add-on is now deprecated - after migrating your configs, uninstall the old add-on.

## Find your device's board

Expand All @@ -33,8 +35,8 @@ If your board isn't listed, use one of the **Generic** boards, depending on the
version: "3"
services:
esphome:
container_name: esphome-libretiny
image: ghcr.io/libretiny-eu/libretiny-esphome-docker:latest
container_name: esphome
image: ghcr.io/esphome/esphome:latest
volumes:
- ./configs:/config:rw # (1)!
- /etc/localtime:/etc/localtime:ro
Expand All @@ -51,20 +53,15 @@ If your board isn't listed, use one of the **Generic** boards, depending on the
!!! important
Read [Getting started](../getting-started/README.md) first - most importantly, the first part about installation.

**It is very important that you have the latest version of LibreTiny installed** (not `libretiny-esphome` - this is a different thing!) **so that you don't face issues that are already resolved**.

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/libretiny-eu/libretiny-esphome`
3. `cd` into the newly created `libretiny-esphome` directory.
1. Open a terminal/cmd.exe
2. `git clone https://github.com/esphome/esphome`
3. `cd` into the newly created `esphome` directory.
4. Check if it works by typing `python -m esphome`

!!! tip
For Linux users (or if `python -m esphome` doesn't work for you):

- uninstall ESPHome first: `pip uninstall esphome`
- install the forked version: `pip install -e .`
You can alternately install ESPHome CLI using pip with `pip install esphome`

## Create your device config

Expand All @@ -74,11 +71,11 @@ If your board isn't listed, use one of the **Generic** boards, depending on the
2. Go through the wizard steps:
- `New Device`
- `Continue`
- enter name and WiFi details
- choose `LibreTiny`
- choose the board that you found before
- enter name and WiFi details (first time only)
- LibreTiny will not currently be listed as an option, choose any of the boards and you will overwrite them later
- select `Skip`
3. A new config file will be added. Press `Edit` and proceed to the next section.
4. Delete the entire generated configuration and replace it with the example configuration below or one generated by [UPK2ESPHome](https://upk.libretiny.eu/).

=== "CLI"

Expand All @@ -95,17 +92,15 @@ If your board isn't listed, use one of the **Generic** boards, depending on the
version: latest

logger:
web_server:
captive_portal:
api:
password: ""
ota:
password: ""

wifi:
ssid: "YourWiFiSSID"
password: "SecretPa$$w0rd"
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "Yourdevice Fallback Hotspot"
password: "Dv2hZMGZRUvy"
```

## Automatically generate config
Expand Down Expand Up @@ -149,6 +144,7 @@ bk72xx:
LT_UART_DEFAULT_PORT: 2
LT_UART_SILENT_ALL: 0
```
(this is only an example)
Additionally, few options have their dedicated keys:
Expand All @@ -166,4 +162,37 @@ bk72xx:
# set to false if you want to attach a debugger
gpio_recover: true
```
(these values are defaults)
## Advanced: Using development versions with ESPHome
There are a two ways to use development versions of LibreTiny with ESPHome:
- `version` is a required field, and must match a specific format, it is recommended to use `"0.0.0"` for custom development
- `source` must point to where your development version of LibreTiny resides.

=== "Git"

```yaml
bk72xx:
framework:
version: "0.0.0"
source: "https://github.com/libretiny-eu/libretiny"
```

Source can be post-fixed to checkout a specified branch or a Pull Request:

- Branch: add `#branch_name` (ex: `source: "https://github.com/libretiny-eu/libretiny#experimental_branch_name"`)
- Pull Requests: Pull requests currently require you to check out the source branch of the pull request. To get this information, visit the PR, click on the source branch, and copy their git address and apply the branch their PR uses (ex: `https://github.com/pr_user/libretiny#pr_branch`)

=== "Local"

Check out with Git (recommended) or download and extract a copy of LibreTiny to your local file system running ESPHome.

```yaml
bk72xx:
framework:
version: "0.0.0"
source: "/local_path_to_libretiny"
```

0 comments on commit 140cf07

Please sign in to comment.