diff --git a/HMI/README.md b/HMI/README.md index 3791bfa8..cb7abf29 100644 --- a/HMI/README.md +++ b/HMI/README.md @@ -165,7 +165,7 @@ options are ? seperated onoffbtn has to be`disable` to disable the on off btn tIconBtnEntityName is the entiy name used in the button event for pressing the upper left icon -`entityUpd~*heading*~*navigation*~*internalNameEntiy*~*icon*~iconcolor~*title*~titlecolor~*author*~authorcolor~*volume*~*playpauseicon*~onoffbtn~tIconBtnEntityType~tIconBtnEntityName~iconShuffle[~*type*~*internalNameEntity*~*iconId*~*iconColor*~*displayNameEntity*~*optionalValue*]x4` +`entityUpd~*heading*~*navigation*~*internalNameEntiy*~*title*~titlecolor~*author*~authorcolor~*volume*~*playpauseicon*~onoffbtn~iconShuffle~*type*~*internalNameEntity*~*iconId*~*iconColor*~~[~*type*~*internalNameEntity*~*iconId*~*iconColor*~*displayNameEntity*~*optionalValue*]x4` ### cardAlarm Page diff --git a/HMI/code_gen/pages/cardMedia.py b/HMI/code_gen/pages/cardMedia.py index 3f76001b..6e6b5905 100644 --- a/HMI/code_gen/pages/cardMedia.py +++ b/HMI/code_gen/pages/cardMedia.py @@ -9,38 +9,30 @@ print(head) print(""" //entity name spstr strCommand.txt,entn.txt,"~",3 - //icon - spstr strCommand.txt,tIcon.txt,"~",4 - //icon farbe - spstr strCommand.txt,tTmp.txt,"~",5 - if(tTmp.txt!="") - { - covx tTmp.txt,tIcon.pco,0,0 - } //title - spstr strCommand.txt,tTitle.txt,"~",6 + spstr strCommand.txt,tTitle.txt,"~",4 //title farbe - spstr strCommand.txt,tTmp.txt,"~",7 + spstr strCommand.txt,tTmp.txt,"~",5 if(tTmp.txt!="") { covx tTmp.txt,tTitle.pco,0,0 } //author - spstr strCommand.txt,tAuthor.txt,"~",8 + spstr strCommand.txt,tAuthor.txt,"~",6 //author farbe - spstr strCommand.txt,tTmp.txt,"~",9 + spstr strCommand.txt,tTmp.txt,"~",7 if(tTmp.txt!="") { covx tTmp.txt,tAuthor.pco,0,0 } //volume - spstr strCommand.txt,tTmp.txt,"~",10 + spstr strCommand.txt,tTmp.txt,"~",8 covx tTmp.txt,sys0,0,0 hVolume.val=sys0 //icon - spstr strCommand.txt,tPlayPause.txt,"~",11 + spstr strCommand.txt,tPlayPause.txt,"~",9 // on off button - spstr strCommand.txt,tTmp.txt,"~",12 + spstr strCommand.txt,tTmp.txt,"~",10 if(tTmp.txt=="disable") { vis t5,0 @@ -49,12 +41,8 @@ print(""" vis t5,1 covx tTmp.txt,t5.pco,0,0 } - //tIconBtnEntityType - spstr strCommand.txt,vaMenu.txt,"~",13 - //tIconBtnEntityName - spstr strCommand.txt,vaMenu.txt,"~",14 // shuffel btn - spstr strCommand.txt,tTmp.txt,"~",15 + spstr strCommand.txt,tTmp.txt,"~",11 if(tTmp.txt=="disable") { vis tShuffle,0 @@ -66,8 +54,8 @@ print(""" """) -start = 16 -for i in range(1,6): +start = 12 +for i in range(1,7): idxstart = start + (i-1)*6 item = f""" // get Type diff --git a/HMI/nspanel.HMI b/HMI/nspanel.HMI index a511bd71..bd1be0f2 100644 Binary files a/HMI/nspanel.HMI and b/HMI/nspanel.HMI differ diff --git a/HMI/nspanel.tft b/HMI/nspanel.tft index 68a46671..514aac18 100644 Binary files a/HMI/nspanel.tft and b/HMI/nspanel.tft differ diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index 3b5cbf39..2a64faf8 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -353,6 +353,13 @@ class LuiPagesGen(object): elif entityType == "alarm_control_panel": entityTypePanel = "text" value = get_translation(self._locale, f"frontend.state_badge.alarm_control_panel.{entity.state}") + elif entityType == "media_player": + entityTypePanel = "text" + icon = get_icon_id('speaker-off') + if "media_content_type" in entity.attributes: + if entity.attributes.media_content_type == "music": + icon = get_icon_id("music") + value = entity.state elif entityType == "sun": entityTypePanel = "text" value = get_translation(self._locale, f"backend.component.sun.state._.{entity.state}") @@ -477,14 +484,10 @@ class LuiPagesGen(object): else: entity = apis.ha_api.get_entity(item) heading = title if title != "unknown" else entity.attributes.friendly_name - icon = get_icon_id('speaker-off') title = get_attr_safe(entity, "media_title", "") author = get_attr_safe(entity, "media_artist", "") volume = int(get_attr_safe(entity, "volume_level", 0)*100) iconplaypause = get_icon_id("pause") if entity.state == "playing" else get_icon_id("play") - if "media_content_type" in entity.attributes: - if entity.attributes.media_content_type == "music": - icon = get_icon_id("music") bits = entity.attributes.supported_features onoffbutton = "disable" if bits & 0b10000000: @@ -500,15 +503,13 @@ class LuiPagesGen(object): elif shuffle == True: shuffleBtn = get_icon_id('shuffle') - mediaBtnType = "" - if(mediaBtn.startswith('input_select')): - mediaBtnType = "input_sel" + media_icon = self.generate_entities_item(item, "cardGrid") item_str = "" for item in entities: item_str += self.generate_entities_item(item, "cardGrid") - command = f"entityUpd~{heading}~{navigation}~{item}~{icon}~~{title}~~{author}~~{volume}~{iconplaypause}~{onoffbutton}~{mediaBtnType}~{mediaBtn}~{shuffleBtn}{item_str}" + command = f"entityUpd~{heading}~{navigation}~{item}~{title}~~{author}~~{volume}~{iconplaypause}~{onoffbutton}~{shuffleBtn}{media_icon}{item_str}" self._send_mqtt_msg(command) def generate_alarm_page(self, navigation, entity, overwrite_supported_modes, alarmBtn):