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.

124 lines
4.0 KiB

3 years ago
  1. # esphome-yeelight_bs2
  2. ## Warning: this code is still under heavy development
  3. This code is not yet production-ready. Most of the work goes into reverse
  4. engineering the original firmware and coming up with ways to re-implement
  5. a device firmware based on ESPHome.
  6. Till now, the main focus was driving the LED circuitry, to make sure that the
  7. light quality meets that of the original firmware. This was a hard nut to
  8. crack, but I am happy to announce that this code has been completed.
  9. Therefore I will now continue on implementing the front panel buttons.
  10. The hard work for this was already done: reverse engineering the protocol
  11. that is used to talk to the main board. Therefore, finishing up the
  12. firmware should not take much time from here on.
  13. Once the front panel is working, we can move towards a stable release of the
  14. firmware. I have some more ideas to work on, but those can and will be
  15. extensions to a finalized first stable release.
  16. ## Is it safe to install this firmware on my device?
  17. As long as you keep a backup of the original Yeelight firmware, this is
  18. quite safe :-)
  19. I have two lamps that both are running the latest development firmware and
  20. they are functioning very well as far as the light feature is concerned.
  21. I sometimes see API disconnection issues, but those can all be traced back
  22. to the underlying frameworks. For the most prevalent issue, I did some
  23. debugging and wrote a fix (it is mentioned below).
  24. For each commit of the code, I will do my best to commit it in a working
  25. state. Once a first completed stable release is cooked up, I will tag
  26. production releases of the code to make it easier to pick the safe version
  27. for production purposes.
  28. ## Installation
  29. Create a folder named `custom_components` in the folder where your device's
  30. yaml configuration file is stored. Then clone the the Github repo into a
  31. subfolder `yeelight_bs2`. For example on the command line:
  32. ```
  33. # mkdir custom_components
  34. # cd custom_components
  35. # git clone https://github.com/mmakaay/esphome-yeelight_bs2 yeelight_bs2
  36. ```
  37. Your folder structure should now look like:
  38. ```
  39. config
  40. ├── yourdevice.yaml
  41. ├── custom_components/
  42. │ ├── yeelight_bs2/
  43. │ . ├── README.md
  44. . . ├── yeelight_bs2_light_output.h
  45. . . .
  46. ```
  47. Then add the required configuration to your device's yaml configuration file.
  48. For an example file, take a look at [doc/example.yaml](doc/example.yaml) in
  49. this repository.
  50. On a Rapsbery Pi with HomeAssistant and ESPHome as a plugin, the directory
  51. should be:
  52. /config/esphome/custom_components/yeelight_bs2/
  53. ```
  54. config
  55. ├── epshome
  56. │ ├── yourdevice.yaml
  57. │ ├── custom_components/
  58. | . ├── yeelight_bs2/
  59. │ . . ├── README.md
  60. . . . ├── yeelight_bs2_light_output.h
  61. . . . .
  62. ```
  63. See [doc/FLASHING.md](doc/FLASHING.md) for hints for opening up the device and
  64. flashing its firmware.
  65. ## Issue: the device keeps losing its connection to Home Assistant
  66. This is not a problem with the device or the custom firmware, but a problem
  67. in the upstream library "AsyncTCP". I did identify the issue and have a
  68. proposed fix for it. The issue was reported at:
  69. https://github.com/me-no-dev/AsyncTCP/issues/116
  70. If you want to try out this change, then create a `libs` folder in the
  71. folder where your device's yaml configuration file is stored, and clone the
  72. following repository into that folder:
  73. https://github.com/mmakaay/AsyncTCP
  74. For example on the command line:
  75. ```
  76. # mkdir libs
  77. # cd libs
  78. # git clone://github.com/mmakaay/AsyncTCP
  79. ```
  80. Then add a pointer to this folder from within your device's yaml
  81. configuration file, using the `lib_extra_dirs` option. Provide it with the
  82. absolute path to your `libs` folder. The relevant part of the config change
  83. looks like this:
  84. ```yaml
  85. esphome:
  86. platformio_options:
  87. lib_extra_dirs: /config/libs
  88. ```
  89. This way, the repository version of the library will override the version of
  90. the library that is bundled with ESPHome. Build the device firmware and
  91. flash the device like you would normally do.