mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 06:27:01 +01:00
replace icon with entities button
This commit is contained in:
@@ -165,7 +165,7 @@ options are ? seperated
|
|||||||
onoffbtn has to be`disable` to disable the on off btn
|
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
|
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
|
### cardAlarm Page
|
||||||
|
|
||||||
|
|||||||
@@ -9,38 +9,30 @@ print(head)
|
|||||||
print("""
|
print("""
|
||||||
//entity name
|
//entity name
|
||||||
spstr strCommand.txt,entn.txt,"~",3
|
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
|
//title
|
||||||
spstr strCommand.txt,tTitle.txt,"~",6
|
spstr strCommand.txt,tTitle.txt,"~",4
|
||||||
//title farbe
|
//title farbe
|
||||||
spstr strCommand.txt,tTmp.txt,"~",7
|
spstr strCommand.txt,tTmp.txt,"~",5
|
||||||
if(tTmp.txt!="")
|
if(tTmp.txt!="")
|
||||||
{
|
{
|
||||||
covx tTmp.txt,tTitle.pco,0,0
|
covx tTmp.txt,tTitle.pco,0,0
|
||||||
}
|
}
|
||||||
//author
|
//author
|
||||||
spstr strCommand.txt,tAuthor.txt,"~",8
|
spstr strCommand.txt,tAuthor.txt,"~",6
|
||||||
//author farbe
|
//author farbe
|
||||||
spstr strCommand.txt,tTmp.txt,"~",9
|
spstr strCommand.txt,tTmp.txt,"~",7
|
||||||
if(tTmp.txt!="")
|
if(tTmp.txt!="")
|
||||||
{
|
{
|
||||||
covx tTmp.txt,tAuthor.pco,0,0
|
covx tTmp.txt,tAuthor.pco,0,0
|
||||||
}
|
}
|
||||||
//volume
|
//volume
|
||||||
spstr strCommand.txt,tTmp.txt,"~",10
|
spstr strCommand.txt,tTmp.txt,"~",8
|
||||||
covx tTmp.txt,sys0,0,0
|
covx tTmp.txt,sys0,0,0
|
||||||
hVolume.val=sys0
|
hVolume.val=sys0
|
||||||
//icon
|
//icon
|
||||||
spstr strCommand.txt,tPlayPause.txt,"~",11
|
spstr strCommand.txt,tPlayPause.txt,"~",9
|
||||||
// on off button
|
// on off button
|
||||||
spstr strCommand.txt,tTmp.txt,"~",12
|
spstr strCommand.txt,tTmp.txt,"~",10
|
||||||
if(tTmp.txt=="disable")
|
if(tTmp.txt=="disable")
|
||||||
{
|
{
|
||||||
vis t5,0
|
vis t5,0
|
||||||
@@ -49,12 +41,8 @@ print("""
|
|||||||
vis t5,1
|
vis t5,1
|
||||||
covx tTmp.txt,t5.pco,0,0
|
covx tTmp.txt,t5.pco,0,0
|
||||||
}
|
}
|
||||||
//tIconBtnEntityType
|
|
||||||
spstr strCommand.txt,vaMenu.txt,"~",13
|
|
||||||
//tIconBtnEntityName
|
|
||||||
spstr strCommand.txt,vaMenu.txt,"~",14
|
|
||||||
// shuffel btn
|
// shuffel btn
|
||||||
spstr strCommand.txt,tTmp.txt,"~",15
|
spstr strCommand.txt,tTmp.txt,"~",11
|
||||||
if(tTmp.txt=="disable")
|
if(tTmp.txt=="disable")
|
||||||
{
|
{
|
||||||
vis tShuffle,0
|
vis tShuffle,0
|
||||||
@@ -66,8 +54,8 @@ print("""
|
|||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
start = 16
|
start = 12
|
||||||
for i in range(1,6):
|
for i in range(1,7):
|
||||||
idxstart = start + (i-1)*6
|
idxstart = start + (i-1)*6
|
||||||
item = f"""
|
item = f"""
|
||||||
// get Type
|
// get Type
|
||||||
|
|||||||
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -353,6 +353,13 @@ class LuiPagesGen(object):
|
|||||||
elif entityType == "alarm_control_panel":
|
elif entityType == "alarm_control_panel":
|
||||||
entityTypePanel = "text"
|
entityTypePanel = "text"
|
||||||
value = get_translation(self._locale, f"frontend.state_badge.alarm_control_panel.{entity.state}")
|
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":
|
elif entityType == "sun":
|
||||||
entityTypePanel = "text"
|
entityTypePanel = "text"
|
||||||
value = get_translation(self._locale, f"backend.component.sun.state._.{entity.state}")
|
value = get_translation(self._locale, f"backend.component.sun.state._.{entity.state}")
|
||||||
@@ -477,14 +484,10 @@ class LuiPagesGen(object):
|
|||||||
else:
|
else:
|
||||||
entity = apis.ha_api.get_entity(item)
|
entity = apis.ha_api.get_entity(item)
|
||||||
heading = title if title != "unknown" else entity.attributes.friendly_name
|
heading = title if title != "unknown" else entity.attributes.friendly_name
|
||||||
icon = get_icon_id('speaker-off')
|
|
||||||
title = get_attr_safe(entity, "media_title", "")
|
title = get_attr_safe(entity, "media_title", "")
|
||||||
author = get_attr_safe(entity, "media_artist", "")
|
author = get_attr_safe(entity, "media_artist", "")
|
||||||
volume = int(get_attr_safe(entity, "volume_level", 0)*100)
|
volume = int(get_attr_safe(entity, "volume_level", 0)*100)
|
||||||
iconplaypause = get_icon_id("pause") if entity.state == "playing" else get_icon_id("play")
|
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
|
bits = entity.attributes.supported_features
|
||||||
onoffbutton = "disable"
|
onoffbutton = "disable"
|
||||||
if bits & 0b10000000:
|
if bits & 0b10000000:
|
||||||
@@ -500,15 +503,13 @@ class LuiPagesGen(object):
|
|||||||
elif shuffle == True:
|
elif shuffle == True:
|
||||||
shuffleBtn = get_icon_id('shuffle')
|
shuffleBtn = get_icon_id('shuffle')
|
||||||
|
|
||||||
mediaBtnType = ""
|
media_icon = self.generate_entities_item(item, "cardGrid")
|
||||||
if(mediaBtn.startswith('input_select')):
|
|
||||||
mediaBtnType = "input_sel"
|
|
||||||
|
|
||||||
item_str = ""
|
item_str = ""
|
||||||
for item in entities:
|
for item in entities:
|
||||||
item_str += self.generate_entities_item(item, "cardGrid")
|
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)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def generate_alarm_page(self, navigation, entity, overwrite_supported_modes, alarmBtn):
|
def generate_alarm_page(self, navigation, entity, overwrite_supported_modes, alarmBtn):
|
||||||
|
|||||||
Reference in New Issue
Block a user