The above two steps have generally fixed the issue for me in the past. This time I had to do carry out a third step.
Stop the “offending” amazon devices.
Now my question is about the last point “Stop “offending” amazon devices.”. For some reason, although I deleted all the devices shown at alexa.amazon.com, some of the echo dots are still retaining the lights and sending requests to my pi.:
> 2020-06-02 21:00:40 ERROR (MainThread) [homeassistant.components.emulated_hue.hue_api] Unknown entity number: 31 not found in emulated_hue_ids.json
> 2020-06-02 21:00:40 ERROR (MainThread) [homeassistant.components.emulated_hue.hue_api] Unknown entity number: 22 not found in emulated_hue_ids.json
> 2020-06-02 21:00:40 ERROR (MainThread) [homeassistant.components.emulated_hue.hue_api] Unknown entity number: 34 not found in emulated_hue_ids.json
> 2020-06-02 21:00:40 ERROR (MainThread) [homeassistant.components.emulated_hue.hue_api] Unknown entity number: 34 not found in emulated_hue_ids.json
> 2020-06-02 21:00:40 ERROR (MainThread) [homeassistant.components.emulated_hue.hue_api] Unknown entity number: 48 not found in emulated_hue_ids.json
> 2020-06-02 21:00:40 ERROR (MainThread) [homeassistant.components.emulated_hue.hue_api] Unknown entity number: 48 not found in emulated_hue_ids.json
> 2020-06-02 21:00:40 ERROR (MainThread) [homeassistant.components.emulated_hue.hue_api] Unknown entity number: 48 not found in emulated_hue_ids.json
This was stopping the emualted_hue from working. I tried removing the devices and adding them again (as others have suggested in the cominuty) however this did not work for me. I ended up unplugging all the amazon devices and leaving one which I hopped wasn’t one of the *“offending” devices. I got lucky as when I rebooted the pi I didn’t get the above errors. I then scanned for devices and added all my lights again. A new emulated_hue_ids.json was created (the “offending” devices were stopping this from happenign it seems).
I’ve since plugged them back in and I am getting the errors again. The lights do work, however if my emulated_hue breaks again it would be nice to know how to properlly “flush” the amazon devices so I don’t have to go round unplugging all my dots & echos.
Edit: As @petro points out the Gen2 stores alot of rubbish. What I do now is unplug my gen 2s when I do a discovery. Seems to be working this way.
Everything is being stored on the Alexa. You have to clear Alexa’s cache. From what I can tell, the only way to clear the cache is to delete the devices on Alexa’s side and reboot all the echos (with emulated hue off).
“Delete Smart Home Devices History” (blue button) from “Manage Smart Home Devices History” on Amazon (not alexa.amazon.com).
Deleted all voice history (I appreciate this is not necessary but as I said I went nuclear on this).
Did a scan when the pi was not plugged in.
Plugged one echo / dot at a time and doing a hard reset before adding back to my account.
Tuned on pi.
Scanned and now no more “Unknown entity number”.
I know the above is over kill but it was really getting on my nerves. I believe most of the above is not necessary and you should be able to get away with:
@Knottyboy, thank you for the time to get this nuclear “workaround”, I’m still having problems with my echo dot devices 2nd generation, it works perfectly with the 3rd generation, but when I connect a 2nd generation echo dot, all the garbage shows again.
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.
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).
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
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
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:
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)
Ensure your config is setup properly (see example below; verify by checking http://<HA IP Address>:80/api/pi/lights)
Restart HASS
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)
Un-register all echo devices (I did this via the android app, bit of a pain unfortunately)
Re-register one echo back on to your account
Repeat device discovery
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:
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…
The solution accepted here (lead by google search) is way over-kill.
Remove the file
Restart HA
Remove all your HA devices from Alexa
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.
I hope that’s not the case
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?