You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.5 KiB

3 years ago
  1. # esphome-yeelight_bs2
  2. ## Warning: this code is still under development
  3. This code might not yet be production-ready.
  4. At this point, I would call it alpha-quality. Mainly in the sense that the
  5. interfaces that have been implemented so far might still change.
  6. The new firmware is currently being tested and depending on the actual
  7. use cases and issues that we might run into, breaking changes could still
  8. be done at some point.
  9. ## Is it safe to install this firmware on my device?
  10. As long as you keep a backup of the original Yeelight firmware, this is
  11. quite safe :-)
  12. I have two lamps that both are running the latest development firmware and
  13. they are functioning very well.
  14. I sometimes see API disconnection issues, but those can all be traced back
  15. to the underlying frameworks. For the most prevalent issue, I did some
  16. debugging and wrote a fix (it is mentioned below).
  17. For each commit of the code, I will do my best to commit it in a working
  18. state. Once a first completed stable release is cooked up, I will tag
  19. production releases of the code to make it easier to pick the safe version
  20. for production purposes.
  21. ## Installation
  22. Create a folder named `custom_components` in the folder where your device's
  23. yaml configuration file is stored. Then clone the the Github repo into a
  24. subfolder `yeelight_bs2`. For example on the command line:
  25. ```
  26. # mkdir custom_components
  27. # cd custom_components
  28. # git clone https://github.com/mmakaay/esphome-yeelight_bs2 yeelight_bs2
  29. ```
  30. Your folder structure should now look like:
  31. ```
  32. config
  33. ├── yourdevice.yaml
  34. ├── custom_components/
  35. │ ├── yeelight_bs2/
  36. │ . ├── README.md
  37. . . ├── yeelight_bs2_light_output.h
  38. . . .
  39. ```
  40. Then add the required configuration to your device's yaml configuration file.
  41. For an example file, take a look at [doc/example.yaml](doc/example.yaml) in
  42. this repository.
  43. On a Rapsbery Pi with HomeAssistant and ESPHome as a plugin, the directory
  44. should be:
  45. /config/esphome/custom_components/yeelight_bs2/
  46. ```
  47. config
  48. ├── epshome
  49. │ ├── yourdevice.yaml
  50. │ ├── custom_components/
  51. | . ├── yeelight_bs2/
  52. │ . . ├── README.md
  53. . . . ├── yeelight_bs2_light_output.h
  54. . . . .
  55. ```
  56. See [doc/FLASHING.md](doc/FLASHING.md) for hints for opening up the device and
  57. flashing its firmware.
  58. ## Issue: the device keeps losing its connection to Home Assistant
  59. This is not a problem with the device or the custom firmware, but a problem
  60. in the upstream library "AsyncTCP". I did identify an issue and my pull
  61. request for a fix was accepted and merged:
  62. https://github.com/OttoWinter/AsyncTCP/pull/4
  63. If you want to try out this fix, straight from my repository, lhen create a
  64. `libs` folder in the folder where your device's yaml configuration file is
  65. stored, and clone the following repository into that folder:
  66. https://github.com/mmakaay/AsyncTCP
  67. For example on the command line:
  68. ```
  69. # mkdir libs
  70. # cd libs
  71. # git clone://github.com/mmakaay/AsyncTCP
  72. ```
  73. Then add a pointer to this folder from within your device's yaml
  74. configuration file, using the `lib_extra_dirs` option. Provide it with the
  75. absolute path to your `libs` folder. The relevant part of the config change
  76. looks like this:
  77. ```yaml
  78. esphome:
  79. platformio_options:
  80. lib_extra_dirs: /config/libs
  81. ```
  82. This way, the repository version of the library will override the version of
  83. the library that is bundled with ESPHome. Build the device firmware and
  84. flash the device like you would normally do.