Skip to content

Commit

Permalink
fixed loosing speaker if all fields are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
KoljaWindeler committed Jul 27, 2021
1 parent 2f13af3 commit 0e065a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/ytube_music_player/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"@KoljaWindeler"
],
"iot_class": "cloud_polling",
"version": "20210726.01"
"version": "20210727.01"
}
6 changes: 3 additions & 3 deletions custom_components/ytube_music_player/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ async def async_update_selects(self, now=None):
if(e.entity_id.startswith(DOMAIN_MP) and not(e.entity_id.startswith(DOMAIN_MP+"."+DOMAIN))):
speakersList.append(e.entity_id.replace(DOMAIN_MP+".",""))

# create friendly speakerlist
# create friendly speakerlist based on the current speakerLlist
self._friendly_speakersList = dict()
for a in speakersList:
state = self.hass.states.get(DOMAIN_MP+"."+a)
Expand All @@ -916,8 +916,8 @@ async def async_update_selects(self, now=None):
if(self._select_mediaPlayer == ""):
self.log_me('debug',"- Drop down for media player not found")
self._select_mediaPlayer = ""
# if exactly one unit is provided, stick with it, if it existst
if(len(speakersList) == 1):
# if exactly one unit is provided (meaning defaultPlayer is set), stick with it, if it existst
if(defaultPlayer!=''):
if(await self.async_update_remote_player(remote_player=speakersList[0])):
self.log_me('debug',"- Choosing "+self._remote_player+" as player")
else: #dropdown exists
Expand Down

0 comments on commit 0e065a1

Please sign in to comment.