diff --git a/docs/api.md b/docs/api.md index e2b2ddb..1ba92a5 100644 --- a/docs/api.md +++ b/docs/api.md @@ -403,11 +403,6 @@ It accommodates extensive customizations, impacting both visual appeal and funct - `meridiem` (string[]): Array of strings for AM/PM labels, applicable if the time format includes meridiem. - `chip_font` (int): Font Id for icons or chips displayed on the "Home" page. - `custom_buttons_font` (int): Font Id for custom button icons on the "Home" page. -- `notification_icon` (string): -Icon codepoint from [HASwitchPlate Material Design Icons](https://htmlpreview.github.io/?https://github.com/jobr99/Generate-HASP-Fonts/blob/master/cheatsheet.html) -for the notification button. -- `notification_icon_color_normal` (int[]): RGB color array for the notification icon under normal conditions. -- `notification_icon_color_unread` (int[]): RGB color array for the notification icon when there are unread notifications. - `qrcode` (bool): Flag indicating whether the QR code button is enabled. - `qrcode_icon` (string): Icon codepoint from [HASwitchPlate Material Design Icons](https://htmlpreview.github.io/?https://github.com/jobr99/Generate-HASP-Fonts/blob/master/cheatsheet.html) @@ -434,9 +429,6 @@ data: meridiem: ["AM", "PM"] chip_font: 8 custom_buttons_font: 9 - notification_icon: "\uE1ED" # Example for mdi:email - notification_icon_color_normal: [255, 255, 255] # White - notification_icon_color_unread: [255, 0, 0] # Red qrcode: true qrcode_icon: "\uE432" # Example for mdi:qrcode-scan qrcode_icon_color: [0, 255, 0] # Green diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index 97b60c5..46d4a6a 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -18,7 +18,7 @@ substitutions: temp_units: "°C" invalid_cooldown: "100ms" ##### DON'T CHANGE THIS ###### - version: "4.3dev3" + version: "4.3dev4" ############################## ##### External components ##### @@ -66,6 +66,9 @@ esphome: } } device_name->publish_state(result.c_str()); + notification_label->publish_state(""); + notification_text->publish_state(""); + notification_unread->turn_off(); - script.execute: restore_settings - wait_until: condition: @@ -411,9 +414,6 @@ api: meridiem: string[] # Optional array for AM/PM labels if included in time format. chip_font: int # Font Id for chip icons displayed on the "Home" page. custom_buttons_font: int # Font Id for icons on custom buttons. - notification_icon: string # Icon codepoint for the notification button, sourced from HASwitchPlate Material Design Icons. - notification_icon_color_normal: int[] # RGB color array for normal notification icon state. - notification_icon_color_unread: int[] # RGB color array for unread notifications state. qrcode: bool # Enable/disable flag for QR code button display. qrcode_icon: string # Icon codepoint for QR code button, sourced from HASwitchPlate Material Design Icons. qrcode_icon_color: int[] # RGB color array for QR code button icon. @@ -461,19 +461,8 @@ api: // Outdoor temperature font size disp1->send_command_printf("home.outdoor_temp.font==%" PRIi32, outdoor_temp_font); - // Notification button - disp1->send_command_printf("is_notification=%i", (notification_text->state.empty() and notification_label->state.empty()) ? 0 : 1); - disp1->set_component_text_printf("home.bt_notific", "%s", notification_icon.c_str()); - id(home_notify_icon_color_normal) = esphome::display::ColorUtil::color_to_565(esphome::Color(notification_icon_color_normal[0], - notification_icon_color_normal[1], - notification_icon_color_normal[2])); - id(home_notify_icon_color_unread) = esphome::display::ColorUtil::color_to_565(esphome::Color(notification_icon_color_unread[0], - notification_icon_color_unread[1], - notification_icon_color_unread[2])); - disp1->set_component_font_color("home.bt_notific", notification_unread->state ? id(home_notify_icon_color_unread) : id(home_notify_icon_color_normal)); - // QRCode button - disp1->send_command_printf("is_qrcode=%i", qrcode ? 1 : 0); + set_component_visibility->execute("home.bt_qrcode", qrcode); disp1->set_component_text_printf("home.bt_qrcode", "%s", qrcode_icon.c_str()); disp1->set_component_font_color("home.bt_qrcode", esphome::display::ColorUtil::color_to_565(esphome::Color(qrcode_icon_color[0], qrcode_icon_color[1], qrcode_icon_color[2]))); @@ -513,7 +502,10 @@ api: # This service removes any displayed notifications from the screen, helping to keep the user interface clean and focused on its primary functions. - service: notification_clear then: - - script.execute: notification_clear + - lambda: |- + notification_label->publish_state(""); + notification_text->publish_state(""); + notification_unread->turn_off(); # Displays a notification message on the screen, useful for alerts or informational updates. - service: notification_show @@ -533,7 +525,6 @@ api: notification_label->publish_state(label.c_str()); notification_text->publish_state(message.c_str()); timer_reset_all->execute(current_page->state.c_str()); - refresh_notification->execute(); notification_unread->turn_on(); if (notification_sound->state) buzzer->play("two short:d=4,o=5,b=100:16e6,16e6"); } @@ -881,11 +872,6 @@ display: ##### START - GLOBALS CONFIGURATION ##### globals: - - id: mui_decimal_separator - type: char - restore_value: true - initial_value: "'.'" - ###### Buttons settings ###### # Bit # Settings # # 0 # Left Bt - Enabled # @@ -932,6 +918,23 @@ globals: type: uint8_t restore_value: true initial_value: '0' + ##### Relay icons ##### + - id: home_relay1_icon + type: char[4] + restore_value: true + initial_value: '' + - id: home_relay1_icon_color + type: uint16_t + restore_value: true + initial_value: '65535' + - id: home_relay2_icon + type: char[4] + restore_value: true + initial_value: '' + - id: home_relay2_icon_color + type: uint16_t + restore_value: true + initial_value: '65535' ##### Versioning ##### - id: version_blueprint @@ -951,24 +954,24 @@ globals: restore_value: false initial_value: 'false' + ##### Media Player ##### ###### Last volume level from Home Assistant ###### - id: last_volume_level type: uint8_t restore_value: false initial_value: '0' - ###### Last duration from Home Assistant ###### - id: last_media_duration type: uint restore_value: false initial_value: '0' - ###### Last duration from Home Assistant ###### - id: last_media_position type: uint restore_value: false initial_value: '0' + ##### Add-on Climate ##### ##### Is embedded thermostat set as main climate entity? ##### - id: is_embedded_thermostat type: bool @@ -1000,7 +1003,7 @@ globals: restore_value: false initial_value: '{"AM", "PM"}' - #### MUI strings #### + #### Localization (MUI) #### - id: mui_please_confirm_global type: std::string restore_value: true @@ -1009,6 +1012,10 @@ globals: type: std::string restore_value: true initial_value: '"Unavailable"' + - id: mui_decimal_separator + type: char + restore_value: true + initial_value: "'.'" ##### Chips ##### - id: home_chip_font_id @@ -1022,32 +1029,6 @@ globals: restore_value: true initial_value: '8' - ##### Relay icons ##### - - id: home_relay1_icon - type: char[4] - restore_value: true - initial_value: '' - - id: home_relay1_icon_color - type: uint16_t - restore_value: true - initial_value: '65535' - - - id: home_relay2_icon - type: char[4] - restore_value: true - initial_value: '' - - id: home_relay2_icon_color - type: uint16_t - restore_value: true - initial_value: '65535' - - - id: home_notify_icon_color_normal - type: uint16_t - restore_value: false - - id: home_notify_icon_color_unread - type: uint16_t - restore_value: false - ##### Screensaver ##### - id: screensaver_display_time type: bool @@ -1560,16 +1541,6 @@ switch: entity_category: config optimistic: true restore_mode: ALWAYS_OFF - on_turn_on: - - wait_until: - condition: - - lambda: !lambda return (blueprint_status->state > 99); - - lambda: disp1->set_component_font_color("home.bt_notific", id(home_notify_icon_color_unread)); - on_turn_off: - - wait_until: - condition: - - lambda: !lambda return (blueprint_status->state > 99); - - lambda: disp1->set_component_font_color("home.bt_notific", id(home_notify_icon_color_normal)); ##### Notification sound ##### - name: Notification sound @@ -1632,8 +1603,8 @@ switch: ##### START - TEXT SENSOR CONFIGURATION ##### text_sensor: ##### Device name - Used by bluepring to find service's names ##### - - name: Device Name - id: device_name + - id: device_name + name: Device Name platform: template icon: mdi:identifier entity_category: diagnostic @@ -1641,34 +1612,34 @@ text_sensor: disabled_by_default: false ##### Entity Id of the entity displayed on the detailed pages - - name: Detailed Entity - id: detailed_entity + - id: detailed_entity + name: Detailed Entity platform: template icon: mdi:tablet-dashboard internal: false disabled_by_default: false ##### Current page name ##### - - name: Current Page - id: current_page + - id: current_page + name: Current Page platform: template icon: mdi:tablet-dashboard internal: false disabled_by_default: false - - name: Notification Label + - id: notification_label + name: Notification Label platform: template - id: notification_label - - - name: Notification Text + + - id: notification_text + name: Notification Text platform: template - id: notification_text - + ##### NSPanel event sensor, the main action sensor - push to HA ##### - - name: NSPanel event + - id: disp1_nspanel_event + name: NSPanel event platform: nextion nextion_id: disp1 - id: disp1_nspanel_event component_name: nspanelevent internal: true filters: @@ -1702,10 +1673,10 @@ text_sensor: ESP_LOGE("text_sensor.nspanelevent", " Entity: %s", entity.c_str()); ##### NSPanel event - Execute actions from ESPHome - NO push to HA ##### - - name: NSPanel local event + - id: disp1_local_event + name: NSPanel local event platform: nextion nextion_id: disp1 - id: disp1_local_event component_name: localevent internal: true filters: @@ -2051,18 +2022,6 @@ script: id(embedded_indoor_temp) = embedded_indoor_temperature; display_embedded_temp->execute(); - - id: notification_clear - mode: restart - then: - - lambda: |- - if (!id(is_uploading_tft)) { - notification_label->publish_state(""); - notification_text->publish_state(""); - notification_unread->turn_off(); - refresh_notification->execute(); - if (current_page->state == "notification") goto_page->execute("home"); - } - - id: page_alarm mode: restart then: # There's nothing here so far @@ -2265,7 +2224,6 @@ script: then: - script.execute: refresh_relays - script.execute: refresh_wifi_icon - - script.execute: refresh_notification - id: page_keyb_num mode: restart @@ -2425,22 +2383,6 @@ script: } } - - id: refresh_notification - mode: restart - then: - - wait_until: - condition: - - lambda: !lambda return id(setup_sequence_completed); - - lambda: |- - bool is_notification = ((not notification_text->state.empty()) or (not notification_label->state.empty())); - disp1->send_command_printf("is_notification=%i", is_notification ? 1 : 0); - set_component_visibility->execute("home.bt_notific", is_notification); - - wait_until: - condition: - - lambda: return (blueprint_status->state > 99); - - lambda: |- - disp1->set_component_font_color("home.bt_notific", notification_unread->state ? id(home_notify_icon_color_unread) : id(home_notify_icon_color_normal)); - - id: refresh_relays mode: restart then: @@ -2742,7 +2684,6 @@ script: disp1->set_component_font_color("home.chip_relay1", id(home_relay1_icon_color)); disp1->set_component_font_color("home.chip_relay2", id(home_relay2_icon_color)); timer_reset_all->execute("boot"); - notification_clear->execute(); id(setup_sequence_completed) = true; - wait_until: condition: @@ -2767,7 +2708,6 @@ script: ha_button->stop(); ha_call_service->stop(); init_hardware_climate->stop(); - notification_clear->stop(); page_alarm->stop(); page_blank->stop(); page_boot->stop(); diff --git a/hmi/dev/nspanel_eu_code/Program.s.txt b/hmi/dev/nspanel_eu_code/Program.s.txt index f349afd..b8d5912 100644 --- a/hmi/dev/nspanel_eu_code/Program.s.txt +++ b/hmi/dev/nspanel_eu_code/Program.s.txt @@ -9,7 +9,7 @@ Program.s int back_page_id=0 int dimdelta=0 int api=0 // 0 = disconnected from HA, 1 = connected to HA - int is_qrcode=0,is_notification=0,is_utilities=0 + int is_utilities=0 int brightness=100,brightness_dim=40,brightness_sleep=0 int display_mode=1 // 1 = EU, 2 = US, 3 = US landscape, 4 = blank int charset=1 // 1 = International (original), 2 = CJK diff --git a/hmi/dev/nspanel_eu_code/alarm.txt b/hmi/dev/nspanel_eu_code/alarm.txt index d4778be..9bb1c6a 100644 --- a/hmi/dev/nspanel_eu_code/alarm.txt +++ b/hmi/dev/nspanel_eu_code/alarm.txt @@ -24,8 +24,6 @@ Page alarm vis bt_bypass,0 } vis unavailable,0 - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_eu_code/boot.txt b/hmi/dev/nspanel_eu_code/boot.txt index 17a8d9f..6d97bca 100644 --- a/hmi/dev/nspanel_eu_code/boot.txt +++ b/hmi/dev/nspanel_eu_code/boot.txt @@ -16,8 +16,6 @@ Page boot covx baud,baud_rate.txt,0,0 baud_rate.txt+=" bps" vis unavailable,0 - - Postinitialize Event sendme Page Exit Event @@ -103,7 +101,7 @@ Text tft_version Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text : 4.3dev3 + Text : 4.3dev4 Max. Text Size : 9 Text esph_version diff --git a/hmi/dev/nspanel_eu_code/buttonpage01.txt b/hmi/dev/nspanel_eu_code/buttonpage01.txt index 2026b19..0b5acd8 100644 --- a/hmi/dev/nspanel_eu_code/buttonpage01.txt +++ b/hmi/dev/nspanel_eu_code/buttonpage01.txt @@ -35,8 +35,6 @@ Page buttonpage01 } vis page_index,1 } - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_eu_code/buttonpage02.txt b/hmi/dev/nspanel_eu_code/buttonpage02.txt index 3d479dc..eed659f 100644 --- a/hmi/dev/nspanel_eu_code/buttonpage02.txt +++ b/hmi/dev/nspanel_eu_code/buttonpage02.txt @@ -35,8 +35,6 @@ Page buttonpage02 } vis page_index,1 } - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_eu_code/buttonpage03.txt b/hmi/dev/nspanel_eu_code/buttonpage03.txt index ed1c1f0..17f7232 100644 --- a/hmi/dev/nspanel_eu_code/buttonpage03.txt +++ b/hmi/dev/nspanel_eu_code/buttonpage03.txt @@ -35,8 +35,6 @@ Page buttonpage03 } vis page_index,1 } - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_eu_code/buttonpage04.txt b/hmi/dev/nspanel_eu_code/buttonpage04.txt index 088a871..3268c4d 100644 --- a/hmi/dev/nspanel_eu_code/buttonpage04.txt +++ b/hmi/dev/nspanel_eu_code/buttonpage04.txt @@ -35,8 +35,6 @@ Page buttonpage04 page_index.txt+="●" vis page_index,1 } - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_eu_code/climate.txt b/hmi/dev/nspanel_eu_code/climate.txt index c7530e1..e016bb6 100644 --- a/hmi/dev/nspanel_eu_code/climate.txt +++ b/hmi/dev/nspanel_eu_code/climate.txt @@ -33,8 +33,6 @@ Page climate page home } vis unavailable,0 - - Postinitialize Event sendme Page Exit Event diff --git a/hmi/dev/nspanel_eu_code/confirm.txt b/hmi/dev/nspanel_eu_code/confirm.txt index 131e50e..38da546 100644 --- a/hmi/dev/nspanel_eu_code/confirm.txt +++ b/hmi/dev/nspanel_eu_code/confirm.txt @@ -17,8 +17,6 @@ Page confirm page home } vis unavailable,0 - - Postinitialize Event sendme Variable (int32) page_id diff --git a/hmi/dev/nspanel_eu_code/cover.txt b/hmi/dev/nspanel_eu_code/cover.txt index b7afc34..6b74670 100644 --- a/hmi/dev/nspanel_eu_code/cover.txt +++ b/hmi/dev/nspanel_eu_code/cover.txt @@ -17,8 +17,6 @@ Page cover page home } vis unavailable,0 - - Postinitialize Event sendme Variable (string) va1 diff --git a/hmi/dev/nspanel_eu_code/entitypage01.txt b/hmi/dev/nspanel_eu_code/entitypage01.txt index 977a7b4..e4cf268 100644 --- a/hmi/dev/nspanel_eu_code/entitypage01.txt +++ b/hmi/dev/nspanel_eu_code/entitypage01.txt @@ -30,8 +30,6 @@ Page entitypage01 { page_index.txt+="â—‹" } - - Postinitialize Event sendme Text value01_label diff --git a/hmi/dev/nspanel_eu_code/entitypage02.txt b/hmi/dev/nspanel_eu_code/entitypage02.txt index 4b25de6..624506d 100644 --- a/hmi/dev/nspanel_eu_code/entitypage02.txt +++ b/hmi/dev/nspanel_eu_code/entitypage02.txt @@ -30,8 +30,6 @@ Page entitypage02 { page_index.txt+="â—‹" } - - Postinitialize Event sendme Text value01_label diff --git a/hmi/dev/nspanel_eu_code/entitypage03.txt b/hmi/dev/nspanel_eu_code/entitypage03.txt index 38e1097..b2b9ed3 100644 --- a/hmi/dev/nspanel_eu_code/entitypage03.txt +++ b/hmi/dev/nspanel_eu_code/entitypage03.txt @@ -30,8 +30,6 @@ Page entitypage03 { page_index.txt+="â—‹" } - - Postinitialize Event sendme Text value01_label diff --git a/hmi/dev/nspanel_eu_code/entitypage04.txt b/hmi/dev/nspanel_eu_code/entitypage04.txt index a7c0222..5ae4454 100644 --- a/hmi/dev/nspanel_eu_code/entitypage04.txt +++ b/hmi/dev/nspanel_eu_code/entitypage04.txt @@ -30,8 +30,6 @@ Page entitypage04 page_index.txt+="â—‹" } page_index.txt+="●" - - Postinitialize Event sendme Text value01_label diff --git a/hmi/dev/nspanel_eu_code/fan.txt b/hmi/dev/nspanel_eu_code/fan.txt index 80c36db..95478b5 100644 --- a/hmi/dev/nspanel_eu_code/fan.txt +++ b/hmi/dev/nspanel_eu_code/fan.txt @@ -18,8 +18,6 @@ Page fan } vis unavailable,0 vis bt_oscillate,0 - - Postinitialize Event sendme Variable (string) fansetting diff --git a/hmi/dev/nspanel_eu_code/home.txt b/hmi/dev/nspanel_eu_code/home.txt index 6bd21a1..883f81c 100644 --- a/hmi/dev/nspanel_eu_code/home.txt +++ b/hmi/dev/nspanel_eu_code/home.txt @@ -20,8 +20,6 @@ Page home { vis bt_entities,0 } - vis bt_notific,is_notification - vis bt_qrcode,is_qrcode vis bt_utilities,is_utilities if(display_mode==3) { @@ -29,8 +27,6 @@ Page home vis right_bt_text,0 } vis unavailable,0 - - Postinitialize Event sendme Variable (string) lastclick @@ -355,7 +351,10 @@ Text bt_qrcode Events Touch Release Event - page qrcode + if(bt_qrcode.txt!="") + { + page qrcode + } Text bt_entities Attributes diff --git a/hmi/dev/nspanel_eu_code/keyb_num.txt b/hmi/dev/nspanel_eu_code/keyb_num.txt index 07c3562..3c62216 100644 --- a/hmi/dev/nspanel_eu_code/keyb_num.txt +++ b/hmi/dev/nspanel_eu_code/keyb_num.txt @@ -17,8 +17,6 @@ Page keyb_num page page_id.val } vis unavailable,0 - - Postinitialize Event sendme Variable (int32) page_id diff --git a/hmi/dev/nspanel_eu_code/light.txt b/hmi/dev/nspanel_eu_code/light.txt index da41027..734b183 100644 --- a/hmi/dev/nspanel_eu_code/light.txt +++ b/hmi/dev/nspanel_eu_code/light.txt @@ -37,8 +37,6 @@ Page light vis color_button,0 } vis unavailable,0 - - Postinitialize Event sendme Variable (int32) rgb565 diff --git a/hmi/dev/nspanel_eu_code/media_player.txt b/hmi/dev/nspanel_eu_code/media_player.txt index 7aceec7..dcf2a2f 100644 --- a/hmi/dev/nspanel_eu_code/media_player.txt +++ b/hmi/dev/nspanel_eu_code/media_player.txt @@ -17,8 +17,6 @@ Page media_player page home } vis unavailable,0 - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_eu_code/notification.txt b/hmi/dev/nspanel_eu_code/notification.txt index b3e282f..ed2fbf2 100644 --- a/hmi/dev/nspanel_eu_code/notification.txt +++ b/hmi/dev/nspanel_eu_code/notification.txt @@ -17,8 +17,6 @@ Page notification page home } vis unavailable,0 - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_eu_code/qrcode.txt b/hmi/dev/nspanel_eu_code/qrcode.txt index e9a780b..6e55366 100644 --- a/hmi/dev/nspanel_eu_code/qrcode.txt +++ b/hmi/dev/nspanel_eu_code/qrcode.txt @@ -13,8 +13,6 @@ Page qrcode Events Preinitialize Event vis unavailable,0 - - Postinitialize Event sendme Text qrcode_label diff --git a/hmi/dev/nspanel_eu_code/screensaver.txt b/hmi/dev/nspanel_eu_code/screensaver.txt index 4c0ad19..6f8da50 100644 --- a/hmi/dev/nspanel_eu_code/screensaver.txt +++ b/hmi/dev/nspanel_eu_code/screensaver.txt @@ -15,8 +15,6 @@ Page screensaver vis text,0 dim=brightness_sleep vis unavailable,0 - - Postinitialize Event sendme Touch Release Event diff --git a/hmi/dev/nspanel_eu_code/settings.txt b/hmi/dev/nspanel_eu_code/settings.txt index adaf793..1881ea9 100644 --- a/hmi/dev/nspanel_eu_code/settings.txt +++ b/hmi/dev/nspanel_eu_code/settings.txt @@ -19,8 +19,6 @@ Page settings vis lbl_sleep,0 vis bt_sleep,0 vis unavailable,0 - - Postinitialize Event sendme Text bright_text diff --git a/hmi/dev/nspanel_eu_code/utilities.txt b/hmi/dev/nspanel_eu_code/utilities.txt index af61588..30c6040 100644 --- a/hmi/dev/nspanel_eu_code/utilities.txt +++ b/hmi/dev/nspanel_eu_code/utilities.txt @@ -20,8 +20,6 @@ Page utilities vis title_icon,1 vis title,1 vis button_back,1 - - Postinitialize Event sendme Variable (int32) line_main_d diff --git a/hmi/dev/nspanel_eu_code/weather01.txt b/hmi/dev/nspanel_eu_code/weather01.txt index 31c8edc..878553e 100644 --- a/hmi/dev/nspanel_eu_code/weather01.txt +++ b/hmi/dev/nspanel_eu_code/weather01.txt @@ -17,8 +17,6 @@ Page weather01 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/dev/nspanel_eu_code/weather02.txt b/hmi/dev/nspanel_eu_code/weather02.txt index d1e703a..9dbf735 100644 --- a/hmi/dev/nspanel_eu_code/weather02.txt +++ b/hmi/dev/nspanel_eu_code/weather02.txt @@ -17,8 +17,6 @@ Page weather02 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/dev/nspanel_eu_code/weather03.txt b/hmi/dev/nspanel_eu_code/weather03.txt index be8be75..d0d38c9 100644 --- a/hmi/dev/nspanel_eu_code/weather03.txt +++ b/hmi/dev/nspanel_eu_code/weather03.txt @@ -17,8 +17,6 @@ Page weather03 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/dev/nspanel_eu_code/weather04.txt b/hmi/dev/nspanel_eu_code/weather04.txt index 9760d9e..208299d 100644 --- a/hmi/dev/nspanel_eu_code/weather04.txt +++ b/hmi/dev/nspanel_eu_code/weather04.txt @@ -17,8 +17,6 @@ Page weather04 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/dev/nspanel_eu_code/weather05.txt b/hmi/dev/nspanel_eu_code/weather05.txt index 04ea0f0..73bd1b8 100644 --- a/hmi/dev/nspanel_eu_code/weather05.txt +++ b/hmi/dev/nspanel_eu_code/weather05.txt @@ -17,8 +17,6 @@ Page weather05 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/dev/nspanel_us_code/Program.s.txt b/hmi/dev/nspanel_us_code/Program.s.txt index edb9fe1..201bccf 100644 --- a/hmi/dev/nspanel_us_code/Program.s.txt +++ b/hmi/dev/nspanel_us_code/Program.s.txt @@ -9,7 +9,7 @@ Program.s int back_page_id=0 int dimdelta=0 int api=0 // 0 = disconnected from HA, 1 = connected to HA - int is_qrcode=0,is_notification=0,is_utilities=0 + int is_utilities=0 int brightness=100,brightness_dim=40,brightness_sleep=0 int display_mode=2 // 1 = EU, 2 = US, 3 = US landscape, 4 = blank int charset=1 // 1 = International (original), 2 = CJK diff --git a/hmi/dev/nspanel_us_code/alarm.txt b/hmi/dev/nspanel_us_code/alarm.txt index a358203..a2a65cf 100644 --- a/hmi/dev/nspanel_us_code/alarm.txt +++ b/hmi/dev/nspanel_us_code/alarm.txt @@ -24,8 +24,6 @@ Page alarm vis bt_bypass,0 } vis unavailable,0 - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_us_code/boot.txt b/hmi/dev/nspanel_us_code/boot.txt index 3e63dce..daa69a3 100644 --- a/hmi/dev/nspanel_us_code/boot.txt +++ b/hmi/dev/nspanel_us_code/boot.txt @@ -16,8 +16,6 @@ Page boot covx baud,baud_rate.txt,0,0 baud_rate.txt+=" bps" vis unavailable,0 - - Postinitialize Event sendme Page Exit Event @@ -103,7 +101,7 @@ Text tft_version Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text : 4.3dev3 + Text : 4.3dev4 Max. Text Size : 9 Events diff --git a/hmi/dev/nspanel_us_code/buttonpage01.txt b/hmi/dev/nspanel_us_code/buttonpage01.txt index 2026b19..0b5acd8 100644 --- a/hmi/dev/nspanel_us_code/buttonpage01.txt +++ b/hmi/dev/nspanel_us_code/buttonpage01.txt @@ -35,8 +35,6 @@ Page buttonpage01 } vis page_index,1 } - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_us_code/buttonpage02.txt b/hmi/dev/nspanel_us_code/buttonpage02.txt index 3d479dc..eed659f 100644 --- a/hmi/dev/nspanel_us_code/buttonpage02.txt +++ b/hmi/dev/nspanel_us_code/buttonpage02.txt @@ -35,8 +35,6 @@ Page buttonpage02 } vis page_index,1 } - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_us_code/buttonpage03.txt b/hmi/dev/nspanel_us_code/buttonpage03.txt index ed1c1f0..17f7232 100644 --- a/hmi/dev/nspanel_us_code/buttonpage03.txt +++ b/hmi/dev/nspanel_us_code/buttonpage03.txt @@ -35,8 +35,6 @@ Page buttonpage03 } vis page_index,1 } - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_us_code/buttonpage04.txt b/hmi/dev/nspanel_us_code/buttonpage04.txt index 0f5f3e6..6199075 100644 --- a/hmi/dev/nspanel_us_code/buttonpage04.txt +++ b/hmi/dev/nspanel_us_code/buttonpage04.txt @@ -22,8 +22,6 @@ Page buttonpage04 vis page_index,1 vis page_label,1 } - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_us_code/climate.txt b/hmi/dev/nspanel_us_code/climate.txt index 721f7ad..3ba81b3 100644 --- a/hmi/dev/nspanel_us_code/climate.txt +++ b/hmi/dev/nspanel_us_code/climate.txt @@ -33,8 +33,6 @@ Page climate page home } vis unavailable,0 - - Postinitialize Event sendme Page Exit Event diff --git a/hmi/dev/nspanel_us_code/confirm.txt b/hmi/dev/nspanel_us_code/confirm.txt index 131e50e..38da546 100644 --- a/hmi/dev/nspanel_us_code/confirm.txt +++ b/hmi/dev/nspanel_us_code/confirm.txt @@ -17,8 +17,6 @@ Page confirm page home } vis unavailable,0 - - Postinitialize Event sendme Variable (int32) page_id diff --git a/hmi/dev/nspanel_us_code/cover.txt b/hmi/dev/nspanel_us_code/cover.txt index d2d624e..a103257 100644 --- a/hmi/dev/nspanel_us_code/cover.txt +++ b/hmi/dev/nspanel_us_code/cover.txt @@ -17,8 +17,6 @@ Page cover page home } vis unavailable,0 - - Postinitialize Event sendme Variable (string) va1 diff --git a/hmi/dev/nspanel_us_code/entitypage01.txt b/hmi/dev/nspanel_us_code/entitypage01.txt index 977a7b4..e4cf268 100644 --- a/hmi/dev/nspanel_us_code/entitypage01.txt +++ b/hmi/dev/nspanel_us_code/entitypage01.txt @@ -30,8 +30,6 @@ Page entitypage01 { page_index.txt+="â—‹" } - - Postinitialize Event sendme Text value01_label diff --git a/hmi/dev/nspanel_us_code/entitypage02.txt b/hmi/dev/nspanel_us_code/entitypage02.txt index 4b25de6..624506d 100644 --- a/hmi/dev/nspanel_us_code/entitypage02.txt +++ b/hmi/dev/nspanel_us_code/entitypage02.txt @@ -30,8 +30,6 @@ Page entitypage02 { page_index.txt+="â—‹" } - - Postinitialize Event sendme Text value01_label diff --git a/hmi/dev/nspanel_us_code/entitypage03.txt b/hmi/dev/nspanel_us_code/entitypage03.txt index 97fecd2..6112d73 100644 --- a/hmi/dev/nspanel_us_code/entitypage03.txt +++ b/hmi/dev/nspanel_us_code/entitypage03.txt @@ -30,8 +30,6 @@ Page entitypage03 { page_index.txt+="â—‹" } - - Postinitialize Event sendme Text value01_label diff --git a/hmi/dev/nspanel_us_code/entitypage04.txt b/hmi/dev/nspanel_us_code/entitypage04.txt index a7c0222..5ae4454 100644 --- a/hmi/dev/nspanel_us_code/entitypage04.txt +++ b/hmi/dev/nspanel_us_code/entitypage04.txt @@ -30,8 +30,6 @@ Page entitypage04 page_index.txt+="â—‹" } page_index.txt+="●" - - Postinitialize Event sendme Text value01_label diff --git a/hmi/dev/nspanel_us_code/fan.txt b/hmi/dev/nspanel_us_code/fan.txt index 80c36db..95478b5 100644 --- a/hmi/dev/nspanel_us_code/fan.txt +++ b/hmi/dev/nspanel_us_code/fan.txt @@ -18,8 +18,6 @@ Page fan } vis unavailable,0 vis bt_oscillate,0 - - Postinitialize Event sendme Variable (string) fansetting diff --git a/hmi/dev/nspanel_us_code/home.txt b/hmi/dev/nspanel_us_code/home.txt index 6bd21a1..883f81c 100644 --- a/hmi/dev/nspanel_us_code/home.txt +++ b/hmi/dev/nspanel_us_code/home.txt @@ -20,8 +20,6 @@ Page home { vis bt_entities,0 } - vis bt_notific,is_notification - vis bt_qrcode,is_qrcode vis bt_utilities,is_utilities if(display_mode==3) { @@ -29,8 +27,6 @@ Page home vis right_bt_text,0 } vis unavailable,0 - - Postinitialize Event sendme Variable (string) lastclick @@ -355,7 +351,10 @@ Text bt_qrcode Events Touch Release Event - page qrcode + if(bt_qrcode.txt!="") + { + page qrcode + } Text bt_entities Attributes diff --git a/hmi/dev/nspanel_us_code/keyb_num.txt b/hmi/dev/nspanel_us_code/keyb_num.txt index aea6a3e..adcc655 100644 --- a/hmi/dev/nspanel_us_code/keyb_num.txt +++ b/hmi/dev/nspanel_us_code/keyb_num.txt @@ -17,8 +17,6 @@ Page keyb_num page page_id.val } vis unavailable,0 - - Postinitialize Event sendme Variable (int32) page_id diff --git a/hmi/dev/nspanel_us_code/light.txt b/hmi/dev/nspanel_us_code/light.txt index ca91503..54e4869 100644 --- a/hmi/dev/nspanel_us_code/light.txt +++ b/hmi/dev/nspanel_us_code/light.txt @@ -37,8 +37,6 @@ Page light vis color_button,0 } vis unavailable,0 - - Postinitialize Event sendme Variable (int32) rgb565 diff --git a/hmi/dev/nspanel_us_code/media_player.txt b/hmi/dev/nspanel_us_code/media_player.txt index a0d7d1d..4050fd7 100644 --- a/hmi/dev/nspanel_us_code/media_player.txt +++ b/hmi/dev/nspanel_us_code/media_player.txt @@ -17,8 +17,6 @@ Page media_player page home } vis unavailable,0 - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_us_code/notification.txt b/hmi/dev/nspanel_us_code/notification.txt index 089013e..99d93c7 100644 --- a/hmi/dev/nspanel_us_code/notification.txt +++ b/hmi/dev/nspanel_us_code/notification.txt @@ -17,8 +17,6 @@ Page notification page home } vis unavailable,0 - - Postinitialize Event sendme Variable (string) lastclick diff --git a/hmi/dev/nspanel_us_code/qrcode.txt b/hmi/dev/nspanel_us_code/qrcode.txt index e9a780b..6e55366 100644 --- a/hmi/dev/nspanel_us_code/qrcode.txt +++ b/hmi/dev/nspanel_us_code/qrcode.txt @@ -13,8 +13,6 @@ Page qrcode Events Preinitialize Event vis unavailable,0 - - Postinitialize Event sendme Text qrcode_label diff --git a/hmi/dev/nspanel_us_code/screensaver.txt b/hmi/dev/nspanel_us_code/screensaver.txt index 4c0ad19..6f8da50 100644 --- a/hmi/dev/nspanel_us_code/screensaver.txt +++ b/hmi/dev/nspanel_us_code/screensaver.txt @@ -15,8 +15,6 @@ Page screensaver vis text,0 dim=brightness_sleep vis unavailable,0 - - Postinitialize Event sendme Touch Release Event diff --git a/hmi/dev/nspanel_us_code/settings.txt b/hmi/dev/nspanel_us_code/settings.txt index 501cdd2..7d51a3e 100644 --- a/hmi/dev/nspanel_us_code/settings.txt +++ b/hmi/dev/nspanel_us_code/settings.txt @@ -19,8 +19,6 @@ Page settings vis lbl_sleep,0 vis bt_sleep,0 vis unavailable,0 - - Postinitialize Event sendme Text bright_text diff --git a/hmi/dev/nspanel_us_code/utilities.txt b/hmi/dev/nspanel_us_code/utilities.txt index 0d47821..a664959 100644 --- a/hmi/dev/nspanel_us_code/utilities.txt +++ b/hmi/dev/nspanel_us_code/utilities.txt @@ -20,8 +20,6 @@ Page utilities vis title_icon,1 vis title,1 vis button_back,1 - - Postinitialize Event sendme Variable (int32) line_main_d diff --git a/hmi/dev/nspanel_us_code/weather01.txt b/hmi/dev/nspanel_us_code/weather01.txt index 31c8edc..878553e 100644 --- a/hmi/dev/nspanel_us_code/weather01.txt +++ b/hmi/dev/nspanel_us_code/weather01.txt @@ -17,8 +17,6 @@ Page weather01 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/dev/nspanel_us_code/weather02.txt b/hmi/dev/nspanel_us_code/weather02.txt index d1e703a..9dbf735 100644 --- a/hmi/dev/nspanel_us_code/weather02.txt +++ b/hmi/dev/nspanel_us_code/weather02.txt @@ -17,8 +17,6 @@ Page weather02 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/dev/nspanel_us_code/weather03.txt b/hmi/dev/nspanel_us_code/weather03.txt index be8be75..d0d38c9 100644 --- a/hmi/dev/nspanel_us_code/weather03.txt +++ b/hmi/dev/nspanel_us_code/weather03.txt @@ -17,8 +17,6 @@ Page weather03 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/dev/nspanel_us_code/weather04.txt b/hmi/dev/nspanel_us_code/weather04.txt index 9760d9e..208299d 100644 --- a/hmi/dev/nspanel_us_code/weather04.txt +++ b/hmi/dev/nspanel_us_code/weather04.txt @@ -17,8 +17,6 @@ Page weather04 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/dev/nspanel_us_code/weather05.txt b/hmi/dev/nspanel_us_code/weather05.txt index 04ea0f0..73bd1b8 100644 --- a/hmi/dev/nspanel_us_code/weather05.txt +++ b/hmi/dev/nspanel_us_code/weather05.txt @@ -17,8 +17,6 @@ Page weather05 page home } vis unavailable,0 - - Postinitialize Event sendme Text day diff --git a/hmi/nspanel_eu.HMI b/hmi/nspanel_eu.HMI index 281affe..7825474 100644 Binary files a/hmi/nspanel_eu.HMI and b/hmi/nspanel_eu.HMI differ diff --git a/hmi/nspanel_us.HMI b/hmi/nspanel_us.HMI index e23ec97..d19d129 100644 Binary files a/hmi/nspanel_us.HMI and b/hmi/nspanel_us.HMI differ diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 7a9c7d9..48ab345 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -10,7 +10,7 @@ blueprint: description: > # NSPanel Configuration via Blueprint: Complete UI-Based Setup - **Version**: v4.3dev3 + **Version**: v4.3dev4 This project enables comprehensive configuration of your NSPanel through a Blueprint featuring a user interface. @@ -3205,6 +3205,14 @@ trigger_variables: if nspanel_entities | selectattr(None, "search", "sensor.*_temperature") | list | count > 0 else ("sensor." ~ device_name ~ "_temperature") }} + + notification_text: > + {{ + nspanel_entities | selectattr(None, "search", "sensor.*_notification_text") | list | last + if nspanel_entities | selectattr(None, "search", "sensor.*_notification_text") | list | count > 0 + else ("sensor." ~ device_name ~ "_notification_text") + }} + notification_unread: > {{ nspanel_entities | selectattr(None, "search", "switch.*_notification_unread") | list | last @@ -3223,7 +3231,7 @@ trigger_variables: variables: ##### GENERAL ##### - blueprint_version: '4.3dev3' + blueprint_version: '4.3dev4' date_format_temp: !input 'date_format' # Avoid breaking change for existing users with legacy type format date_format: '{{ date_format_temp if date_format_temp not in ["%d.%m", "%d/%m", "%-d/%-m", "%-m/%-d"] else "%A, " ~ date_format_temp }}' @@ -6857,6 +6865,14 @@ trigger: entity_id: !input 'home_value03' id: home_value03_state + ##### Trigger - Home - Notification ####################################################################################################################### + - platform: template + value_template: '{{ states(notification_text) }}' + id: notification_changed + - platform: template + value_template: '{{ states(notification_unread) }}' + id: notification_changed + ##### Trigger - Home - Custom buttons - State change ################################################################################################################# ##### Custom button 01 - Trigger 'home_custom_buttons' ##### - platform: event @@ -7409,7 +7425,6 @@ action: - variables: bt_utilities_icon: !input home_button08_icon - bt_notific_icon: !input home_button04_icon bt_entities_icon: !input home_button06_icon bt_qrcode_icon: !input home_button05_icon qrcode: @@ -7424,14 +7439,6 @@ action: meridiem: '{{ dict.values(mui[language].meridiem) | list }}' chip_font: !input chip_font_size custom_buttons_font: !input custom_buttons_font_size - notification_icon: > - {{ - all_icons[bt_notific_icon.split(":")[1]] - if bt_notific_icon is string and bt_notific_icon.split(":")[1] in all_icons - else all_icons.email - }} - notification_icon_color_normal: !input home_button04_icon_color01 - notification_icon_color_unread: !input home_button04_icon_color02 qrcode: !input qrcode_enabled qrcode_icon: > {{ @@ -7710,7 +7717,6 @@ action: - alias: Home page conditions: '{{ nspanel_event.page == pages.home }}' sequence: &refresh_page_home - ##### Weather Icon Home Page ##### - &refresh-page_home-weather_pic service: '{{ nspanel.service.command }}' @@ -7801,6 +7807,34 @@ action: value_color: !input home_indoor_temp_label_color continue_on_error: true + ###### Notification button ###### + - &refresh_page_home_notification_button + if: '{{ true }}' + then: + - &variables_home_page_notify_button + variables: + notification_icon_color_normal: !input home_button04_icon_color01 + notification_icon_color_unread: !input home_button04_icon_color02 + bt_notific_icon: !input home_button04_icon + notification_text_state: '{{ states(notification_text) if has_value(notification_text) else "" }}' + notification_unread_state: '{{ states(notification_unread) | default(true) }}' + notification_visible: '{{ notification_text_state is string and notification_text_state | length > 0 }}' + notification_icon: > + {{ + ( + all_icons[bt_notific_icon.split(":")[1]] + if bt_notific_icon is string and bt_notific_icon.split(":")[1] in all_icons + else all_icons.email + ) if notification_visible else "" + }} + - service: '{{ nspanel.service.icon }}' + data: + id: home.bt_notific + icon: '{{ notification_icon }}' + icon_color: '{{ notification_icon_color_unread if notification_unread_state else notification_icon_color_normal }}' + visible: '{{ notification_visible }}' + continue_on_error: true + ###### Custom buttons ###### - &update_home_page_custom_buttons if: '{{ true }}' @@ -10131,6 +10165,14 @@ action: sequence: - *display_home_page_status_bar + ##### Home page - Notification changed ###### + - alias: Home page - Notification changed + conditions: + - condition: trigger + id: notification_changed + sequence: + - *variables_home_page_notify_button + ##### HW BUTTON - state ##### - alias: Hardware button - State conditions: