Merge branch 'main' of github.com:joBr99/nspanel-lovelace-ui

This commit is contained in:
Johannes Braun
2022-12-19 16:01:24 +01:00
17 changed files with 76 additions and 123 deletions

View File

@@ -416,29 +416,3 @@
│ Scope : local │ Scope : local
│ Dragging : 0 │ Dragging : 0
│ Disable release event after dragging: 0 │ Disable release event after dragging: 0
│ @@ -592,15 +563,24 @@
│ spstr strCommand.txt,tIcon1.txt,"~",17
│ spstr strCommand.txt,tTmp.txt,"~",18
│ covx tTmp.txt,tIcon1.pco,0,0
│ //statusIcon2
│ spstr strCommand.txt,tIcon2.txt,"~",19
│ spstr strCommand.txt,tTmp.txt,"~",20
│ covx tTmp.txt,tIcon2.pco,0,0
│ - click m0,1
│ + spstr strCommand.txt,tTmp.txt,"~",21
│ + if(tTmp.txt!="")
│ + {
│ + tIcon1.font=3
│ + }
│ + spstr strCommand.txt,tTmp.txt,"~",22
│ + if(tTmp.txt!="")
│ + {
│ + tIcon1.font=3
│ + }
│ }
│ if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
│ {
│ spstr strCommand.txt,tTmp.txt,"~",1
│ covx tTmp.txt,tTime.bco,0,0
│ if(tTime.bco!=screensaver.bco)
│ {

View File

@@ -22,6 +22,10 @@ popupNotify
19 Component(s) 19 Component(s)
257 Line(s) of event code 257 Line(s) of event code
166 Unique line(s) of event code 166 Unique line(s) of event code
screensaver
45 Component(s)
410 Line(s) of event code
298 Unique line(s) of event code
popupLight popupLight
28 Component(s) 28 Component(s)
408 Line(s) of event code 408 Line(s) of event code
@@ -70,13 +74,9 @@ cardGrid
42 Component(s) 42 Component(s)
514 Line(s) of event code 514 Line(s) of event code
293 Unique line(s) of event code 293 Unique line(s) of event code
screensaver
45 Component(s)
410 Line(s) of event code
297 Unique line(s) of event code
Total Total
18 Page(s) 18 Page(s)
626 Component(s) 626 Component(s)
7881 Line(s) of event code 7881 Line(s) of event code
1987 Unique line(s) of event code 1988 Unique line(s) of event code

View File

@@ -1147,7 +1147,7 @@ Timer tmSerial
spstr strCommand.txt,tTmp.txt,"~",22 spstr strCommand.txt,tTmp.txt,"~",22
if(tTmp.txt!="") if(tTmp.txt!="")
{ {
tIcon1.font=3 tIcon2.font=3
} }
} }
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="") if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")

View File

@@ -575,7 +575,7 @@ Timer tmSerial
spstr strCommand.txt,tTmp.txt,"~",22 spstr strCommand.txt,tTmp.txt,"~",22
if(tTmp.txt!="") if(tTmp.txt!="")
{ {
tIcon1.font=3 tIcon2.font=3
} }
} }
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="") if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")

View File

