mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-01-30 01:54:13 +01:00
Compare commits
4 Commits
v3.9.2
...
thermobtns
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
415813d847 | ||
|
|
2bc83a2e11 | ||
|
|
eac9a73f8a | ||
|
|
80670a4722 |
@@ -100,6 +100,8 @@ change the page type:
|
|||||||
|
|
||||||
`notify~heading~text`
|
`notify~heading~text`
|
||||||
|
|
||||||
|
`statusUpdate~icon1~icon1Color~icon2~icon2~icon2color~icon1font~icon2font`
|
||||||
|
|
||||||
### cardEntities Page
|
### cardEntities Page
|
||||||
|
|
||||||
Structure (Category): `entityUpd~title~[navigation]~[entity_information]`
|
Structure (Category): `entityUpd~title~[navigation]~[entity_information]`
|
||||||
|
|||||||
@@ -26,50 +26,16 @@ text += """
|
|||||||
//tempStep
|
//tempStep
|
||||||
spstr strCommand.txt,tTmp.txt,"~",20
|
spstr strCommand.txt,tTmp.txt,"~",20
|
||||||
covx tTmp.txt,xTempStep1.val,0,0
|
covx tTmp.txt,xTempStep1.val,0,0
|
||||||
// disable all buttons
|
|
||||||
vis bt0,0
|
|
||||||
vis bt1,0
|
|
||||||
vis bt2,0
|
|
||||||
vis bt3,0
|
|
||||||
vis bt4,0
|
|
||||||
vis bt5,0
|
|
||||||
vis bt6,0
|
|
||||||
vis bt7,0
|
|
||||||
"""
|
|
||||||
|
|
||||||
start = 21
|
|
||||||
for i in range(0,8):
|
|
||||||
idxstart = start + i*4
|
|
||||||
text += f"""
|
|
||||||
//bt{i}
|
|
||||||
spstr strCommand.txt,bt{i}.txt,"~",{idxstart}
|
|
||||||
if(bt{i}.txt!="")
|
|
||||||
{{
|
|
||||||
// set text color on active state
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",{idxstart+1}
|
|
||||||
covx tTmp.txt,bt{i}.pco2,0,0
|
|
||||||
// set state
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",{idxstart+2}
|
|
||||||
covx tTmp.txt,bt{i}.val,0,0
|
|
||||||
// save action
|
|
||||||
spstr strCommand.txt,va{i}.txt,"~",{idxstart+3}
|
|
||||||
//enable
|
|
||||||
vis bt{i},1
|
|
||||||
}}"""
|
|
||||||
|
|
||||||
text += """
|
|
||||||
//Text tCurTempLbl
|
//Text tCurTempLbl
|
||||||
spstr strCommand.txt,tCurTempLbl.txt,"~",53
|
spstr strCommand.txt,tCurTempLbl.txt,"~",21
|
||||||
//Text tStateLbl
|
//Text tStateLbl
|
||||||
spstr strCommand.txt,tStateLbl.txt,"~",54
|
spstr strCommand.txt,tStateLbl.txt,"~",22
|
||||||
//Text tALbl
|
|
||||||
spstr strCommand.txt,tALbl.txt,"~",55
|
|
||||||
//Text tCF
|
//Text tCF
|
||||||
spstr strCommand.txt,tCF.txt,"~",56
|
spstr strCommand.txt,tCF.txt,"~",23
|
||||||
tCF1.txt=tCF.txt
|
tCF1.txt=tCF.txt
|
||||||
tCF2.txt=tCF.txt
|
tCF2.txt=tCF.txt
|
||||||
//Second Temperature
|
//Second Temperature
|
||||||
spstr strCommand.txt,tTmp.txt,"~",57
|
spstr strCommand.txt,tTmp.txt,"~",24
|
||||||
if(tTmp.txt!="")
|
if(tTmp.txt!="")
|
||||||
{
|
{
|
||||||
covx tTmp.txt,xTempDest2.val,0,0
|
covx tTmp.txt,xTempDest2.val,0,0
|
||||||
@@ -87,15 +53,46 @@ text += """
|
|||||||
vis tCF2,1
|
vis tCF2,1
|
||||||
}
|
}
|
||||||
//Show btDetail
|
//Show btDetail
|
||||||
spstr strCommand.txt,tTmp.txt,"~",58
|
spstr strCommand.txt,tTmp.txt,"~",25
|
||||||
if(tTmp.txt!="1")
|
if(tTmp.txt=="enable")
|
||||||
{
|
{
|
||||||
vis btDetail,1
|
vis btDetail,1
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
vis btDetail,0
|
vis btDetail,0
|
||||||
}
|
}
|
||||||
}
|
"""
|
||||||
""" + sharedfoot
|
|
||||||
print(text)
|
print(text)
|
||||||
|
|
||||||
|
|
||||||
|
start = 26
|
||||||
|
for i in range(1,9):
|
||||||
|
idxstart = start + (i-1)*6
|
||||||
|
item = f"""
|
||||||
|
// get Type
|
||||||
|
spstr strCommand.txt,tTmp.txt,"~",{idxstart}
|
||||||
|
if(tTmp.txt=="delete"||tTmp.txt=="")
|
||||||
|
{{
|
||||||
|
vis bEntity{i},0
|
||||||
|
}}else
|
||||||
|
{{
|
||||||
|
// get internal name
|
||||||
|
spstr strCommand.txt,entn{i}.txt,"~",{idxstart+1}
|
||||||
|
// change icon
|
||||||
|
spstr strCommand.txt,bEntity{i}.txt,"~",{idxstart+2}
|
||||||
|
vis bEntity{i},1
|
||||||
|
// change icon color
|
||||||
|
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
|
||||||
|
covx tTmp.txt,sys0,0,0
|
||||||
|
bEntity{i}.pco=sys0
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
print(item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("""
|
||||||
|
}
|
||||||
|
""" + sharedfoot
|
||||||
|
)
|
||||||
|
|
||||||
|
|||||||
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -401,13 +401,12 @@ class LuiPagesGen(object):
|
|||||||
command += self.generate_entities_item(item, cardType, tempUnit)
|
command += self.generate_entities_item(item, cardType, tempUnit)
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def generate_thermo_page(self, navigation, title, entity, temp_unit, overwrite_supported_modes):
|
def generate_thermo_page(self, navigation, title, entity, temp_unit, entities, overwrite_supported_modes):
|
||||||
item = entity.entityId
|
item = entity.entityId
|
||||||
|
|
||||||
if(temp_unit == "celsius"):
|
if(temp_unit == "celsius"):
|
||||||
temperature_unit_icon = get_icon_id("temperature-celsius")
|
temperature_unit_icon = get_icon_id("temperature-celsius")
|
||||||
temperature_unit = "°C"
|
temperature_unit = "°C"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
temperature_unit_icon = get_icon_id("temperature-fahrenheit")
|
temperature_unit_icon = get_icon_id("temperature-fahrenheit")
|
||||||
temperature_unit = "°F"
|
temperature_unit = "°F"
|
||||||
@@ -415,83 +414,78 @@ class LuiPagesGen(object):
|
|||||||
if not apis.ha_api.entity_exists(item):
|
if not apis.ha_api.entity_exists(item):
|
||||||
command = f"entityUpd~Not found~{navigation}~{item}~check~220~apps.yaml~150~300~5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Please~your~~"
|
command = f"entityUpd~Not found~{navigation}~{item}~check~220~apps.yaml~150~300~5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Please~your~~"
|
||||||
else:
|
else:
|
||||||
entity = apis.ha_api.get_entity(item)
|
ha_entity = apis.ha_api.get_entity(item)
|
||||||
heading = title if title != "unknown" else entity.attributes.friendly_name
|
heading = title if title != "unknown" else ha_entity.attributes.friendly_name
|
||||||
current_temp = get_attr_safe(entity, "current_temperature", "")
|
current_temp = get_attr_safe(ha_entity, "current_temperature", "")
|
||||||
dest_temp = get_attr_safe(entity, "temperature", None)
|
dest_temp = get_attr_safe(ha_entity, "temperature", None)
|
||||||
dest_temp2 = ""
|
dest_temp2 = ""
|
||||||
if dest_temp is None:
|
if dest_temp is None:
|
||||||
dest_temp = get_attr_safe(entity, "target_temp_high", 0)
|
dest_temp = get_attr_safe(ha_entity, "target_temp_high", 0)
|
||||||
dest_temp2 = get_attr_safe(entity, "target_temp_low", None)
|
dest_temp2 = get_attr_safe(ha_entity, "target_temp_low", None)
|
||||||
if dest_temp2 != None and dest_temp2 != "null":
|
if dest_temp2 != None and dest_temp2 != "null":
|
||||||
dest_temp2 = int(dest_temp2*10)
|
dest_temp2 = int(dest_temp2*10)
|
||||||
else:
|
else:
|
||||||
dest_temp2 = ""
|
dest_temp2 = ""
|
||||||
dest_temp = int(dest_temp*10)
|
dest_temp = int(dest_temp*10)
|
||||||
|
|
||||||
hvac_action = get_attr_safe(entity, "hvac_action", "")
|
hvac_action = get_attr_safe(ha_entity, "hvac_action", "")
|
||||||
state_value = ""
|
state_value = ""
|
||||||
if hvac_action != "":
|
if hvac_action != "":
|
||||||
state_value = get_translation(self._locale, f"frontend.state_attributes.climate.hvac_action.{hvac_action}")
|
state_value = get_translation(self._locale, f"frontend.state_attributes.climate.hvac_action.{hvac_action}")
|
||||||
state_value += "\r\n("
|
state_value += "\r\n("
|
||||||
state_value += get_translation(self._locale, f"backend.component.climate.state._.{entity.state}")
|
state_value += get_translation(self._locale, f"backend.component.climate.state._.{ha_entity.state}")
|
||||||
if hvac_action != "":
|
if hvac_action != "":
|
||||||
state_value += ")"
|
state_value += ")"
|
||||||
|
|
||||||
min_temp = int(get_attr_safe(entity, "min_temp", 0)*10)
|
min_temp = int(get_attr_safe(ha_entity, "min_temp", 0)*10)
|
||||||
max_temp = int(get_attr_safe(entity, "max_temp", 0)*10)
|
max_temp = int(get_attr_safe(ha_entity, "max_temp", 0)*10)
|
||||||
step_temp = int(get_attr_safe(entity, "target_temp_step", 0.5)*10)
|
step_temp = int(get_attr_safe(ha_entity, "target_temp_step", 0.5)*10)
|
||||||
icon_res_list = []
|
icon_res_list = []
|
||||||
icon_res = ""
|
icon_res = ""
|
||||||
|
|
||||||
hvac_modes = get_attr_safe(entity, "hvac_modes", [])
|
currently_translation = get_translation(self._locale, "frontend.ui.card.climate.currently")
|
||||||
|
state_translation = get_translation(self._locale, "frontend.ui.panel.config.devices.entities.state")
|
||||||
|
|
||||||
|
detailPage = ""
|
||||||
|
if any(x in ["preset_modes", "swing_modes", "fan_modes"] for x in ha_entity.attributes):
|
||||||
|
detailPage = "enable"
|
||||||
|
|
||||||
|
#hvac_modes = get_attr_safe(ha_entity, "hvac_modes", [])
|
||||||
|
#if overwrite_supported_modes is not None:
|
||||||
|
# hvac_modes = overwrite_supported_modes
|
||||||
|
#for mode in hvac_modes:
|
||||||
|
# icon_id = get_icon_ha(item, stateOverwrite=mode)
|
||||||
|
# color_on = 64512
|
||||||
|
# if mode in ["auto", "heat_cool"]:
|
||||||
|
# color_on = 1024
|
||||||
|
# if mode == "heat":
|
||||||
|
# color_on = 64512
|
||||||
|
# if mode == "off":
|
||||||
|
# color_on = 35921
|
||||||
|
# if mode == "cool":
|
||||||
|
# color_on = 11487
|
||||||
|
# if mode == "dry":
|
||||||
|
# color_on = 60897
|
||||||
|
# if mode == "fan_only":
|
||||||
|
# color_on = 35921
|
||||||
|
# state = 0
|
||||||
|
# if(mode == ha_entity.state):
|
||||||
|
# state = 1
|
||||||
|
|
||||||
|
item_str = ""
|
||||||
|
for eitem in entities:
|
||||||
|
item_str += self.generate_entities_item(eitem, "cardGrid")
|
||||||
|
|
||||||
|
hvac_modes = get_attr_safe(ha_entity, "hvac_modes", [])
|
||||||
if overwrite_supported_modes is not None:
|
if overwrite_supported_modes is not None:
|
||||||
hvac_modes = overwrite_supported_modes
|
hvac_modes = overwrite_supported_modes
|
||||||
for mode in hvac_modes:
|
for mode in hvac_modes:
|
||||||
icon_id = get_icon_ha(item, stateOverwrite=mode)
|
item_str += self.generate_entities_item(entity, "cardGrid")
|
||||||
color_on = 64512
|
|
||||||
if mode in ["auto", "heat_cool"]:
|
|
||||||
color_on = 1024
|
|
||||||
if mode == "heat":
|
|
||||||
color_on = 64512
|
|
||||||
if mode == "off":
|
|
||||||
color_on = 35921
|
|
||||||
if mode == "cool":
|
|
||||||
color_on = 11487
|
|
||||||
if mode == "dry":
|
|
||||||
color_on = 60897
|
|
||||||
if mode == "fan_only":
|
|
||||||
color_on = 35921
|
|
||||||
state = 0
|
|
||||||
if(mode == entity.state):
|
|
||||||
state = 1
|
|
||||||
|
|
||||||
icon_res_list.append(f"~{icon_id}~{color_on}~{state}~{mode}")
|
|
||||||
|
|
||||||
icon_res = "".join(icon_res_list)
|
command = f"entityUpd~{heading}~{navigation}~{item}~{current_temp} {temperature_unit}~{dest_temp}~{state_value}~{min_temp}~{max_temp}~{step_temp}~{currently_translation}~{state_translation}~{temperature_unit_icon}~{dest_temp2}~{detailPage}{item_str}"
|
||||||
|
|
||||||
if len(icon_res_list) == 1 and not self._config.get("model") == "us-p":
|
|
||||||
icon_res = "~"*4 + icon_res_list[0] + "~"*4*6
|
|
||||||
elif len(icon_res_list) == 2 and not self._config.get("model") == "us-p":
|
|
||||||
icon_res = "~"*4*2 + icon_res_list[0] + "~"*4*2 + icon_res_list[1] + "~"*4*2
|
|
||||||
elif len(icon_res_list) == 3 and not self._config.get("model") == "us-p":
|
|
||||||
icon_res = "~"*4*2 + icon_res_list[0] + "~"*4 + icon_res_list[1] + "~"*4 + icon_res_list[2] + "~"*4
|
|
||||||
elif len(icon_res_list) == 4 and not self._config.get("model") == "us-p":
|
|
||||||
icon_res = "~"*4 + icon_res_list[0] + "~"*4 + icon_res_list[1] + "~"*4 + icon_res_list[2] + "~"*4 + icon_res_list[3]
|
|
||||||
elif len(icon_res_list) >= 5 or self._config.get("model") == "us-p":
|
|
||||||
icon_res = "".join(icon_res_list) + "~"*4*(8-len(icon_res_list))
|
|
||||||
|
|
||||||
currently_translation = get_translation(self._locale, "frontend.ui.card.climate.currently")
|
|
||||||
state_translation = get_translation(self._locale, "frontend.ui.panel.config.devices.entities.state")
|
|
||||||
action_translation = get_translation(self._locale, "frontend.ui.card.climate.operation").replace(' ','\r\n')
|
|
||||||
|
|
||||||
detailPage = ""
|
|
||||||
if any(x in ["preset_modes", "swing_modes", "fan_modes"] for x in entity.attributes):
|
|
||||||
detailPage = "1"
|
|
||||||
|
|
||||||
command = f"entityUpd~{heading}~{navigation}~{item}~{current_temp} {temperature_unit}~{dest_temp}~{state_value}~{min_temp}~{max_temp}~{step_temp}{icon_res}~{currently_translation}~{state_translation}~{action_translation}~{temperature_unit_icon}~{dest_temp2}~{detailPage}"
|
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
|
|
||||||
def generate_media_page(self, navigation, title, entity, entities, mediaBtn):
|
def generate_media_page(self, navigation, title, entity, entities, mediaBtn):
|
||||||
entityId = entity.entityId
|
entityId = entity.entityId
|
||||||
if entity.status is not None:
|
if entity.status is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user