Flashed multiple Sonoff switches with ESPhome...problem integrating with HA


I am trying to use 6-8 Sonoff Basic R2 switches throughout my house to control lights and appliances. I flashed ALL with SAME firmware using esphome. They all connect to WiFi and are assigned ip addresses.

I can integrate and control the first switch without any problem. When adding the second switch, HA complains:
“Platform esphome does not generate unique IDs. ID sonoff_basic_switchbinary_sensorsonoff_basic_button already exists - ignoring binary_sensor.lab_lights_button”, etc.

To clarify: lab_lights was the ID I used when renaming the first device and its associated entities.


  1. Is there a way to use the devices as currently flashed (same firmware and ids)?
  2. If different IDs are required, how do I generate separate firmware for each device while reusing the common libraries and tools?
  3. Is it possible to flash them OTA (including different IDs – see 2.) using esphome at this point?

Initially, I tried to generate separate firmware using substitutions and !include. I stopped doing it at the second device because the esphome tool kept downloading the same libraries. I could not figure out how to reuse the platformio.ini so I thought I could get away with just flashing the same fw.

As you can probably tell, I’m a newbie HA and ESPhome user. Any suggestions/ideas are appreciated.

Thank you!

They each have to have a different name.

@nickrout : thanks for clarifying! Any ideas on questions 2. and 3.?

I think 2 will be addressed by 1. I think you will need to create a node in esphome for each of your switches e.g. node 1 = switch1, node 2 = switch2, etc. It looks to me like your current approach will result in all of your devices attempting to be the same single node/entity e.g. node 1 = switch 1, node 1 = switch 2.

I’m no expert but I think thats whats happening :slight_smile:

I don’t see any ‘‘nodes’’ in Configuration. Can you point me to instructions on how to do that? Thanks!

You should be seeing something like this in HA/ESPhome

Clicking the plus icon on that page will start the wizard to add a new “node”. So add a node for each switch you have - that help?

I see! Thanks! I’ll give it a try.

I just generated a couple of different firmwares on a dev machine. I’m not a big fan of mixing production with dev so I do not use ESPHome in HA. If I can’t flash them OTA I’ll try using your method.

Thanks again!

What firmware did you flash them with? have you tried tasmota all mine are flashed with it and all came into HA no problem

You can use substitutions and includes to make a generic file and then make a series of diffferent firmwares for a number of devices.