How Can I Understand ESPHome Native API

Couldn’t find a really nice diagram but found this.

1 Like

Hi, thanks for the illustration. Btw, do you have to enter the encryption key when you add a device in ESPHome integration? I tried to delete all of my devices and add them back, but it never prompted me for the key.

To make things more confuse: Actually the esphome nodes are hosting the api server and HA connects to as a client. The dashboard (add on) also connects to the esphome node to show logs for example :page_facing_up:

1 Like

UchihaYuki, to clarify why you don’t have to paste the encryption key: pasting the encryption key was depreciated in Home Assistant 2023.2 when a method was added for the add-on to pass the encryption key automatically to Home Assistant. See this announcement 2023.2: How can I Assist? - Home Assistant (home-assistant.io)

Yeah it’s a common misconception that it is the other way around. The HA integration is not the server.

I think this has caused a few issues with what ESPHome can do as well. I can’t remember exactly what it was but the devs have said it would be better the other way around. Too late now though.

Thank you. You cleared the last puzzle for me!

1 Like

It’s clear if you read the docs:

The ESPHome native API is used to communicate with clients directly, with a highly-optimized network protocol.

  • port (Optional, int): The port to run the API Server on. Defaults to 6053.

ESPHome device runs the server on port 6053 and the clients (i.e. HA) connect to the port.