Compare commits

...

9 Commits

Author SHA1 Message Date
Johannes
dc2aea3ffc Update nspanel-lovelace-ui.py 2022-03-13 19:12:41 +01:00
Johannes
4af3449491 Update nspanel-lovelace-ui.py 2022-03-13 19:09:25 +01:00
Johannes
85d1de3c19 Update nspanel-lovelace-ui.py 2022-03-13 19:07:07 +01:00
Johannes
cdda0d9601 fix for device_class in sensor item 2022-03-13 18:24:07 +01:00
joBr99
7961a27ab2 fixed length text item2 (add nextion2text) 2022-03-13 14:26:23 +00:00
Johannes
1533f52130 fixed length text item2 2022-03-13 15:26:06 +01:00
Johannes
af618b0f12 added error messages for apps.yaml missconfiguration 2022-03-13 15:24:48 +01:00
joBr99
36836f39c8 fixed pageType command for popupLight page (add nextion2text) 2022-03-13 09:16:22 +00:00
Johannes
d934f92a7e fixed pageType command for popupLight page 2022-03-13 10:16:01 +01:00
10 changed files with 53 additions and 29 deletions

View File

@@ -67,7 +67,7 @@ change the page type:
`pageType,cardMedia` `pageType,cardMedia`
`pageType,popupLight,Schreibtischlampe` `pageType,popupLight,Schreibtischlampe,light.schreibtischlampe`
`pageType,popupNotify` `pageType,popupNotify`

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

Binary file not shown.

View File

@@ -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 entity.attributes.device_class in icon_mapping: if "device_class" in entity.attributes:
icon_id = icon_mapping[entity.attributes.device_class] if entity.attributes.device_class in icon_mapping:
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 = entity.attributes.hvac_action status = ""
if "hvac_action" in entity.attributes:
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
@@ -484,4 +491,4 @@ class NsPanelLovelaceUI:
sat = r sat = r
hsv = (math.degrees(math.atan2(y, x))%360/360, sat, 1) hsv = (math.degrees(math.atan2(y, x))%360/360, sat, 1)
rgb = self.hsv2rgb(hsv[0],hsv[1],hsv[2]) rgb = self.hsv2rgb(hsv[0],hsv[1],hsv[2])
return rgb return rgb