From 77b9a1268788c7f36fd75a4143572d6f01870675 Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Tue, 15 Sep 2015 21:07:49 -0400 Subject: [PATCH] Tags the name of the device to the end of the name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This helps the media player be more explicit about itself and what it is. It also namespaces it self a little better in the system. Rather than be `media_player.family_room` it is `media_player.family_room_apple_tv`. This helps for cases when there’s another actual media player like Kodi or Chromecast in there. --- homeassistant/components/media_player/itunes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/media_player/itunes.py b/homeassistant/components/media_player/itunes.py index f63b6c933fe..891b7aff2b0 100644 --- a/homeassistant/components/media_player/itunes.py +++ b/homeassistant/components/media_player/itunes.py @@ -356,7 +356,10 @@ class AirPlayDevice(MediaPlayerDevice): self.player_state = state_hash.get('player_state', None) if 'name' in state_hash: - self.device_name = state_hash.get('name', 'AirPlay') + name = state_hash.get('name', '') + kind = state_hash.get('kind', 'AirPlay') + + self.device_name = (name + ' ' + kind).strip() if 'kind' in state_hash: self.kind = state_hash.get('kind', None)