Good practice? switching an ESPHome device between 2 Home Assistant instances (test and prod)?

At the moment, I have a test and a prod HA instance each with their own NodeRed instance. I have 1 MQTT broker.

I may set up a new ESPHome device starting in the “test” dashboard. I’ll get it working with devices, automations, and node red flows. I’ll then want to move the ESPhome device, YAML and dashboard to my production HA instance along with the production automations and Nodered flows. No hardware will change, just which instance I want to manage the ESPHome device. All my ESPHome devices are on DHCP with allocated ips.

What’s the best thing to do to move it? Should I just create the new device in “prod” copy and paste the YAML across from “test”, and then delete the device in “test”? Is there a way of disabling it in “test” rather than deleting it?

both instances of ha can access the same esphome device… Just add/delete in configuration/integrations.

…even at the same time. No problems at all…

ESPHome devices work in a different way to what you might expect. The device itself is the server and Home Assistant is the client this enables multiple clients to connect to the ESPHome server


esphome is a server for the api. I assume there will be some cpu/ram restrictions on the number of clients (ie HA instances), but two is fine :slight_smile:

Thank you, Esphome as the server just clicked for me!

So I can have esphome devices configured on the dashboard of both ha instances at the same time and showing as online. This is great!

Presumably I just need to keep track of which code I’ve uploaded to the device from which ha instance.

Is there anything that could help with this? An indicator on the dashboard that compares a checksum perhaps whether the running firmware matches the code saved on the dashboard editor?

That’s possible too but not what we ment (and certainly nothing I would recommended).

No, and that’s because it’s a bad idea :stuck_out_tongue:

The esphome Dashboard is enough to have it installed on one instance. But as you were told you can “register” the esphome nodes (via “integrations”) on more then one ha server in parallel.

Got it thank you! :slight_smile:
1 Dashboard, probably on my test HA instance.
Boards registered to both HA isntances as integrations.

Talking about the ESP device as a server makes me wonder…

Would it be practical to load a web server on the ESP, so it can be accessed directly, in addition to through HA? Just a thought.

1 Like

Right, but in that link it says

Please note that enabling this component will take up a lot of memory and can lead to problems, especially on the ESP8266.

Since this didn’t offer specifics, I was wondering if anyone had any advice as to whether and how much a lightly-loaded ESP8266 or ESP32 would suffer.

Never seems to slow them down in my experience.
I just tested with/without the web server on an 8266, using ESP.getFreeHeap()
(there are other memory metrics to consider also, but this call was quick and easy to test with)

  • With webserver, free memory heap was ~30000.
  • Without webserver, free memory heap was ~33000.

Can’t hurt to try it and see.

1 Like

I have the web server enabled on all of my ~50 esphome thingies (including the 1mb versions of esp82xx). No problems with “average” yamls from my point of view.

1 Like

Thanks! What sorts of things are you serving over HTTP? I imagine connecting to the device to see the values of whatever sensors it’s supporting, and maybe some statistics like CPU, Memory and Network. Is there a generic web page that gets set up or do you design each one from scratch?

That’s it essentially. You can also control your switches and buttons and see a live feed of the (serial) log. It also includes the possibility of uploading a new bin.

You can use your own CSS and js but I always go with the default because it’s in anyway only a safety net which I rarely use.

1 Like