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.

83 lines
2.9 KiB

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