Do not display speaker selection item, in case there is only one speaker

This commit is contained in:
Johannes
2022-03-27 19:30:54 +02:00
committed by GitHub
parent 0b206e7fe3
commit 3d04f77961

View File

@@ -240,10 +240,13 @@ class LuiPagesGen(object):
if entity.attributes.media_content_type == "music":
icon = get_icon_id("music")
source = entity.attributes.get("source", "")
speakerlist = entity.attributes.get("source_list","")
speakerlist = entity.attributes.get("source_list",[])
if source in speakerlist:
# move current source to the end of the list
speakerlist.remove(source)
speakerlist.append(source)
if len(speakerlist) == 1:
speakerlist = []
speakerlist = "?".join(speakerlist)
command = f"entityUpd,|{item}|{heading}|{icon}|{title}|{author}|{volume}|{iconplaypause}|{source}|{speakerlist}"
self._send_mqtt_msg(command)