replace icon with entities button

This commit is contained in:
joBr99
2022-12-06 21:03:09 +01:00
parent b3740823dc
commit 3a1d522187
5 changed files with 20 additions and 31 deletions

View File

@@ -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

View File

@@ -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

Binary file not shown.

Binary file not shown.

View File

@@ -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):