diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 6ab4944..04d507d 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -5501,10 +5501,10 @@ variables: color_rgb: "on": "" # NOT IN USE "off": "" # NOT IN USE - - icon: !input 'home_button04_icon' #E1ED - color_rgb: - "on": !input 'home_button04_icon_color01' - "off": !input 'home_button04_icon_color02' + #- icon: !input 'home_button04_icon' #E1ED + # color_rgb: + # "on": !input 'home_button04_icon_color01' + # "off": !input 'home_button04_icon_color02' #- icon: !input 'home_button05_icon' #E432 # color_rgb: # "on": !input 'home_button05_icon_color' @@ -6960,22 +6960,27 @@ action: notification_unread_state: '{{ states(notification_unread) | default("unavailable") if notification_unread is string else "unavailable" }}' - condition: '{{ notification_unread_state in ["on", "off"] }}' - variables: + bt_notific: + icon: !input 'home_button04_icon' #E1ED + color_rgb: + "on": !input 'home_button04_icon_color01' + "off": !input 'home_button04_icon_color02' notification_text_state: '{{ states(notification_text) | default(None) if notification_text is string else None }}' set_button04_icon: > {{ - all_icons[page_home.buttons[3].icon.split(":")[1]] | default(page_home.buttons[3].icon if page_home.buttons[3].icon is string else all_icons.unknown) + all_icons[bt_notific.icon.split(":")[1]] | default(bt_notific.icon if bt_notific.icon is string else all_icons.unknown) if notification_unread_state == "on" and notification_text_state | length > 0 else all_icons.blank }} set_button04_icon_font: > {{ ( - page_home.buttons[3].color_rgb[notification_unread_state] - if is_number(page_home.buttons[3].color_rgb[notification_unread_state]) + bt_notific.color_rgb[notification_unread_state] + if is_number(bt_notific.color_rgb[notification_unread_state]) else - ((page_home.buttons[3].color_rgb[notification_unread_state][0] //(2**3)) *(2**11))+ - ((page_home.buttons[3].color_rgb[notification_unread_state][1] //(2**2)) *(2**5))+ - (page_home.buttons[3].color_rgb[notification_unread_state][2] //(2**3)) + ((bt_notific.color_rgb[notification_unread_state][0] //(2**3)) *(2**11))+ + ((bt_notific.color_rgb[notification_unread_state][1] //(2**2)) *(2**5))+ + (bt_notific.color_rgb[notification_unread_state][2] //(2**3)) ) if notification_unread_state in ["on", "off"] and notification_text_state | length > 0 else nextion.color.grey_light @@ -6984,7 +6989,7 @@ action: - *delay-default - service: '{{ nextion.command.text_printf }}' data: - component: home.button04_icon + component: home.bt_notific message: '{{ set_button04_icon }}' continue_on_error: true @@ -6992,10 +6997,21 @@ action: - *delay-default - service: '{{ nextion.command.font_color }}' data: - component: home.button04_icon + component: home.bt_notific message: '{{ set_button04_icon_font }}' continue_on_error: true + ##### Show/Hide notification button ##### + - *delay-default + - service: '{{ nextion.command.printf }}' + data: + cmd: is_notification={{ 1 if notification_unread_state == "on" and notification_text_state | length > 0 and set_button04_icon != all_icons.blank else 0 }} + continue_on_error: true + #- service: '{{ nextion.command.show if notification_unread_state == "on" and notification_text_state | length > 0 and set_button04_icon != all_icons.blank else nextion.command.hide }}' + # data: + # component: home.bt_notific + # continue_on_error: true + ## BUTTON PAGES 01 - 04 ## - alias: Button pages conditions: '{{ nspanel_event.page in page.buttonpages }}' @@ -8716,16 +8732,16 @@ action: back_page: '{{ page.home }}' continue_on_error: true - - alias: Jump to notification page - conditions: - - '{{ nspanel_event.page == page.home }}' - - '{{ nspanel_event.component == "button04" }}' - - '{{ notification_text is string and states(notification_text) | length > 0 }}' - sequence: - - service: '{{ nextion.command.printf }}' - data: - cmd: 'page {{ page.notification }}' - continue_on_error: true + #- alias: Jump to notification page + # conditions: + # - '{{ nspanel_event.page == page.home }}' + # - '{{ nspanel_event.component == "button04" }}' + # - '{{ notification_text is string and states(notification_text) | length > 0 }}' + # sequence: + # - service: '{{ nextion.command.printf }}' + # data: + # cmd: 'page {{ page.notification }}' + # continue_on_error: true - alias: Show button - Notification clear conditions: diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index 1466346..283f1b1 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -234,6 +234,7 @@ api: - wait_until: binary_sensor.is_on: nextion_init - lambda: |- + id(disp1).send_command_printf("is_notification=1"); id(disp1).send_command_printf("page notification"); id(disp1).set_component_text_printf("notification.notifi_label", "%s", label.c_str()); id(disp1).set_component_text_printf("notification.notifi_text01", "%s", text.c_str()); @@ -253,6 +254,7 @@ api: - wait_until: binary_sensor.is_on: nextion_init - lambda: |- + id(disp1).send_command_printf("is_notification=0"); id(notification_label).publish_state(""); id(notification_text).publish_state(""); - switch.turn_off: notification_unread diff --git a/nspanel_eu.HMI b/nspanel_eu.HMI index a06be5b..5403924 100644 Binary files a/nspanel_eu.HMI and b/nspanel_eu.HMI differ diff --git a/nspanel_eu.tft b/nspanel_eu.tft index 0dc6433..f4aa8f4 100644 Binary files a/nspanel_eu.tft and b/nspanel_eu.tft differ diff --git a/nspanel_eu_code/Program.s.txt b/nspanel_eu_code/Program.s.txt index 903a6ce..0f19db6 100644 --- a/nspanel_eu_code/Program.s.txt +++ b/nspanel_eu_code/Program.s.txt @@ -5,7 +5,7 @@ Program.s int h=0,s=0,v=0 int p=0,q=0,t=0,f=0 int api=0 // 0 = disconnected from HA, 1 = connected to HA - int is_alarm=0,is_entities=0,is_qrcode=0 + int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0 bauds=115200//Configure baudrat recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port diff --git a/nspanel_eu_code/home.txt b/nspanel_eu_code/home.txt index 7778f55..710608c 100644 --- a/nspanel_eu_code/home.txt +++ b/nspanel_eu_code/home.txt @@ -21,9 +21,10 @@ Page home prints "{\"page\": \"home\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 printh 00 printh FF FF FF + vis bt_notific,is_notification + vis bt_qrcode,is_qrcode vis bt_entities,is_entities vis bt_alarm,is_alarm - vis bt_qrcode,is_qrcode Variable (int32) brightness Attributes @@ -51,14 +52,14 @@ Variable (int32) sleepmodus Variable (string) lastclick Attributes - ID : 51 + ID : 50 Scope : local Text : Max. Text Size: 100 Variable (string) entity Attributes - ID : 52 + ID : 51 Scope : global Text : Max. Text Size: 100 @@ -333,7 +334,7 @@ Text button03_icon Text : Max. Text Size : 10 -Text button04_icon +Text bt_notific Attributes ID : 41 Scope : global @@ -343,6 +344,13 @@ Text button04_icon Text : Max. Text Size : 10 + Events + Touch Release Event + if(api==1) + { + page notification + } + Text bt_qrcode Attributes ID : 42 @@ -394,7 +402,7 @@ Text bt_alarm Text meridiem Attributes - ID : 50 + ID : 49 Scope : global Dragging : 0 Send Component ID : disabled @@ -526,26 +534,9 @@ Hotspot button03 printh 00 printh FF FF FF -Hotspot button04 - Attributes - ID : 48 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button04\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - Hotspot settings_click Attributes - ID : 49 + ID : 48 Scope : local Dragging : 0 Send Component ID: disabled @@ -601,7 +592,7 @@ Timer sleeptimer Timer settings_timer Attributes - ID : 53 + ID : 52 Scope : local Period (ms): 1000 Enabled : no diff --git a/nspanel_us.HMI b/nspanel_us.HMI index 58d92c1..fe0f7f6 100644 Binary files a/nspanel_us.HMI and b/nspanel_us.HMI differ diff --git a/nspanel_us.tft b/nspanel_us.tft index 3c16bf5..66a5509 100644 Binary files a/nspanel_us.tft and b/nspanel_us.tft differ diff --git a/nspanel_us_code/Program.s.txt b/nspanel_us_code/Program.s.txt index 15d58dd..379172e 100644 --- a/nspanel_us_code/Program.s.txt +++ b/nspanel_us_code/Program.s.txt @@ -5,7 +5,7 @@ Program.s int h=0,s=0,v=0 int p=0,q=0,t=0,f=0 int api=0 // 0 = disconnected from HA, 1 = connected to HA - int is_alarm=0,is_entities=0,is_qrcode=0 + int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0 bauds=115200//Configure baudrat recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port diff --git a/nspanel_us_code/home.txt b/nspanel_us_code/home.txt index 6b13ea0..8eaf163 100644 --- a/nspanel_us_code/home.txt +++ b/nspanel_us_code/home.txt @@ -21,9 +21,10 @@ Page home prints "{\"page\": \"home\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 printh 00 printh FF FF FF + vis bt_notific,is_notification + vis bt_qrcode,is_qrcode vis bt_entities,is_entities vis bt_alarm,is_alarm - vis bt_qrcode,is_qrcode Variable (int32) brightness Attributes @@ -51,14 +52,14 @@ Variable (int32) sleepmodus Variable (string) lastclick Attributes - ID : 51 + ID : 50 Scope : local Text : Max. Text Size: 100 Variable (string) entity Attributes - ID : 52 + ID : 51 Scope : global Text : Max. Text Size: 100 @@ -333,7 +334,7 @@ Text button03_icon Text : Max. Text Size : 10 -Text button04_icon +Text bt_notific Attributes ID : 41 Scope : global @@ -343,6 +344,13 @@ Text button04_icon Text : Max. Text Size : 10 + Events + Touch Release Event + if(api==1) + { + page notification + } + Text bt_qrcode Attributes ID : 42 @@ -394,7 +402,7 @@ Text bt_alarm Text meridiem Attributes - ID : 50 + ID : 49 Scope : global Dragging : 0 Send Component ID : disabled @@ -526,26 +534,9 @@ Hotspot button03 printh 00 printh FF FF FF -Hotspot button04 - Attributes - ID : 48 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button04\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - Hotspot settings_click Attributes - ID : 49 + ID : 48 Scope : local Dragging : 0 Send Component ID: disabled @@ -601,7 +592,7 @@ Timer sleeptimer Timer settings_timer Attributes - ID : 53 + ID : 52 Scope : local Period (ms): 1000 Enabled : no diff --git a/nspanel_us_land.HMI b/nspanel_us_land.HMI index d84a3af..ee27daf 100644 Binary files a/nspanel_us_land.HMI and b/nspanel_us_land.HMI differ diff --git a/nspanel_us_land.tft b/nspanel_us_land.tft index e314874..b3b9ce9 100644 Binary files a/nspanel_us_land.tft and b/nspanel_us_land.tft differ diff --git a/nspanel_us_land_code/Program.s.txt b/nspanel_us_land_code/Program.s.txt index 41c7fc5..deb5261 100644 --- a/nspanel_us_land_code/Program.s.txt +++ b/nspanel_us_land_code/Program.s.txt @@ -5,7 +5,7 @@ Program.s int h=0,s=0,v=0 int p=0,q=0,t=0,f=0 int api=0 // 0 = disconnected from HA, 1 = connected to HA - int is_alarm=0,is_entities=0,is_qrcode=0 + int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0 bauds=115200//Configure baudrat recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port diff --git a/nspanel_us_land_code/home.txt b/nspanel_us_land_code/home.txt index 438873d..fbf0d89 100644 --- a/nspanel_us_land_code/home.txt +++ b/nspanel_us_land_code/home.txt @@ -21,9 +21,10 @@ Page home prints "{\"page\": \"home\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 printh 00 printh FF FF FF + vis bt_notific,is_notification + vis bt_qrcode,is_qrcode vis bt_entities,is_entities vis bt_alarm,is_alarm - vis bt_qrcode,is_qrcode vis left_bt_text,0 vis right_bt_text,0 @@ -53,14 +54,14 @@ Variable (int32) sleepmodus Variable (string) lastclick Attributes - ID : 51 + ID : 50 Scope : local Text : Max. Text Size: 100 Variable (string) entity Attributes - ID : 52 + ID : 51 Scope : global Text : Max. Text Size: 100 @@ -335,7 +336,7 @@ Text button03_icon Text : Max. Text Size : 10 -Text button04_icon +Text bt_notific Attributes ID : 41 Scope : global @@ -345,6 +346,13 @@ Text button04_icon Text : Max. Text Size : 10 + Events + Touch Release Event + if(api==1) + { + page notification + } + Text bt_qrcode Attributes ID : 42 @@ -396,7 +404,7 @@ Text bt_alarm Text meridiem Attributes - ID : 50 + ID : 49 Scope : global Dragging : 0 Send Component ID : disabled @@ -528,26 +536,9 @@ Hotspot button03 printh 00 printh FF FF FF -Hotspot button04 - Attributes - ID : 48 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button04\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - Hotspot settings_click Attributes - ID : 49 + ID : 48 Scope : local Dragging : 0 Send Component ID: disabled @@ -603,7 +594,7 @@ Timer sleeptimer Timer settings_timer Attributes - ID : 53 + ID : 52 Scope : local Period (ms): 1000 Enabled : no