@@ -1197,29 +1197,3 @@
│ Disable release event after dragging: 0 │ Disable release event after dragging: 0
│ Send Component ID : disabled │ Send Component ID : disabled
│ Associated Keyboard : none │ Associated Keyboard : none
│ @@ -592,15 +563,24 @@
│ spstr strCommand.txt,tIcon1.txt,"~",17
│ spstr strCommand.txt,tTmp.txt,"~",18
│ covx tTmp.txt,tIcon1.pco,0,0
│ //statusIcon2
│ spstr strCommand.txt,tIcon2.txt,"~",19
│ spstr strCommand.txt,tTmp.txt,"~",20
│ covx tTmp.txt,tIcon2.pco,0,0
│ - click m0,1
│ + spstr strCommand.txt,tTmp.txt,"~",21
│ + if(tTmp.txt!="")
│ + {
│ + tIcon1.font=3
│ + }
│ + spstr strCommand.txt,tTmp.txt,"~",22
│ + if(tTmp.txt!="")
│ + {
│ + tIcon1.font=3
│ + }
│ }
│ if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
│ {
│ spstr strCommand.txt,tTmp.txt,"~",1
│ covx tTmp.txt,tTime.bco,0,0
│ if(tTime.bco!=screensaver.bco)
│ {

View File

@@ -1,4 +1,4 @@
+++ /dev/fd/62 2022-12-14 22:34:40.980601919 +0000 +++ /dev/fd/62 2022-12-14 23:02:23.381717287 +0000
+I/n2t-out/Program.s.txt +I/n2t-out/Program.s.txt
++ HMI/US/portrait/n2t-out/Program.s.txt ++ HMI/US/portrait/n2t-out/Program.s.txt
+I/n2t-out/cardChart.txt +I/n2t-out/cardChart.txt
@@ -553,29 +553,3 @@
+ Disable release event after dragging: 0 + Disable release event after dragging: 0
+ Send Component ID : disabled + Send Component ID : disabled
+ Associated Keyboard : none + Associated Keyboard : none
+15 +563,24 @@
+ spstr strCommand.txt,tIcon1.txt,"~",17
+ spstr strCommand.txt,tTmp.txt,"~",18
+ covx tTmp.txt,tIcon1.pco,0,0
+ //statusIcon2
+ spstr strCommand.txt,tIcon2.txt,"~",19
+ spstr strCommand.txt,tTmp.txt,"~",20
+ covx tTmp.txt,tIcon2.pco,0,0
+ click m0,1
+ spstr strCommand.txt,tTmp.txt,"~",21
+ if(tTmp.txt!="")
+ {
+ tIcon1.font=3
+ }
+ spstr strCommand.txt,tTmp.txt,"~",22
+ if(tTmp.txt!="")
+ {
+ tIcon1.font=3
+ }
+ }
+ if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
+ {
+ spstr strCommand.txt,tTmp.txt,"~",1
+ covx tTmp.txt,tTime.bco,0,0
+ if(tTime.bco!=screensaver.bco)
+ {

View File

@@ -62,6 +62,10 @@ cardMedia
57 Component(s) 57 Component(s)
660 Line(s) of event code 660 Line(s) of event code
325 Unique line(s) of event code 325 Unique line(s) of event code
screensaver
45 Component(s)
410 Line(s) of event code
298 Unique line(s) of event code
cardQR cardQR
32 Component(s) 32 Component(s)
425 Line(s) of event code 425 Line(s) of event code
@@ -70,13 +74,9 @@ cardEntities
77 Component(s) 77 Component(s)
1395 Line(s) of event code 1395 Line(s) of event code
619 Unique line(s) of event code 619 Unique line(s) of event code
screensaver
45 Component(s)
410 Line(s) of event code
297 Unique line(s) of event code
Total Total
18 Page(s) 18 Page(s)
638 Component(s) 638 Component(s)
8028 Line(s) of event code 8028 Line(s) of event code
2024 Unique line(s) of event code 2025 Unique line(s) of event code

View File

@@ -1147,7 +1147,7 @@ Timer tmSerial
spstr strCommand.txt,tTmp.txt,"~",22 spstr strCommand.txt,tTmp.txt,"~",22
if(tTmp.txt!="") if(tTmp.txt!="")
{ {
tIcon1.font=3 tIcon2.font=3
} }
} }
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="") if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")

View File

@@ -575,7 +575,7 @@ Timer tmSerial
spstr strCommand.txt,tTmp.txt,"~",22 spstr strCommand.txt,tTmp.txt,"~",22
if(tTmp.txt!="") if(tTmp.txt!="")
{ {
tIcon1.font=3 tIcon2.font=3
} }
} }
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="") if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")

View File

