mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 15:04:24 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc2aea3ffc | ||
|
|
4af3449491 | ||
|
|
85d1de3c19 | ||
|
|
cdda0d9601 | ||
|
|
7961a27ab2 | ||
|
|
1533f52130 | ||
|
|
af618b0f12 | ||
|
|
36836f39c8 | ||
|
|
d934f92a7e |
@@ -67,7 +67,7 @@ change the page type:
|
|||||||
|
|
||||||
`pageType,cardMedia`
|
`pageType,cardMedia`
|
||||||
|
|
||||||
`pageType,popupLight,Schreibtischlampe`
|
`pageType,popupLight,Schreibtischlampe,light.schreibtischlampe`
|
||||||
|
|
||||||
`pageType,popupNotify`
|
`pageType,popupNotify`
|
||||||
|
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ Text tIcon2
|
|||||||
Vertical Alignment : center
|
Vertical Alignment : center
|
||||||
Input Type : character
|
Input Type : character
|
||||||
Text : î°
|
Text : î°
|
||||||
Max. Text Size : 10
|
Max. Text Size : 30
|
||||||
Word wrap : disabled
|
Word wrap : disabled
|
||||||
Horizontal Spacing : 0
|
Horizontal Spacing : 0
|
||||||
Vertical Spacing : 0
|
Vertical Spacing : 0
|
||||||
@@ -2326,6 +2326,8 @@ Timer tmSerial
|
|||||||
spstr strCommand.txt,tId.txt,",",1
|
spstr strCommand.txt,tId.txt,",",1
|
||||||
//save second arg if there's one
|
//save second arg if there's one
|
||||||
spstr strCommand.txt,tTmp.txt,",",2
|
spstr strCommand.txt,tTmp.txt,",",2
|
||||||
|
//save third arg if there's one
|
||||||
|
spstr strCommand.txt,pageIcons.tTmp2.txt,",",3
|
||||||
if(tId.txt=="cardEntities")
|
if(tId.txt=="cardEntities")
|
||||||
{
|
{
|
||||||
//yay, we are already on the correct page
|
//yay, we are already on the correct page
|
||||||
|
|||||||
@@ -764,6 +764,10 @@ Timer tmSerial
|
|||||||
//command format pageType,specialPageName
|
//command format pageType,specialPageName
|
||||||
//write name of speical page to tId
|
//write name of speical page to tId
|
||||||
spstr strCommand.txt,tId.txt,",",1
|
spstr strCommand.txt,tId.txt,",",1
|
||||||
|
//save second arg if there's one
|
||||||
|
spstr strCommand.txt,tTmp.txt,",",2
|
||||||
|
//save third arg if there's one
|
||||||
|
spstr strCommand.txt,pageIcons.tTmp2.txt,",",3
|
||||||
if(tId.txt=="cardMedia")
|
if(tId.txt=="cardMedia")
|
||||||
{
|
{
|
||||||
//yay, we are already on the correct page
|
//yay, we are already on the correct page
|
||||||
@@ -773,6 +777,11 @@ Timer tmSerial
|
|||||||
udelete payloadLength-1
|
udelete payloadLength-1
|
||||||
bufferPos=0
|
bufferPos=0
|
||||||
}
|
}
|
||||||
|
if(tId.txt=="popupLight")
|
||||||
|
{
|
||||||
|
pageIcons.tTmp1.txt=tTmp.txt
|
||||||
|
page popupLight
|
||||||
|
}
|
||||||
if(tId.txt=="cardEntities")
|
if(tId.txt=="cardEntities")
|
||||||
{
|
{
|
||||||
page cardEntities
|
page cardEntities
|
||||||
|
|||||||
@@ -889,6 +889,8 @@ Timer tmSerial
|
|||||||
spstr strCommand.txt,tId.txt,",",1
|
spstr strCommand.txt,tId.txt,",",1
|
||||||
//save second arg if there's one
|
//save second arg if there's one
|
||||||
spstr strCommand.txt,tTmp.txt,",",2
|
spstr strCommand.txt,tTmp.txt,",",2
|
||||||
|
//save third arg if there's one
|
||||||
|
spstr strCommand.txt,pageIcons.tTmp2.txt,",",3
|
||||||
if(tId.txt=="cardThermo")
|
if(tId.txt=="cardThermo")
|
||||||
{
|
{
|
||||||
//yay, we are already on the correct page
|
//yay, we are already on the correct page
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ pageTest
|
|||||||
12 Component(s)
|
12 Component(s)
|
||||||
12 Line(s) of event code
|
12 Line(s) of event code
|
||||||
12 Unique line(s) of event code
|
12 Unique line(s) of event code
|
||||||
|
screensaver
|
||||||
|
25 Component(s)
|
||||||
|
146 Line(s) of event code
|
||||||
|
116 Unique line(s) of event code
|
||||||
pageSwipeTest
|
pageSwipeTest
|
||||||
18 Component(s)
|
18 Component(s)
|
||||||
62 Line(s) of event code
|
62 Line(s) of event code
|
||||||
@@ -22,18 +26,14 @@ popupNotify
|
|||||||
15 Component(s)
|
15 Component(s)
|
||||||
143 Line(s) of event code
|
143 Line(s) of event code
|
||||||
95 Unique line(s) of event code
|
95 Unique line(s) of event code
|
||||||
screensaver
|
cardMedia
|
||||||
25 Component(s)
|
22 Component(s)
|
||||||
145 Line(s) of event code
|
219 Line(s) of event code
|
||||||
115 Unique line(s) of event code
|
114 Unique line(s) of event code
|
||||||
cardThermo
|
|
||||||
27 Component(s)
|
|
||||||
200 Line(s) of event code
|
|
||||||
119 Unique line(s) of event code
|
|
||||||
pageStartup
|
pageStartup
|
||||||
19 Component(s)
|
19 Component(s)
|
||||||
134 Line(s) of event code
|
135 Line(s) of event code
|
||||||
104 Unique line(s) of event code
|
105 Unique line(s) of event code
|
||||||
popupLight
|
popupLight
|
||||||
27 Component(s)
|
27 Component(s)
|
||||||
296 Line(s) of event code
|
296 Line(s) of event code
|
||||||
@@ -42,17 +42,17 @@ popupShutter
|
|||||||
19 Component(s)
|
19 Component(s)
|
||||||
148 Line(s) of event code
|
148 Line(s) of event code
|
||||||
84 Unique line(s) of event code
|
84 Unique line(s) of event code
|
||||||
cardMedia
|
cardThermo
|
||||||
22 Component(s)
|
27 Component(s)
|
||||||
212 Line(s) of event code
|
201 Line(s) of event code
|
||||||
109 Unique line(s) of event code
|
120 Unique line(s) of event code
|
||||||
cardEntities
|
cardEntities
|
||||||
55 Component(s)
|
55 Component(s)
|
||||||
823 Line(s) of event code
|
824 Line(s) of event code
|
||||||
312 Unique line(s) of event code
|
313 Unique line(s) of event code
|
||||||
|
|
||||||
Total
|
Total
|
||||||
12 Page(s)
|
12 Page(s)
|
||||||
258 Component(s)
|
258 Component(s)
|
||||||
2240 Line(s) of event code
|
2251 Line(s) of event code
|
||||||
577 Unique line(s) of event code
|
578 Unique line(s) of event code
|
||||||
|
|||||||
@@ -581,6 +581,8 @@ Timer tmSerial
|
|||||||
spstr strCommand.txt,tId.txt,",",1
|
spstr strCommand.txt,tId.txt,",",1
|
||||||
//save second arg if there's one
|
//save second arg if there's one
|
||||||
spstr strCommand.txt,tTmp.txt,",",2
|
spstr strCommand.txt,tTmp.txt,",",2
|
||||||
|
//save third arg if there's one
|
||||||
|
spstr strCommand.txt,pageIcons.tTmp2.txt,",",3
|
||||||
//we are going to exit this page with this command, so we have to clear the buffer, so we are not getting into a stupid loop ...
|
//we are going to exit this page with this command, so we have to clear the buffer, so we are not getting into a stupid loop ...
|
||||||
udelete payloadLength-1
|
udelete payloadLength-1
|
||||||
bufferPos=0
|
bufferPos=0
|
||||||
|
|||||||
@@ -732,6 +732,8 @@ Timer tmSerial
|
|||||||
spstr strCommand.txt,tId.txt,",",1
|
spstr strCommand.txt,tId.txt,",",1
|
||||||
//save second arg if there's one
|
//save second arg if there's one
|
||||||
spstr strCommand.txt,tTmp.txt,",",2
|
spstr strCommand.txt,tTmp.txt,",",2
|
||||||
|
//save third arg if there's one
|
||||||
|
spstr strCommand.txt,pageIcons.tTmp2.txt,",",3
|
||||||
//we are going to exit this page with this command, so we have to clear the buffer, so we are not getting into a stupid loop ...
|
//we are going to exit this page with this command, so we have to clear the buffer, so we are not getting into a stupid loop ...
|
||||||
udelete u[2]+3
|
udelete u[2]+3
|
||||||
bufferPos=0
|
bufferPos=0
|
||||||
|
|||||||
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -322,7 +322,7 @@ class NsPanelLovelaceUI:
|
|||||||
return "entityUpd,{0},{1}".format(item_nr, item_type)
|
return "entityUpd,{0},{1}".format(item_nr, item_type)
|
||||||
|
|
||||||
if not self.api.entity_exists(item):
|
if not self.api.entity_exists(item):
|
||||||
return
|
return f"entityUpd,{item_nr},text,{item},11,Not found check, apps.yaml"
|
||||||
entity = self.api.get_entity(item)
|
entity = self.api.get_entity(item)
|
||||||
name = entity.attributes.friendly_name
|
name = entity.attributes.friendly_name
|
||||||
|
|
||||||
@@ -345,14 +345,19 @@ class NsPanelLovelaceUI:
|
|||||||
|
|
||||||
if item_type == "sensor":
|
if item_type == "sensor":
|
||||||
icon_id = 0
|
icon_id = 0
|
||||||
|
unit_of_measurement = ""
|
||||||
icon_mapping = {
|
icon_mapping = {
|
||||||
"temperature": 2,
|
"temperature": 2,
|
||||||
"power": 4
|
"power": 4
|
||||||
}
|
}
|
||||||
|
if "device_class" in entity.attributes:
|
||||||
if entity.attributes.device_class in icon_mapping:
|
if entity.attributes.device_class in icon_mapping:
|
||||||
icon_id = icon_mapping[entity.attributes.device_class]
|
icon_id = icon_mapping[entity.attributes.device_class]
|
||||||
|
|
||||||
value = entity.state + " " + entity.attributes.unit_of_measurement
|
if "unit_of_measurement" in entity.attributes:
|
||||||
|
unit_of_measurement = entity.attributes.unit_of_measurement
|
||||||
|
|
||||||
|
value = entity.state + " " + unit_of_measurement
|
||||||
return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item_nr, "text", item, icon_id, name, value)
|
return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item_nr, "text", item, icon_id, name, value)
|
||||||
|
|
||||||
if item_type == "button" or item_type == "input_button":
|
if item_type == "button" or item_type == "input_button":
|
||||||
@@ -364,23 +369,25 @@ class NsPanelLovelaceUI:
|
|||||||
def generate_thermo_page(self, item):
|
def generate_thermo_page(self, item):
|
||||||
|
|
||||||
if not self.api.entity_exists(item):
|
if not self.api.entity_exists(item):
|
||||||
return
|
return f"entityUpd,{item},Not found,220,220,Not found,150,300,5"
|
||||||
|
|
||||||
entity = self.api.get_entity(item)
|
entity = self.api.get_entity(item)
|
||||||
heading = entity.attributes.friendly_name
|
heading = entity.attributes.friendly_name
|
||||||
current_temp = int(entity.attributes.current_temperature*10)
|
current_temp = int(entity.attributes.current_temperature*10)
|
||||||
dest_temp = int(entity.attributes.temperature*10)
|
dest_temp = int(entity.attributes.temperature*10)
|
||||||
|
status = ""
|
||||||
|
if "hvac_action" in entity.attributes:
|
||||||
status = entity.attributes.hvac_action
|
status = entity.attributes.hvac_action
|
||||||
min_temp = int(entity.attributes.min_temp*10)
|
min_temp = int(entity.attributes.min_temp*10)
|
||||||
max_temp = int(entity.attributes.max_temp*10)
|
max_temp = int(entity.attributes.max_temp*10)
|
||||||
step_temp = int(0.5*10)
|
step_temp = int(0.5*10)
|
||||||
|
|
||||||
return "entityUpd,{0},{1},{2},{3},{4},{5},{6},{7}".format(item, heading, current_temp, dest_temp, status, min_temp, max_temp, step_temp)
|
return f"entityUpd,{item},{heading},{current_temp},{dest_temp},{status},{min_temp},{max_temp},{step_temp}"
|
||||||
|
|
||||||
def generate_media_page(self, item):
|
def generate_media_page(self, item):
|
||||||
|
|
||||||
if not self.api.entity_exists(item):
|
if not self.api.entity_exists(item):
|
||||||
return
|
return f"entityUpd,|{item}|Not found|11|Please check your|apps.yaml in AppDaemon|50|11"
|
||||||
|
|
||||||
entity = self.api.get_entity(item)
|
entity = self.api.get_entity(item)
|
||||||
heading = entity.attributes.friendly_name
|
heading = entity.attributes.friendly_name
|
||||||
|
|||||||
Reference in New Issue
Block a user