How ESPHome knows the Home assistant IP?

Hi ,
I have home assistant installed on Docker and ESPhome installed on docker. I compiled successfully several standalone projects with Tasmota and ESPHome and i see the results of the sensors readings in MQTT and Web. I want to integrate now with ESPHome with Home Assistant and use API (both ways). I really like the synergy between both. There are several integration:

  • to send sensor readings from ESPHome directly to Home Assistant using the API
  • to read sensor value from Home Assistant and use it in ESPHome
  • to synchronize ESPHome time from Home assistant instead NTP server
    To set this I usually see the following setting:
- platform: homeassistant

Can you please help me to undestand, how to point ESPHome to the correct IP address of my Home Assistant installation. I have not seen a setting for this? Is ESPHome somehow auto-discovering Home Assistant and what will happens if I have 2 instances of HA in my subnet ?
Thanks !

If you have 2 instances of ha the esphome device will be detected by both, although you don’t have to add it to both.

The setting is api:

You do not configure the IP in the ESPHome node. It works the other way around: Home Assistant connects to the ESPHome device and using that connection communction in both ways is possible.

If you have multiple HAs you can only connect to one HA. (if you need the values in both home assistants you will have use MQTT (you can use MQTT and native API together).

That is not true.

Many Thanks for the answers !