ESPHome Native API: configurable connection timeout/keepalive

Expose configuration parameters for the native API to allow adjustment to one or more of:

  • connection timeout
  • keepalive timeout
  • message retries

Rationale:
Being able to tune the API’s tolerance for less-than-ideal network conditions would permit users to retain the advantages of Native API (even at the cost of a few retry-delays) rather than having to fall back to MQTT’s TCP transport-layer link.
There have been several esphome cases in this forum where ESPHome’s link to HA is being lost and reconnects forced due to issues caused by, e.g., lost packets, latency, that may be beyond the control of the user.

I have a EspHome in my roof so sometimes lose the conection about few seconds (nothing important) but I get changes of states (from off to unavailable and unavailable to off again…), so, I a configurable timeout will be very interesting.