How to efficiently "flush" emulated hue? (Solved)

the garbage is stored on the gen2 dot. factory reset it.

1 Like

You just saved my marriage. This was driving me insane and cost me 4 hours of trying things until I found your post. I still have an original 2nd gen dot I can’t seem to fully reset no matter what I do so that one probably will just go in the garbage.

1 Like

I think the menu has changed or moved. I can’t seem to find these two bullet points. Someone can confirm where to navigate?

Clear smart devices from alexa.amazon.com

"Delete Smart Home Devices History" (blue button) from "Manage Smart Home Devices History" on Amazon (not alexa.amazon.com).

Ok, I think I found them.
1 - Smart Home Make sure you are logged in first.
2 - Delete Smart Home Devices History. Make sure you are logged in first.

I have a mix a of gen2 and gen3 devices and was experiencing this same issue. Removing devices seems to work better in the current Alexa app on Android so you may want to try this first. Since I’ve done this, all the removed devices have stopped showing up in my hass log.

  • Shutdown Home Assistant
  • Delete .storage/emulated_hue.ids
  • Edit configuration.yaml to only expose the devices you want
  • Go into the app and delete all hue devices
  • Go to Mange Alex Data and under “Smart Home Device History”, click on “One-time deletion of all history”. Not sure if this step is needed now. If someone wants to try skipping it, let us know.
  • Start Home Assistant
  • Perform a hue gen 1 discovery from the app which will pull in current and old / invalid devices
  • Click on each invalid device within the app and delete it
1 Like

Your solution worked great for me. I was actually able to skip your 5th step (one time deletion of all history) and still was able to get rid of duplicate devices

Is there any solution without this step?
It can’t be the only way to always delete 100 old devices after a scan for new devices ?!

1 Like

Funny, I’m working through the steps in this thread right now. I was trying many things prior to seeing the steps here and I have deleted all items from within Alexa at least 4 times now. To describe the process in one word = painful
Finding it is faster to manage Alexa from a desktop, but do the device discovery from the app.

