home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.81k stars 30.06k forks source link

ValueError: Config entry has already been setup! #116275

Closed cloudbr34k84 closed 5 months ago

cloudbr34k84 commented 5 months ago

The problem

Logger: homeassistant.config_entries Source: config_entries.py:575 First occurred: 9:42:27 am (2 occurrences) Last logged: 9:42:27 am

Error setting up entry Master Bedroom Android TV for media_player Error setting up entry Master Bedroom Android TV for remote Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 575, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/media_player/init.py", line 445, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 185, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup!

What version of Home Assistant Core has the issue?

2024.5.0b0

What was the last working version of Home Assistant Core?

Unsure

What type of installation are you running?

Home Assistant OS

Integration causing the issue

media_player

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

frenck commented 5 months ago

Which integrations provides these?

Error setting up entry Master Bedroom Android TV for media_player Error setting up entry Master Bedroom Android TV for remote

../Frenck

cloudbr34k84 commented 5 months ago

It's using that Android TV integration

home-assistant[bot] commented 5 months ago

Hey there @jefflirion, @ollo69, mind taking a look at this issue as it has been labeled with an integration (androidtv) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `androidtv` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign androidtv` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


androidtv documentation androidtv source (message by IssueLinks)

skybasemonkeyha commented 5 months ago

so the error is because of two things. same mac and or same ip as another android debug bridge config entry.

if i had FireTV A and it had ip 192.168.0.101 and then put FireTV B with that same ip with out removing the integration, i will get the error. different macs but same ip, easy example is switching from ethernet to wifi.

if i had an otg adapter, and it had mac 00:ab:cd:ef:00 if i where to but FireTV A on the otg adapter but with ip 192.168.0.101 not remove the config entry and then swap it out with FireTV B using the same otg adapter but with ip 192.168.0.102 when i try to add a new config entry for Fire TV while Keeping the config entry for FireTV A i will get the error.

the android debuging bridge logs and identifies the config entry by mac address. so if the ip is already configured but the mac address doesn't match error occurs. in order for you to add another device the mac and ip have to be unique

solution is easy remove any existing config entry with the same mac or ip

cloudbr34k84 commented 5 months ago

so the error is because of two things. same mac and or same ip as another android debug bridge config entry.

if i had FireTV A and it had ip 192.168.0.101 and then put FireTV B with that same ip with out removing the integration, i will get the error. different macs but same ip, easy example is switching from ethernet to wifi.

if i had an otg adapter, and it had mac 00:ab:cd:ef:00 if i where to but FireTV A on the otg adapter but with ip 192.168.0.101 not remove the config entry and then swap it out with FireTV B using the same otg adapter but with ip 192.168.0.102 when i try to add a new config entry for Fire TV while Keeping the config entry for FireTV A i will get the error.

the android debuging bridge logs and identifies the config entry by mac address. so if the ip is already configured but the mac address doesn't match error occurs. in order for you to add another device the mac and ip have to be unique

solution is easy remove any existing config entry with the same mac or ip

i wish i understood this

Anto79-ops commented 5 months ago

I've added a couple of new issues to core which reference this. I'm seeing the same with Switchbot (BT-based devices), LaMetric and Dyson. Hope that helps in your troubleshooting.