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.

86 lines
3.1 KiB

  1. < [Flashing guide](flashing.md) | [Index](../README.md) | [Sponsoring](sponsoring.md) >
  2. # Known issues
  3. ## The device keeps losing its connection to Home Assistant
  4. Disconnects are annoying, but even more annoying is that sometimes the
  5. lamp will reboot (during which the light will be turned off) as a result of
  6. these disconnects. The reasons for these reboots are very likely in the
  7. underlying libraries, and I'm working on tracking these down.
  8. In the meanwhile, there are a few factors that you can look at to bring down
  9. the number of disconnects:
  10. * A bug in the AsyncTCP library
  11. * The number of connected API clients
  12. * The logging output level
  13. **A bug in the AsyncTCP library**
  14. You might be running into a problem in the upstream library "AsyncTCP".
  15. If you connect a serial console to your lamp and see "ack timeout 4"
  16. messages in the logging output before the lamp disconnects the API client,
  17. then you can be pretty sure that this is the culprit.
  18. I did identify the underlying issue and a pull request for a fix was
  19. accepted and merged into the ESPHome fork of the library:
  20. https://github.com/OttoWinter/AsyncTCP/pull/4
  21. This fix will likely be available in the next release of ESPHome
  22. (the current version at the time of writing is 1.16.2).
  23. If you want to try out this fix on beforehand, then create a `libs` folder
  24. in the folder where your device's yaml configuration file is stored (e.g.
  25. when using the Home Assistant plugin: `/config/esphome/libs/`).
  26. Then clone the following repository into that folder:
  27. https://github.com/mmakaay/AsyncTCP
  28. For example on the command line:
  29. ```
  30. # cd /config/esphome
  31. # mkdir libs
  32. # cd libs
  33. # git clone https://github.com/mmakaay/AsyncTCP
  34. ```
  35. Then add a pointer to this folder from within your device's yaml
  36. configuration file, using the `lib_extra_dirs` option. Provide it with the
  37. absolute path to your `libs` folder. The relevant part of the config change
  38. looks like this (matching the example from above):
  39. ```yaml
  40. esphome:
  41. platformio_options:
  42. lib_extra_dirs: /config/esphome/libs
  43. ```
  44. This way, the repository version of the library will override the version of
  45. the library that is bundled with ESPHome. Build the device firmware and
  46. flash the device like you would normally do.
  47. **The number of connected API clients**
  48. Another factor on the connection stability, seems to be the number of
  49. clients that are connected to the API. When connecting a log client via the
  50. API (e.g. when looking at the logging from within the web dashboard), while
  51. Home Assistant is also connected, disconnects might occur.
  52. When the lamp is in production, this is not an issue. Then only Home
  53. Assistant is connected.
  54. **The logging output level**
  55. I have seen an increase in disconnects while the log level was set to
  56. `VERY_VERBOSE`. The logging code might take up so much time, that it
  57. interferes with the operation of the networking code. Especially since the
  58. ESP32-WROOM-32D chip that is used in the lamp is a single core version of
  59. the ESP32.
  60. For this reason, I advise to completely omit logging or use a very low log
  61. level for production purposes.
  62. < [Flashing guide](flashing.md) | [Index](../README.md) | [Sponsoring](sponsoring.md) >