For anyone who’s running into this issue and still a bit confused, here’s the solution that ultimately worked for me:

  1. Remove your old devices from config/.storage/emulated_hue.ids (I use terminal and run rm .storage/emulated_hue.ids from the config folder to erase it completely; may want to create a backup first with cp .storage/emulated_hue.ids .storage/emulated_hue.ids.bak)
  2. Ensure your config is setup properly (see example below; verify by checking http://<HA IP Address>:80/api/pi/lights)
  3. Restart HASS
  4. Remove all emulated hue devices from the alexa app (easiest way I’ve found is via this page: https://alexa.amazon.com/spa/index.html#appliances)
  5. Un-register all echo devices (I did this via the android app, bit of a pain unfortunately)
  6. Re-register one echo back on to your account
  7. Repeat device discovery
  8. Et Voila, it’s hopefully now only detecting your currently activated devices from emulated hue. Re-add your other echos and you should be all set.

Now this all is very finicky, it seems the root of the issue is that the echo devices cache a list of old emulated hue devices and restore them even if they’re deleted from the app (and even if you delete smart home history as suggested above, at least in my experience). Of course you should first make sure only the desired smart-home devices are enabled in your emulated hue settings; I’m personally going to be testing out using groups for setting these devices up as I’m hoping this makes rearranging smart-home devices easier in the future. For an example:

/config/configuration.yaml

group: !include groups.yaml

emulated_hue:
    listen_port: 80
    expose_by_default: false
    entities:
        group.kitchen: {hidden: false}
        group.living_room: {hidden: false}

/config/groups.yaml

living_room:
    name: Living Room
    entities:
        - switch.outlet_2
        - switch.switchmate_1
kitchen:
    name: Kitchen
    entities:
        - switch.switchmate_2

Hope this is helpful to some other poor soul who’s been struggling with this same issue for far too long!

1 Like

I don’t have the emulated hue hidden file in storage for some reason. But the integration has greatly messed up my ability to add lights. It mixes them up incorrectly in alexa, so i really want to reset this, but not keen on unregistering all my alexa’s, as i imagine i will have to reset all my TTS routines then as well…

Is this integration not supported by HA anymore?

1 Like

The solution accepted here (lead by google search) is way over-kill.

  1. Remove the file
  2. Restart HA
  3. Remove all your HA devices from Alexa
  4. Launch discovery again.

I actually started toying with the emulated_hue_ids because I had a message about an old device not being found. I just had to remove it from Alexa actually, and not play with that file.

Results will vary. Doing the simplified approach you suggest landed me 300 inaccurate devices being discovered. Factory resetting my Dots was the only way to flush them.
Running discovery showed me which Echo Dot retained what devices in memory.
The Dots were able to remember device IDs for items I no longer have in use, etc. Even with no ID file in place anymore and removing all smart home history from Amazon’s site.

Also getting this really frustrating issue from time to time when i do changes.
So my question is:

Currently i am running just two old Gen 1 Echo’s (not dot).
All others are Show 8, 5 or dot Gen 4.

When i ditch the old Gen 1, is the issue gone with the newer ones?

thx

Going off memory here, but believe you must have a gen 1 or gen 2 device in order for this to even work. Maybe that’s changed?

I hope that’s not the case :frowning:
Struggling with this echo caching bug since i fideld around with smarthome and ha_bridge in the early days. Cant believe big A hasn’t sorted this!

Can anyone with just 3gen+ devices can test if emulated hue works?

thx

Thanks, that also worked for me for my two gen 1 echo’s.

Same for me, i dont have the hidden file in the .storage folder, si i can’t delete it 🥲

So I had removed a device from HA which is no longer there. The logs complained about the device not being there anymore. I deleted it from the emulated hue config. Then ik complained it coudl not be found. I deleted it from emulated_hue.ids and after restarting HA (an also in between all of the above steps), I get now:

Logger: homeassistant.components.emulated_hue.hue_api
Source: components/emulated_hue/hue_api.py:309
Integration: Emulated Hue (documentation, issues)
First occurred: 19:29:05 (3 occurrences)
Last logged: 19:29:37

Unknown entity number: 10 not found in emulated_hue_ids.json

Device 10 was indeed the last line in emulated_hue.ids file…

How to get rid of this log error?

Your echo devices cache all smart devices and this error is actually caused by your echos. The only way, unfortunately, is to turn off your emulated hue component, comment out the line in the config, restart home assistant, factory reset all your echo devices, register them on your account again, re-enable your emulated hue, check the api http://home_assistant_IP/api/v2/lights, make sure it shows the devices you have exposed and then do a discovery with your newly reset echos. It’s extremely annoying. Every time I have to change the exposed entities or alexa gets itself in trouble, I have to go through this painful process. For that I’m now considering Google Home… This is an utter joke from amazon!

2 Likes

There’s much to be said for having redundancy in your system - hence i use Googles and stuff. I today decided that frustration ought not be a feature of home automation so I removed the emulated hue config entirely (my HA log no longer shows 6000 recurring errors). I’ve repurposed my echo buttons and also realised that I don’t need a dozen ways to turn on each light. Mind you I’ve lost a good few Alexa tricks. But thank you for your advice above.

With 250 non-responsive entities in Alexa doing my head in I failed the nuke approach above and conclude that this garbage is kept in Alexa. My work round to start fresh was to deregister all the echos and clear the Alexa apps and register them to my partner’s account. (A bonus is that she’s not left helpless should I eg pass on).

In Home Assistant I now have this in configuration.yaml. I hope and pray that HA will never be allowed to let loose this entity bomb on the defenceless Alexa. There’s one entity exposed for posterity.

emulated_hue:
  host_ip: 192.168.1.xx
  listen_port: 80
#  off_maps_to_on_domains:
#      - script
  expose_by_default: false
#  exposed_domains:
  entities:
    light.kitchenceiling:
      name: "ceiling lights"
      hidden: false