krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
449 stars 47 forks source link

Device Already configured #88

Closed matfil92 closed 1 year ago

matfil92 commented 3 years ago

Hi, I've successfully installed Meross LAN component with various devices. All works correctly but yesterday I've tried to remove one entities of smart plug and now, also if I've reset it, if I try to setup it again I correctly see in Meross APP but in home assistant they will find it correctly but if I try to add it I've an error that said "Device Already configure"

How can I solve it?

image

krahabb commented 3 years ago

Hello @matfil92, Maybe there's an 'ignored' version of the config entry hidden behind or in a 'disabled' state. You can check from the top right corner of the Integrations page if it's hidden (by default) by HA and regain acces to it. If you're absolutely sure there are no other hidden configured devices/entries and still it shows you this error you might try restart HA: usually this is a consequence of an 'inconsistent' state which gets resolved only by rebooting HA. It might happen some 'disable' or 'remove' operations are not carried out cleanly maybe for transient errors or for permanent bugs (hard to identify because they really depends on a lot of factors). Rebooting is the easiest fix. Just be sure the entry is not still there disabled or ignored

krahabb commented 2 years ago

I assume this issue is not actual anymore ;)

davisgoodman commented 2 years ago

@krahabb I'm seeing this issue still with one of my Smart_Plugs. I've looked through all the disabled/hidden entities/configs and can't find the ip reporting to be already configured. Is there a file where the devices are listed I could look through?

That is the last of my smart plug that needs to be added. All the others went really well. image

krahabb commented 2 years ago

The 'Device is already configured' error comes from another 'config_entry' (integration configuration entry) having the same 'unique_id' as the one you're adding. These 'config_entries' are stored in plain json format under .homeassistant/.storage/core.config_entries. (This file contains all of your integrations configurations: beware when manually editing it) meross_lan initially uses the MAC address as unique_id when devices are discovered by DHCP but, when the configuration is being finalized and you have set the correct key (thus allowing a complete identification of the device) this unique_id is set according to the 'meross device UUID' which should be unique too (like the MAC). Still can't get where this mess comes from and I'm sorry for that but you can try manually inspecting that 'core.config_entries' file looking for all the 'meross_lan' entries and isolate the offending one (i.e. the one you're sure is not related to any of your working devices). Editing the file as I said might be dangerous if you break the json layout. As usual a good backup copy might be handy. Also, I guess it would be safer to stop HA before editing the file so it could then restart on a clean configuration.

I guess it would be nice to have the device UUID of this newly added conflicting device so you could look straight for that value in the config file but, as of now, there's no easy way to expose that. I'm looking forward to show this field information on the configuration form for the next release so it could help digging into the issue.

davisgoodman commented 2 years ago

@krahabb That's fine I'll look it up. At least I know where and what to look for. I'm ok with the json file. For now I've used another plug I had aside to replace that one but I'll get the MAC address of the offending one and look it up. I'll let you know if I'm able to have HA register it back once I`ve found the right one.