Remove duplicate Apple TV

Just upgraded to 38.3 and enabled the new Apple TV platform to get more accurate data. Unfortunately I now have duplicate media_players:

media_player.apple_tv
media_player.apple_tv_2

tv_2 is the new entry. How can I remove the old media_player and rename the new one so all my automations continue to work properly?

Thanks

You could use the entity_namespace: option in the new one to differentiate the naming if it is supported. I don’t have any Apple devices so I can’t say for sure, but I am using it with other media players.

Tried using entity_namespace: Apple TV New and now get:

media_player.apple_tv
media_player.apple_tv_apple_tv_new

Is there no way just to delete the entry media_player.apple_tv from the Db? Not sure what is creating it.

My guess is that you have configured the device manually and then discovery picks it up as well. Did you specify a hostname or IP-address in your configuration?

Yup using the new config in my media_players.yaml file:

  - platform: apple_tv
    host: <redacted>
    login_id: <redacted>

I wonder if it’s to do with my Plex config, as I also have that in my media_players.yaml file

EDIT: removed the Plex config from my media_players but no difference :frowning:

Ok, then is plex probably the other one. You can specify a name tag as well to rename the device (for the Apple TV platform at least). If you don’t want the plex instance, I guess you have to disable it somehow. How you configured that manually too?

Do you have discovery enabled? It probably picks it up automatically.

This is my media_players file, not much in it

  - platform: plex
    username: <redacted>
    password: <redacted>
  - platform: samsungtv
    host: 192.168.1.121
    name: Samsung TV
  - platform: apple_tv
    host: 192.168.1.122
    login_id: <redacted>

I have discovery turned on in my configuration.yaml. Tried removing that but still have the media_player.apple_tv and media_player.apple_tv_2 entry.

You did remove both discovery and the plex config?

OK removed both discovery and the plex config and it only saw the original media_player.apple_tv!

Re-enabled the plex config and for some reason they have swapped round now. So media_player.apple_tv is now the new one with the richer data. No idea why. But this is good :slight_smile:

Thinking about it, I think the other one is being created by my device tracker UniFi component. Not sure how to stop that seeing the Apple TV though.

When you say “original” media_player.apple_tv, which do you mean then? I assumed that you didn’t have plex nor discovery enabled, so it would be the apple_tv platform?

Yes, it was just the old media_player.apple_tv showing. Not the new one.

I now have two entries again

media_player.apple_tv
media_player.apple_tv_2

But the first one is now the new platform, the second is the old one. So my automations work with the new platform and richer data. Which is good :slight_smile: I now want to stop media_player.apple_tv_2 being discovered. I think that is my UniFi device tracker. My Apple TV connects via WiFi and UniFi just sees it and HA creates a record for it.

Ok, that seems a bit strange to me that UniFi would do that. I could understand if it discovered it as a device and created device_tracker.apple_tv. Can you try to disable plex, discovery and apple_tv and see if it still is there? We should probably single out the source.

OK disabled discovery, plex and apple_tv, both media_player entries have gone.

The solution I offered was simply to allow you to differentiate between the two so you knew which one to display. You didn’t mention about wanting to remove it from dev states. As long the name is different so that you now know which one to include in automation, I don’t really see the problem because as long as you don’t include it in a group or view, you’ll never see it.

This is likely due to some discovery and is a topic we’re discussing in this thread that you might be interested in:

If you add only discovery, do you get two devices? If they are connected both with wire and wifi, you probably should.

Thanks @rpitera. I understand, trying to get to the bottom of why I get two entries. As you say it will be down to discovery I’m sure.

@postlund, now enabled discovery only and I now have the old platform media_player.apple_tv. Nothing else.

1 Like

I’m having similar issues because I am testing new components for devs for stuff that will be coming up in the next release. Since some of them are either improvements on existing platforms or in the case of Ring doorbells, taking a device supported in one platform and supporting it directly, I run into the issue of trying to figure out which sensor/device is the released version and which one is the test.

entity_namespace has been a big help in this. Discovery on the other hand has not, as I am sure you know… LOL

Ok, that’s good. Can you try to look for media_player.apple_tv in your log file (grep media_player.apple_tv home-assistant.log)?

Oh and heads up - there’s a PR in for adding ignore: to discovery!!! Literally just happened.

https://github.com/home-assistant/home-assistant/pull/6048

Thanks @postlund!