[![english](https://img.shields.io/badge/language-english-C1C1C1?style=for-the-badge)](README.md) [![russian](https://img.shields.io/badge/also%20available%20in-russian-blue?style=for-the-badge)](README-ru.md) # BTHome THB1, THB2, THB3, BTH01, TH05 (HW: v1.3..1.6), TH05F Custom firmware for Tuya devices based on the PHY622x2 chipset. | [THB1](https://pvvx.github.io/THB1) | [THB2](https://pvvx.github.io/THB2) | [THB3](https://pvvx.github.io/THB3) | [BTH01](https://pvvx.github.io/BTH01/) | [TH05_V1.3](https://pvvx.github.io/TH05-v1.3) | [TH05_V1.4](https://pvvx.github.io/TH-05) | [TH05F](https://pvvx.github.io/TH05F) | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| | ![THB1](https://pvvx.github.io/THB1/img/THB1.jpg) | ![THB2](https://pvvx.github.io/THB2/img/THB2.jpg) | ![THB3](https://pvvx.github.io/THB3/img/THB3.jpg) | ![BTH01](https://pvvx.github.io/BTH01/img/BTH01.jpg) | ![TH05V1.3](https://pvvx.github.io/TH05-v1.3/img/TH05-V1.3.jpg) | ![TH05V1.4](https://pvvx.github.io/TH-05/img/TH05V14.jpg) | ![TH05F](https://pvvx.github.io/TH05F/img/TH05F.jpg) This firmware works with [Home Assistant](https://www.home-assistant.io/) and other software running in the [BTHome](https://bthome.io/) format. All firmware supports any of these sensors: CHT8215 (CHT8310), CHT8305, AHT20..30. **Software for setting up and making BLE OTA: [PHY62x2BTHome.html](https://pvvx.github.io/THB2/web/PHY62x2BTHome.html).** > Uploading OTA files to [PHY62x2BTHome.html](https://pvvx.github.io/THB2/web/PHY62x2BTHome.html) is automatic. You don't need to download files from this repository for OTA. > To run [PHY62x2BTHome.html](https://pvvx.github.io/THB2/web/PHY62x2BTHome.html) offline, just copy the [html](bthome_phy6222/web/PHY62x2BTHome.html) file to a local folder. ## Getting started with the device To work with the device, you need to write the `FW Boot` firmware to the device via a USB-COM adapter. Boot firmware is a program with reduced functionality and provides secure OTA updates. Next, using the BLE connection in PHY62x2BTHome.html through the OTA tab, the main operating program of the `FW APP` is recorded. * `FW APP` can also be recorded using a USB-COM adapter. ## Boot and App firmware The [Boot](#fw-boot-and-ota) firmware has minimal functions. `FW Boot` is only used for downloading via OTA the full-featured version of `FW APP` (`.bin` files). * The device type can be distinguished externally by the smiley face symbol on the screen. | Device | Boot file | OTA file | Printed circuit board labelling | |:---:|:---:|:---:|:---:| | [THB1](https://pvvx.github.io/THB1) | BOOT_THB1_v19.hex | THB1_v19.bin | no | | [THB2](https://pvvx.github.io/THB2) | BOOT_THB2_v19.hex | THB2_v19.bin | no | | [THB3](https://pvvx.github.io/THB3) | BOOT_THB2_v19.hex | THB2_v19.bin | no | | [BTH01](https://pvvx.github.io/BTH01) | BOOT_BTH01_v19.hex | BTH01_v19.bin | no | | [TH05_V1.4](https://pvvx.github.io/TH-05) | BOOT_TH05_v19.hex | TH05_v19.bin | TH05_V1.4, TH05_V1.5, TH05_V1.6 (chip: BL55028) | | [TH05_V1.3](https://pvvx.github.io/TH05-v1.3) | BOOT_TH05D_v19.hex | TH05D_v19.bin | RSH-TH05-V1.3 (chip: BL55072) | | [TH05F](https://pvvx.github.io/TH05F) | BOOT_TH05F_v19.hex | TH05F_v19.bin | TH05Y_V1.1, TH05Y_V1.2 (chip: QD01 2332 NT) | The main firmware files, BOOT_XXX_vXX.hex (for programming via USB-COM adapter) and XXX_vXX.bin (for OTA), are located in the [bin](bin) directory. Files for updating boot via OTA are located in the [update_boot](update_boot) directory. ** > The current `FW Boot' version is **v1.9** for all devices (errors fixed). ## Internal GPIO pinout: | Device | Sensor SDA/SCL/Power | LCD SDA/SCL/Power | Key | LED | |:---:|:---:|:---:|:---:|:---:| | THB1 | P18/P20/- | P34/P33/- | P01 | - | | THB2 | P18/P20/- | - | P07 | P26 | | THB3 | P18/P20/- | P34/P33/- | P01 | - | | BTH01 | P33/P34/P00 | - | P14 | P15 | | TH05 | P34/P33/P00 | P34/P33/P02 | P14 | - | | TH05D | P31/P32/- | P11/P14/- | P02 | - | | TH05F | P33/P34/P00 | P26/P31/P02 | P14 | - | ## Main features **With default settings**: * BLE advertisement interval in [BTHome v2](https://bthome.io) format is 5 seconds. * Humidity and temperature sensor is polled every second BLE advertisement interval - period of 10 seconds. * Battery voltage measurement is done every minute. * Recording of history every 30 minutes. * The button is used for quick connection to old BT adapters. Pressing the button switches the BLE advertising interval to a shorter period (1562.5ms). The action will continue for 60 seconds, then the interval will be restored to the one set in the settings. * The measured average consumption from a 3.3V source when scanning THB2 and BTH01 thermometers in passive mode is up to 8 µA. For TH05_V1.4 the average consumption is about 23 µA ([this is the current of the installed components](https://github.com/pvvx/THB2/issues/8#issuecomment-1908982171)). Other versions with screen: 12 to 14 µA with LCD on and 7 to 12 µA with LCD off. * Connection interval with Connect Latency (900ms). * Handling of input counter contact for transmitted [Open/Close events](https://github.com/pvvx/THB2/issues/10#issuecomment-1935169274) * Processing of output contact switchable by set temperature and/or humidity with hysteresis. * Support low-cost [BLE to Zigbee advertising repeater](https://github.com/pvvx/TLB2Z) ## Version History | Version | Description | |---|--- | | 1.0 | | | 1.1 | | | 1.2 | | | 1.3 | | 1.4 | | | 1.5 | | | 1.6 |