@@ -52,8 +52,8 @@ cardPower
299 Unique line(s) of event code 299 Unique line(s) of event code
screensaver screensaver
47 Component(s) 47 Component(s)
409 Line(s) of event code 418 Line(s) of event code
301 Unique line(s) of event code 302 Unique line(s) of event code
cardQR cardQR
32 Component(s) 32 Component(s)
425 Line(s) of event code 425 Line(s) of event code
@@ -78,5 +78,5 @@ cardEntities
Total Total
18 Page(s) 18 Page(s)
635 Component(s) 635 Component(s)
7875 Line(s) of event code 7884 Line(s) of event code
2008 Unique line(s) of event code 2009 Unique line(s) of event code

View File

@@ -626,10 +626,10 @@ Text tIcon1
Disable release event after dragging: 0 Disable release event after dragging: 0
Send Component ID : disabled Send Component ID : disabled
Opacity : 127 Opacity : 127
x coordinate : 3 x coordinate : 1
y coordinate : 0 y coordinate : 0
Width : 85 Width : 85
Height : 40 Height : 48
Effect : load Effect : load
Effect Priority : 0 Effect Priority : 0
Effect Time : 300 Effect Time : 300
@@ -640,7 +640,7 @@ Text tIcon1
Back. Color : 0 Back. Color : 0
Font Color : 17299 Font Color : 17299
Horizontal Alignment : left Horizontal Alignment : left
Vertical Alignment : center Vertical Alignment : top
Input Type : character Input Type : character
Text : Text :
Max. Text Size : 10 Max. Text Size : 10
@@ -659,7 +659,7 @@ Text tIcon2
x coordinate : 365 x coordinate : 365
y coordinate : 0 y coordinate : 0
Width : 85 Width : 85
Height : 40 Height : 48
Effect : load Effect : load
Effect Priority : 0 Effect Priority : 0
Effect Time : 300 Effect Time : 300
@@ -670,7 +670,7 @@ Text tIcon2
Back. Color : 0 Back. Color : 0
Font Color : 17299 Font Color : 17299
Horizontal Alignment : right Horizontal Alignment : right
Vertical Alignment : center Vertical Alignment : top
Input Type : character Input Type : character
Text : Text :
Max. Text Size : 10 Max. Text Size : 10
@@ -1189,7 +1189,16 @@ Timer tmSerial
spstr strCommand.txt,tIcon2.txt,"~",19 spstr strCommand.txt,tIcon2.txt,"~",19
spstr strCommand.txt,tTmp.txt,"~",20 spstr strCommand.txt,tTmp.txt,"~",20
covx tTmp.txt,tIcon2.pco,0,0 covx tTmp.txt,tIcon2.pco,0,0
click m0,1 spstr strCommand.txt,tTmp.txt,"~",21
if(tTmp.txt!="")
{
tIcon1.font=3
}
spstr strCommand.txt,tTmp.txt,"~",22
if(tTmp.txt!="")
{
tIcon2.font=3
}
} }
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="") if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
{ {

View File

@@ -596,7 +596,16 @@ Timer tmSerial
spstr strCommand.txt,tIcon2.txt,"~",19 spstr strCommand.txt,tIcon2.txt,"~",19
spstr strCommand.txt,tTmp.txt,"~",20 spstr strCommand.txt,tTmp.txt,"~",20
covx tTmp.txt,tIcon2.pco,0,0 covx tTmp.txt,tIcon2.pco,0,0
click m0,1 spstr strCommand.txt,tTmp.txt,"~",21
if(tTmp.txt!="")
{
tIcon1.font=3
}
spstr strCommand.txt,tTmp.txt,"~",22
if(tTmp.txt!="")
{
tIcon2.font=3
}
} }
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="") if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
{ {

View File

@@ -116,16 +116,16 @@ sensor_mapping = {
cover_mapping = { cover_mapping = {
#"device_class": ("icon-open", "icon-closed", "icon-cover-open", "icon-cover-stop", "icon-cover-close") #"device_class": ("icon-open", "icon-closed", "icon-cover-open", "icon-cover-stop", "icon-cover-close")
"awning": ("window-open", "window-closed", "arrow-up", "stop", "arrow-down"), "awning": ("window-open", "window-closed", "arrow-up", "stop", "arrow-down"),
"blind": ("blinds-open", "blinds", "arrow-up", "stop", "arrow-down"), "blind": ("blinds-open", "blinds", "arrow-up", "stop", "arrow-down"),
"curtain": ("curtains-closed", "curtains", "arrow-expand-horizontal", "stop", "arrow-collapse-horizontal"), "curtain": ("curtains", "curtains-closed", "arrow-expand-horizontal", "stop", "arrow-collapse-horizontal"),
"damper": ("checkbox-blank-circle", "circle-slice-8", "arrow-up", "stop", "arrow-down"), "damper": ("checkbox-blank-circle", "circle-slice-8", "arrow-up", "stop", "arrow-down"),
"door": ("door-open", "door-closed", "arrow-expand-horizontal", "stop", "arrow-collapse-horizontal"), "door": ("door-open", "door-closed", "arrow-expand-horizontal", "stop", "arrow-collapse-horizontal"),
"garage": ("garage-open", "garage", "arrow-up", "stop", "arrow-down"), "garage": ("garage-open", "garage", "arrow-up", "stop", "arrow-down"),
"gate": ("gate-open", "gate", "arrow-expand-horizontal", "stop", "arrow-collapse-horizontal"), "gate": ("gate-open", "gate", "arrow-expand-horizontal", "stop", "arrow-collapse-horizontal"),
"shade": ("blinds-open", "blinds", "arrow-up", "stop", "arrow-down"), "shade": ("blinds-open", "blinds", "arrow-up", "stop", "arrow-down"),
"shutter": ("window-shutter-open", "window-shutter", "arrow-up", "stop", "arrow-down"), "shutter": ("window-shutter-open", "window-shutter", "arrow-up", "stop", "arrow-down"),
"window": ("window-open", "window-closed", "arrow-up", "stop", "arrow-down"), "window": ("window-open", "window-closed", "arrow-up", "stop", "arrow-down"),
} }
simple_type_mapping = { simple_type_mapping = {
@@ -209,6 +209,12 @@ def get_action_icon(ha_type, action, device_class=None, overwrite=None):
return get_icon_char(actionicon) return get_icon_char(actionicon)
def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None): def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
ha_type = entity_id.split(".")[0]
if (apis.ha_api.entity_exists(entity_id)):
entity = apis.ha_api.get_entity(entity_id)
state = entity.state if stateOverwrite is None else stateOverwrite
if overwrite is not None: if overwrite is not None:
if type(overwrite) is str: if type(overwrite) is str:
return get_icon_char(overwrite) return get_icon_char(overwrite)
@@ -219,10 +225,6 @@ def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
result_icon = "alert-circle-outline" result_icon = "alert-circle-outline"
ha_type = entity_id.split(".")[0]
if (apis.ha_api.entity_exists(entity_id)):
entity = apis.ha_api.get_entity(entity_id)
state = entity.state if stateOverwrite is None else stateOverwrite
# icons only based on state # icons only based on state
if ha_type in simple_type_mapping: if ha_type in simple_type_mapping:
result_icon = simple_type_mapping[ha_type] result_icon = simple_type_mapping[ha_type]
@@ -267,4 +269,4 @@ def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
if entity.attributes.media_content_type in media_content_type_mapping: if entity.attributes.media_content_type in media_content_type_mapping:
result_icon = media_content_type_mapping[entity.attributes.media_content_type] result_icon = media_content_type_mapping[entity.attributes.media_content_type]
return get_icon_char(result_icon) return get_icon_char(result_icon)

View File

@@ -186,7 +186,7 @@ class LuiPagesGen(object):
icon = statusIcon.get("icon") icon = statusIcon.get("icon")
entity = apis.ha_api.get_entity(statusIcon.get("entity")) entity = apis.ha_api.get_entity(statusIcon.get("entity"))
entityType = statusIcon.get("entity").split(".")[0] entityType = statusIcon.get("entity").split(".")[0]
icon = get_icon(entityType, state=entity.state, device_class=entity.attributes.get("device_class", ""), overwrite=icon) icon = get_icon_ha(statusIcon.get("entity"), overwrite=icon)
color = self.get_entity_color(entity, ha_type=entityType, overwrite=statusIcon.get("color", None)) color = self.get_entity_color(entity, ha_type=entityType, overwrite=statusIcon.get("color", None))
status_res += f"~{icon}~{color}" status_res += f"~{icon}~{color}"
altfont += f'~{statusIcon.get("altFont", "")}' altfont += f'~{statusIcon.get("altFont", "")}'

View File

@@ -44,6 +44,10 @@ US Version Landscape: `FlashNextion http://nspanel.pky.eu/lui-us-l-release.tft`
After sending the command, the screen should show a progress bar. The flashing progress takes around 5 minutes. After sending the command, the screen should show a progress bar. The flashing progress takes around 5 minutes.
> ⚠️: **If you are getting an error message with `[bytes('8080808080808080808080000` please try to downgrade tasmota to 12.2.0 (http://ota.tasmota.com/tasmota32/release-12.2.0/tasmota32-nspanel.bin).
>
> Please leave a comment on the following issue in both cases (working or not), since this isn't reproducable at the moment :/ https://github.com/joBr99/nspanel-lovelace-ui/issues/601**
Note: For the US Version Users - keep in mind that you need to add the model config option to your apps.yaml later, more details on config overview page Note: For the US Version Users - keep in mind that you need to add the model config option to your apps.yaml later, more details on config overview page

View File

@@ -46,6 +46,8 @@ Nextion Upload Proto 1.2 with 256000 Baud: `FlashNextionAdv4 http://nspanel.pky.
Nextion Upload Proto 1.1 with 256000 Baud: `FlashNextionAdv5 http://nspanel.pky.eu/lui.tft` Nextion Upload Proto 1.1 with 256000 Baud: `FlashNextionAdv5 http://nspanel.pky.eu/lui.tft`
Nextion Upload Proto 1.1 with 921600 Baud and communication init on 9600 Baud: `FlashNextionAdv6 http://nspanel.pky.eu/lui.tft`
Besides the commands, serial input will be published on 'RESULT' Topic, depending on the input in one of the following formats: Besides the commands, serial input will be published on 'RESULT' Topic, depending on the input in one of the following formats:
- `{"CustomRecv":%s}` - `{"CustomRecv":%s}`

View File

@@ -361,8 +361,8 @@ tasmota.add_cmd('UpdateDriverVersion', update_berry_driver)
def flash_nextion(cmd, idx, payload, payload_json) def flash_nextion(cmd, idx, payload, payload_json)
def task() def task()
nextion.flash_proto_version = 1 nextion.flash_proto_version = 1
nextion.flash_proto_baud = 921600 nextion.flash_proto_baud = 921600
nextion.flash_nextion(payload) nextion.flash_nextion(payload)
end end
tasmota.set_timer(0,task) tasmota.set_timer(0,task)
@@ -389,8 +389,13 @@ def flash_nextion_adv(cmd, idx, payload, payload_json)
elif idx==5 elif idx==5
nextion.flash_proto_version = 0 nextion.flash_proto_version = 0
nextion.flash_proto_baud = 256000 nextion.flash_proto_baud = 256000
elif idx==6
nextion.ser.deinit()
nextion.ser = serial(17, 16, 9600, serial.SERIAL_8N1)
nextion.flash_proto_version = 0
nextion.flash_proto_baud = 921600
else else
nextion.flash_proto_version = 0 nextion.flash_proto_version = 0
nextion.flash_proto_baud = 115200 nextion.flash_proto_baud = 115200
end end