diff --git a/README.md b/README.md index 2e3fced..c34dae7 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,30 @@ config │ ├── yeelight_bs2/ │ . ├── README.md . . ├── yeelight_bs2_light_output.h -. . - . +. . . ``` Then add the required configuration to your device's yaml configuration file. For an example file, take a look at `doc/example.yaml` in this repository. +On a Rapsbery Pi with HomeAssistant and ESPHome as a plugin, the directory should be: + + +/config/esphome/custom_components/yeelight_bs2/ + +``` +config +├── epshome +│ ├── yourdevice.yaml +│ ├── custom_components/ +| . ├── yeelight_bs2/ +│ . . ├── README.md +. . . ├── yeelight_bs2_light_output.h +. . . . +``` + +See [doc/FLASHING.md](doc/FLASHING.md) for hints for opening and flashing the light. + ## Issue: the device keeps losing its connection to Home Assistant This is not a problem with the device or the custom firmware, but a problem @@ -39,7 +56,7 @@ If you want to try out this change, then create a `libs` folder in the folder where your device's yaml configuration file is stored, and clone the following repository into that folder: - https://github.com/mmakaay/AsyncTCP + https://github.com/mmakaay/AsyncTCP For example on the command line: diff --git a/doc/FLASHING.md b/doc/FLASHING.md new file mode 100644 index 0000000..6cf241f --- /dev/null +++ b/doc/FLASHING.md @@ -0,0 +1,90 @@ + +# Flahsing Bedlight + +## Tools needed + +* imbus or torx screw driver (3mm?) +* Soldering Iron +* pehabs some Sticky tape +* a serial to USB adapter with 3,3 Volt output +* Some wires + +## Warning + +We have writen this instructions with care, but we will gave absoultly no warnenty. Perhabs you will destroy your device and your computer. + + +## Opening the yeelight + +Remove the rubber on the botton of the bottom of the light. + +Unbolt the 4 Screws which was hidden by the rubber. + ![Photo of the screws](Yeelight_screws.jpg "You will need an imbus or torx screw driver to remove the screws.") + +Remove the plastic. + +## Solder the wires + +Solder the wires to the points of this picture. + ![Soldering points of a yeelight](https://community-assets.home-assistant.io/optimized/3X/1/3/1340a2367e5894281ac6d042f328d9db80ae7da4_2_790x750.jpeg) + + You can use stick tape to fix the cables before soldering. + +## Connect to your flashing device +Make sure that your that your flashing device is given 3.3 Volt between GND and VCC. If not you can use the regular power adapter instead. + + | Soldering point| Serial USB Adapter name | + | -------------- |:------------------------:| + | Gnd | Gnd | + | TX | RX | + | RX | TX | + | GPIO0 | Gnd | + | 3.3 V | VCC or regular power adapter| + +Connect all wires execpt VCC or Power Adapter, then plugin the power in the last step. + +## Download and install esptool + +See: https://github.com/espressif/esptool/blob/master/README.md#installation--dependencies + +## Make a backup of the current firmware + +``` +python esptool.py -p /dev/ttyUSB0 read_flash 0x 0x400000 original-yeelight-firmware.bin +``` + +/dev/ttyUSB0 is the port of the usb adaper on linux you will see it with `dmesg`. On Windows this is often `COM1`, `COM2` or `COM3` + +Caution: You will find WLAN SSID and Password of the lasted used Wifi in this file + +**After each step with esptool, you have to unplug you power line and connect it again.** + +## Flash new firmware + +Setup a ESPHome Project, see [README.md](../README.md) + +Now you can flash the device directly with esphome or by esptool. + +If you want to flash with esptool, compile with esphome and download it. + +``` +python.exe .\esptool.py --chip esp32 --port COM3 --baud 115200 write_flash 0x1000 +``` + +One your firmware is flashed, you can flash more OTA via ESPHOME. +## Troubleshooting flash + +If you have **A fatal error occurred: MD5 of file does not match data in flash!** +you can try to use the regular power adapter instead of the vcc line. + + +After this error, user @tabacha successfully flashed esp with tasmota bootloader with the regular power adapter and the following command: + +``` +python esptool.py --chip esp32 -p /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 bootloader_dout_40m.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 ~/Downloads/schlafzimmerbedlight.bin +``` + +You will find the missing tasmota boot files here: https://github.com/arendst/Tasmota/tree/firmware/firmware/tasmota32/ESP32_needed_files + +User @tabacha was not able to use tasmota with the beedlight. + diff --git a/doc/Yeelight_screws.jpg b/doc/Yeelight_screws.jpg new file mode 100644 index 0000000..6fff18d Binary files /dev/null and b/doc/Yeelight_screws.jpg differ diff --git a/doc/example.yaml b/doc/example.yaml index 92f253e..dbe51ca 100644 --- a/doc/example.yaml +++ b/doc/example.yaml @@ -5,6 +5,15 @@ substitutions: # Use your own preferences for these components. wifi: + #ssid: "Your-SSID" + #password: "Your-Password" + #use_address: 192.168.10.12 + # + # Enable fallback hotspot (captive portal) in case wifi connection fails + #ap: + # ssid: "Bedside_lamp_$name" + # password: "bedside2021" + captive_portal: api: ota: