Duplicate variables in HA after remove/add ESP nodes!

Hi

I’m using only the HA API implemented in esphome (no MQTT things). I added a new ESP node I have flashed with ESPHome (the sketch has three variables published) in HA through the Integration menu. The 3 variables show up well in HA and update correctly.
As I wanted to continue to tweak that node before final integration in HA, I removed the node from HA through Integration menu.
After having finished my tweaks, I re-added that same physical node (but that had some new variables too) in Integration menu of HA.
Now all variables that existed in first sketch and still exists in last one are in duplicate in HA ! Is the Integration menu not supposed to destroy variables attached at device(s) removed from Integration Menu ?
I removed the ESP node again and now I have all original variables plus duplicate in HA !
I hoped the new API would prevent the duplicate problem you could have often with MQTT and devices that you had removed of system but were still present in HA !
Is it a bug ? if so ESP or HA ? or is it just a feature not yet implemented ?

Running latest version of HA and ESPHome :wink:

Thanks

Vincèn

kind of…

i think it is HA discovery.

the best way i found to deal with it is to go to the integrations page and delete all of the nodes that have duplicates. make sure delete all of the nodes - even the original seemingly good working nodes. then restart HA. then you can either re-add them manually or, better, wait for HA to discover them again and configure them semi-automatically by clicking “configure” then “submit”

Thanks for sharing your solution so I did the same, removed the integration of that node, restarted HA, and in fact waited one night ! this morning in history I see no more all variables attached at that node including duplicates so it looks fine.
I then add back my node and in fact it’s weirdest than expected :smiley: It shows me some duplicate and some unavalaible entities on the node itself ??? I’m not sure what’s happening here but it looks there is a sort of confusion in HA between some old variables not fully deleted or something like that no ?
Here is the sketch running in the node (I putted just the sensor part):

sensor:
  - platform: adc
    pin: A0
    name: "Batterie Station Météo"
  - platform: bmp280
    temperature:
      name: "Température Jardin"
      oversampling: 16x
      unit_of_measurement: "°C"
      icon: "mdi:temperature-celsius"
    pressure:
      name: "Pression Jardin"
      icon: "mdi:track-light"
    address: 0x77
    update_interval: 60s
  - platform: tsl2561
    name: "Luminosité Jardin"
    address: 0x39
    update_interval: 60s

and screenshot of how it appears in HA once added the node through the integration menu (side note: HA well discovered the node automatically so I just had to confirm to add it straight !):
Screenshot_20190326_095217
Screenshot_20190326_095237
Not sure now what to do to clear the problem ? and also to figure out where is the problem ??

Thanks

Vincèn

I’m not really sure either. The way I described has always worked for me.

Maybe you can remove all the nodes again and then check the entity registry in the .storage folder to see if there are any remnants left in there before restarting HA.

Yep it looks like the good old “dirty” way is still the best :smiley: I noticed also few esp.xxxx files in the .storage folder that I deleted also and it looks fine now :wink: