Two EspHome, connect one device to both

Hello. I have two EspHome devices, and I want to connect one device to both of them. How do I do this?

There are probably multiple ways to interpret those words. What do you really mean? Why do you want to do this?

Specifics matter. Which esphome devices are you talking about? Which device (do you mean sensor or something else) do you want to connect to both devices? Why do you think you need to do this?

What is the underlying problem you are trying to solve with this solution?

2 Likes

For the information you provided I can only tell that you need common GND.

Hi. I have two EspHome servers: one on a server running HomeAssistans (Fedora, installed via pip in separate environments + mqtt + emby + Wyoming-piper + ..., Wi-Fi connection), and the other on my laptop for development. I created a project on the laptop, launched it, and wondered how to connect it to the server wirelessly?

I need to import and export projects with a device attached to them

This is a much different thing than what I thought you meant.

You have one device running esphome.
You have two computers that can compile code (using esphome).
One of those two computers also runs Home Assistant.

I think what you are asking is how do you get the config (YAML) for your one device onto both computers so you can use it from either location.

I don't use the HA API so I don't know the answer to your question. But others might be able to answer this question, assuming it is the question you actually have.

A Neel mentions, "ESPHome" is often used meaning three different things, which gets very confusing:

  • The ESPHome Command Line is a Linux (or Windows, etc) program which takes a configuration .yaml file and compiles a custom firmware program designed to run on an ESP32 or other supported microcontroller
  • The ESPHome Device Builder is a Home Assistant app which adds a user-friendly interface to the ESPHome programs and makes it easy for Home Assistant to interface with ESPHome devices
  • the ESP32 (or other microcontroller) devices running the firmware created by ESPHome

That sounds like two Command Line ESPHome installs - or is the Home Assistant one using the ESPHome Device Builder integration within Home Assistant ?

Did you download and launch the project onto your ESP32 device using a USB cable, and now you want to connect to the logs over wi-fi ? If so:

  • In your device YAML did you include wi-fi settings ? You need to include a wifi: component which includes wifi parameters like IP address (a manual IP address is preferable), network SSID and password.

  • If you are wanting to control the device over wifi, maybe you want to use the Access Point Mode or add the web_server: component to create a very simple interface you can use with a browser.

  • If you want Home Assistant to see and control the device you can use the native api: section. Or you can use MQTT to communicate with Home Assistant.

If you want to move projects between your ESPHome servers, you just copy the .YAML files and compile on the other server. The hardest part is remembering which is the latest copy ... or you could use a shared file storage.

Yes, this used to be much more complicated to setup an existing device in the HA Device Builder - but I just copied a .yaml file from my desktop PC's esphome folder to the /config/esphome folder exposed by the Samba share app on my HA ... and a simple browser refresh shows the new yaml file !