diff --git a/components/nspanel_easy/pages.h b/components/nspanel_easy/pages.h index bb8661ac..444c0a01 100644 --- a/components/nspanel_easy/pages.h +++ b/components/nspanel_easy/pages.h @@ -27,7 +27,7 @@ constexpr const char *const page_names[] = { "climate", "settings", "screensaver", "light", "cover", "buttonpage01", "buttonpage02", "buttonpage03", "buttonpage04", "notification", "qrcode", "entitypage01", "entitypage02", "entitypage03", "entitypage04", "fan", "alarm", "keyb_num", "media_player", "confirm", "utilities", - "home_smpl", "debug", "water_heater", "theme_apply", "switch"}; + "home_smpl", "debug", "water_heater", "theme_apply", "switch", "button"}; constexpr size_t PAGE_COUNT = sizeof(page_names) / sizeof(page_names[0]); static_assert(PAGE_COUNT <= UINT8_MAX, "PAGE_COUNT exceeds uint8_t range"); @@ -94,6 +94,7 @@ inline uint8_t get_page_id(const esphome::StringRef &page_name) { // Ensures no entry is accidentally removed or misspelled in page_names[]. static_assert(get_page_id("alarm") != UINT8_MAX, "Missing required page: alarm"); static_assert(get_page_id("boot") != UINT8_MAX, "Missing required page: boot"); +static_assert(get_page_id("button") != UINT8_MAX, "Missing required page: button"); static_assert(get_page_id("buttonpage01") != UINT8_MAX, "Missing required page: buttonpage01"); static_assert(get_page_id("buttonpage02") != UINT8_MAX, "Missing required page: buttonpage02"); static_assert(get_page_id("buttonpage03") != UINT8_MAX, "Missing required page: buttonpage03"); diff --git a/docs/api.md b/docs/api.md index 0228a3b3..0fa8ee12 100644 --- a/docs/api.md +++ b/docs/api.md @@ -355,10 +355,12 @@ ensuring they can easily access detailed information and return to their initial The domain is used to select the corresponding detail page. Supported domains are: - `alarm_control_panel` + - `button` - `climate` - `cover` - `fan` - `input_boolean` + - `input_button` - `light` - `media_player` - `switch` diff --git a/esphome/nspanel_esphome_api.yaml b/esphome/nspanel_esphome_api.yaml index 8536e432..43e9a898 100644 --- a/esphome/nspanel_esphome_api.yaml +++ b/esphome/nspanel_esphome_api.yaml @@ -128,6 +128,7 @@ api: if (entity == "embedded_climate") entity_id.domain = "climate"; else if (entity_id.domain == "alarm_control_panel") entity_id.domain = "alarm"; else if (entity_id.domain == "input_boolean") entity_id.domain = "switch"; + else if (entity_id.domain == "input_button") entity_id.domain = "button"; if (entity_id.domain != "invalid" or entity == "embedded_climate") { detailed_entity->publish_state(entity); delay(${DELAY_DEFAULT}); diff --git a/esphome/nspanel_esphome_hw_display.yaml b/esphome/nspanel_esphome_hw_display.yaml index 2aa3aa32..1e0f0a87 100644 --- a/esphome/nspanel_esphome_hw_display.yaml +++ b/esphome/nspanel_esphome_hw_display.yaml @@ -251,7 +251,10 @@ script: {"component", params[2].c_str()} }); ESP_LOGV("${TAG_HW_DISPLAY}", "Event sent"); - } else if (page != "home" and page != "light" and page != "switch") { + } else if (page != "button" and + page != "home" and + page != "light" and + page != "switch") { // Generic event ESP_LOGD("${TAG_HW_DISPLAY}", "Send generic event to Home Assistant"); fire_ha_event("button_click", { @@ -300,6 +303,7 @@ script: // Reset globals ESP_LOGV("${TAG_HW_DISPLAY}", "Reset globals"); if (new_page_id != get_page_id("alarm") && + new_page_id != get_page_id("button") && new_page_id != get_page_id("climate") && new_page_id != get_page_id("cover") && new_page_id != get_page_id("fan") && diff --git a/esphome/nspanel_esphome_page_button.yaml b/esphome/nspanel_esphome_page_button.yaml new file mode 100644 index 00000000..2f5fdf94 --- /dev/null +++ b/esphome/nspanel_esphome_page_button.yaml @@ -0,0 +1,81 @@ +##################################################################################################### +##### NSPanel Easy - https://github.com/edwardtfn/NSPanel-Easy ##### +##################################################################################################### +##### ESPHOME Page button ##### +##### PLEASE only make changes if it is necessary and also the required knowledge is available. ##### +##### For normal use with the Blueprint, no changes are necessary. ##### +##################################################################################################### +--- +substitutions: + PAGE_BUTTON_ID: 33 + page_button_color_idle: 16904 + page_button_color_pressed: 15483 + page_button_color_unavail: 10565 + page_button_color_ring: 21162 + TAG_PAGE_BUTTON: nspanel.page.button + +esphome: + platformio_options: + build_flags: + - -D NSPANEL_EASY_PAGE_BUTTON + +script: + - id: !extend event_from_display # Defined by hw_display + then: + - lambda: |- + if (params_count == 0 || params[0] != "button") return; + + // CSV Format: button, + // params[0]=page, params[1]=action (action to perform) + if (params_count != 2) { + ESP_LOGW("${TAG_PAGE_BUTTON}", "Bad params"); + return; + } + + if (detailed_entity == nullptr or detailed_entity->state.empty()) { + ESP_LOGW("${TAG_PAGE_BUTTON}", "No detailed entity"); + return; + } + + const std::string& action = params[1]; + ESP_LOGV("${TAG_PAGE_BUTTON}", "Button action: %s", action.c_str()); + if (action != "press") { + ESP_LOGW("${TAG_PAGE_BUTTON}", "Unsupported action: %s", action.c_str()); + return; + } + + const HomeAssistantEntity entity = extractHomeAssistantEntity(detailed_entity->state); + if (entity.domain == "invalid") { + ESP_LOGW("${TAG_PAGE_BUTTON}", "Invalid entity: %s", detailed_entity->state.c_str()); + return; + } + if (entity.domain != "button" && entity.domain != "input_button") { + ESP_LOGW("${TAG_PAGE_BUTTON}", "Unsupported entity domain for button page: %s", entity.domain.c_str()); + return; + } + + const std::string service = entity.domain + "." + action; + fire_ha_event("action_call", { + {"action", service.c_str()}, + {"entity", detailed_entity->state.c_str()} + }); + + - id: !extend page_change + then: + - lambda: |- + if (new_page_id == get_page_id("button")) + page_button->execute(); + + - id: page_button + mode: single + then: + - lambda: |- + disp1->set_component_value("color_idle", ${page_button_color_idle}); + disp1->set_component_value("color_pressed", ${page_button_color_pressed}); + disp1->set_component_value("color_unavail", ${page_button_color_unavail}); + disp1->set_component_value("color_ring", ${page_button_color_ring}); + + - id: !extend stop_page_constructors + then: + - lambda: page_button->stop(); +... diff --git a/esphome/nspanel_esphome_standard.yaml b/esphome/nspanel_esphome_standard.yaml index e4d10e22..3040a2b2 100644 --- a/esphome/nspanel_esphome_standard.yaml +++ b/esphome/nspanel_esphome_standard.yaml @@ -20,6 +20,7 @@ packages: hw_relays: !include nspanel_esphome_hw_relays.yaml hw_temperature: !include nspanel_esphome_hw_temperature.yaml page_alarm: !include nspanel_esphome_page_alarm.yaml + page_button: !include nspanel_esphome_page_button.yaml page_buttons: !include nspanel_esphome_page_buttons.yaml page_climate: !include nspanel_esphome_page_climate.yaml page_confirm: !include nspanel_esphome_page_confirm.yaml diff --git a/esphome/nspanel_esphome_version.yaml b/esphome/nspanel_esphome_version.yaml index 06df442b..362837cd 100644 --- a/esphome/nspanel_esphome_version.yaml +++ b/esphome/nspanel_esphome_version.yaml @@ -11,8 +11,8 @@ substitutions: # Value is imported from versioning/version.yaml <<: !include ../versioning/version.yaml # Minimum required versions for compatibility - min_blueprint_version: 11 - min_tft_version: 12 + min_blueprint_version: 12 + min_tft_version: 13 min_esphome_compiler_version: 2026.1.0 TAG_VERSIONING: nspanel.versioning diff --git a/hmi/dev/nspanel_CJK_eu_code/boot.txt b/hmi/dev/nspanel_CJK_eu_code/boot.txt index 1d48565d..33f6cb4c 100644 --- a/hmi/dev/nspanel_CJK_eu_code/boot.txt +++ b/hmi/dev/nspanel_CJK_eu_code/boot.txt @@ -60,7 +60,7 @@ Variable (string) version Attributes ID : 6 Scope : global - Text : 12 + Text : 13 Max. Text Size: 3 Variable (int32) log_len diff --git a/hmi/dev/nspanel_CJK_eu_code/button.txt b/hmi/dev/nspanel_CJK_eu_code/button.txt new file mode 100644 index 00000000..a6d0fc55 --- /dev/null +++ b/hmi/dev/nspanel_CJK_eu_code/button.txt @@ -0,0 +1,277 @@ +Page button + Attributes + ID : 0 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + Width : 480 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Locked : no + Swide up page ID : disabled + Swide down page ID : disabled + Swide left page ID : disabled + Swide right page ID: disabled + Fill : picture + Back. Picture ID : 0 + + Events + Preinitialize Event + if(api==0) + { + page home_page_id + } + // set background image and fg color to all components + button.pic=pic_background_main + icon_state.picc=pic_background_main + page_label.picc=pic_background_main + button_back.font=button_back_font + button_back.pco=color_pco_navigation + button_back.picc2=pic_background_main + dim=brightness + sendme + +Variable (int32) state + Attributes + ID : 4 + Scope: local + Value: 4294967295 + +Variable (int32) color_idle + Attributes + ID : 5 + Scope: local + Value: 16904 + +Variable (int32) color_pressed + Attributes + ID : 6 + Scope: local + Value: 15483 + +Variable (int32) color_unavail + Attributes + ID : 7 + Scope: local + Value: 10565 + +Variable (int32) color_ring + Attributes + ID : 8 + Scope: local + Value: 21162 + +Variable (int32) cx + Attributes + ID : 9 + Scope: local + Value: 0 + +Variable (int32) cy + Attributes + ID : 10 + Scope: local + Value: 0 + +Variable (int32) outer_r + Attributes + ID : 13 + Scope: local + Value: 0 + +Variable (int32) inner_r + Attributes + ID : 14 + Scope: local + Value: 0 + +Variable (string) icon + Attributes + ID : 15 + Scope : local + Text : + Max. Text Size: 4 + +Variable (int32) inner_d + Attributes + ID : 16 + Scope: local + Value: 0 + +Variable (int32) icon_x + Attributes + ID : 17 + Scope: local + Value: 0 + +Variable (int32) icon_y + Attributes + ID : 18 + Scope: local + Value: 0 + +Text page_label + Attributes + ID : 1 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 48 + y coordinate : 8 + Width : 300 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 2 + Cropped Back. Picture ID: 0 + Horizontal Alignment : left + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 100 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Text icon_state + Attributes + ID : 2 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 12 + y coordinate : 8 + Width : 35 + Height : 35 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 8 + Cropped Back. Picture ID: 0 + Horizontal Alignment : center + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 10 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Button button_back + Attributes + ID : 3 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 385 + y coordinate : 0 + Width : 95 + Height : 48 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Font ID : 8 + Cropped Back. Picture ID (Unpressed): 0 + Back. Picture ID (Pressed) : 65535 + Cropped Back. Picture ID (Pressed) : 0 + Horizontal Alignment : center + Vertical Alignment : top + State : unpressed + Text : \xee\x85\x98 + Max. Text Size : 3 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + page back_page_id + +Hotspot touch_area + Attributes + ID : 11 + Scope : local + Dragging : 0 + Send Component ID: disabled + Opacity : 127 + x coordinate : 186 + y coordinate : 120 + Width : 80 + Height : 80 + Effect : load + Effect Priority : 0 + Effect Time : 300 + + Events + Touch Press Event + if(state.val==0) + { + // Draw pressed color immediately (local, no UART) + state.val=1 + cirs cx.val,cy.val,inner_r.val,color_pressed.val + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,color_pressed.val,1,1,3,icon.txt + // Send event to ESPHome + printh 92 + prints "localevent",0 + printh 00 + prints "button,press",0 + printh 00 + printh FF FF FF + } + +Timer render + Attributes + ID : 12 + Scope : local + Period (ms): 50 + Enabled : no + + Events + Timer Event + // Self-disable first + render.en=0 + // Derive center from touch_area position + sys0=touch_area.w/2 + sys1=touch_area.h/2 + cx.val=touch_area.x+sys0 + cy.val=touch_area.y+sys1 + // Pre-compute radii and icon coordinates + outer_r.val=sys0 + inner_r.val=outer_r.val-4 + inner_d.val=inner_r.val*2 + icon_x.val=cx.val-inner_r.val + icon_y.val=cy.val-inner_r.val + // Resolve fill color + if(state.val==0) + { + sys0=color_idle.val + }else if(state.val==1) + { + sys0=color_pressed.val + }else + { + sys0=color_unavail.val + } + // Draw ring + cirs cx.val,cy.val,outer_r.val,color_ring.val + cirs cx.val,cy.val,outer_r.val-1,color_ring.val + cirs cx.val,cy.val,outer_r.val-2,color_ring.val + cirs cx.val,cy.val,outer_r.val-3,color_ring.val + // Draw inner fill + cirs cx.val,cy.val,inner_r.val,sys0 + // Draw icon + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,sys0,1,1,3,icon.txt + // Ensure touch_area in the front + ref touch_area + diff --git a/hmi/dev/nspanel_CJK_us_code/boot.txt b/hmi/dev/nspanel_CJK_us_code/boot.txt index af21a915..40b4e18a 100644 --- a/hmi/dev/nspanel_CJK_us_code/boot.txt +++ b/hmi/dev/nspanel_CJK_us_code/boot.txt @@ -60,7 +60,7 @@ Variable (string) version Attributes ID : 6 Scope : global - Text : 12 + Text : 13 Max. Text Size: 3 Variable (int32) log_len diff --git a/hmi/dev/nspanel_CJK_us_code/button.txt b/hmi/dev/nspanel_CJK_us_code/button.txt new file mode 100644 index 00000000..72f3e68e --- /dev/null +++ b/hmi/dev/nspanel_CJK_us_code/button.txt @@ -0,0 +1,277 @@ +Page button + Attributes + ID : 0 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + Width : 320 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Locked : no + Swide up page ID : disabled + Swide down page ID : disabled + Swide left page ID : disabled + Swide right page ID: disabled + Fill : picture + Back. Picture ID : 0 + + Events + Preinitialize Event + if(api==0) + { + page home_page_id + } + // set background image and fg color to all components + button.pic=pic_background_main + icon_state.picc=pic_background_main + page_label.picc=pic_background_main + button_back.font=button_back_font + button_back.pco=color_pco_navigation + button_back.picc2=pic_background_main + dim=brightness + sendme + +Variable (int32) state + Attributes + ID : 4 + Scope: local + Value: 4294967295 + +Variable (int32) color_idle + Attributes + ID : 5 + Scope: local + Value: 16904 + +Variable (int32) color_pressed + Attributes + ID : 6 + Scope: local + Value: 15483 + +Variable (int32) color_unavail + Attributes + ID : 7 + Scope: local + Value: 10565 + +Variable (int32) color_ring + Attributes + ID : 8 + Scope: local + Value: 21162 + +Variable (int32) cx + Attributes + ID : 9 + Scope: local + Value: 0 + +Variable (int32) cy + Attributes + ID : 10 + Scope: local + Value: 0 + +Variable (int32) outer_r + Attributes + ID : 13 + Scope: local + Value: 0 + +Variable (int32) inner_r + Attributes + ID : 14 + Scope: local + Value: 0 + +Variable (string) icon + Attributes + ID : 15 + Scope : local + Text : + Max. Text Size: 4 + +Variable (int32) inner_d + Attributes + ID : 16 + Scope: local + Value: 0 + +Variable (int32) icon_x + Attributes + ID : 17 + Scope: local + Value: 0 + +Variable (int32) icon_y + Attributes + ID : 18 + Scope: local + Value: 0 + +Text page_label + Attributes + ID : 1 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 46 + y coordinate : 8 + Width : 204 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 2 + Cropped Back. Picture ID: 0 + Horizontal Alignment : left + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 100 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Text icon_state + Attributes + ID : 2 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 10 + y coordinate : 8 + Width : 35 + Height : 35 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 8 + Cropped Back. Picture ID: 0 + Horizontal Alignment : center + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 10 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Button button_back + Attributes + ID : 3 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 260 + y coordinate : 0 + Width : 60 + Height : 48 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Font ID : 8 + Cropped Back. Picture ID (Unpressed): 0 + Back. Picture ID (Pressed) : 65535 + Cropped Back. Picture ID (Pressed) : 0 + Horizontal Alignment : center + Vertical Alignment : top + State : unpressed + Text : \xee\x85\x98 + Max. Text Size : 3 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + page back_page_id + +Hotspot touch_area + Attributes + ID : 11 + Scope : local + Dragging : 0 + Send Component ID: disabled + Opacity : 127 + x coordinate : 120 + y coordinate : 200 + Width : 80 + Height : 80 + Effect : load + Effect Priority : 0 + Effect Time : 300 + + Events + Touch Press Event + if(state.val==0) + { + // Draw pressed color immediately (local, no UART) + state.val=1 + cirs cx.val,cy.val,inner_r.val,color_pressed.val + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,color_pressed.val,1,1,3,icon.txt + // Send event to ESPHome + printh 92 + prints "localevent",0 + printh 00 + prints "button,press",0 + printh 00 + printh FF FF FF + } + +Timer render + Attributes + ID : 12 + Scope : local + Period (ms): 50 + Enabled : no + + Events + Timer Event + // Self-disable first + render.en=0 + // Derive center from touch_area position + sys0=touch_area.w/2 + sys1=touch_area.h/2 + cx.val=touch_area.x+sys0 + cy.val=touch_area.y+sys1 + // Pre-compute radii and icon coordinates + outer_r.val=sys0 + inner_r.val=outer_r.val-4 + inner_d.val=inner_r.val*2 + icon_x.val=cx.val-inner_r.val + icon_y.val=cy.val-inner_r.val + // Resolve fill color + if(state.val==0) + { + sys0=color_idle.val + }else if(state.val==1) + { + sys0=color_pressed.val + }else + { + sys0=color_unavail.val + } + // Draw ring + cirs cx.val,cy.val,outer_r.val,color_ring.val + cirs cx.val,cy.val,outer_r.val-1,color_ring.val + cirs cx.val,cy.val,outer_r.val-2,color_ring.val + cirs cx.val,cy.val,outer_r.val-3,color_ring.val + // Draw inner fill + cirs cx.val,cy.val,inner_r.val,sys0 + // Draw icon + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,sys0,1,1,3,icon.txt + // Ensure touch_area in the front + ref touch_area + diff --git a/hmi/dev/nspanel_CJK_us_land_code/boot.txt b/hmi/dev/nspanel_CJK_us_land_code/boot.txt index 1d48565d..33f6cb4c 100644 --- a/hmi/dev/nspanel_CJK_us_land_code/boot.txt +++ b/hmi/dev/nspanel_CJK_us_land_code/boot.txt @@ -60,7 +60,7 @@ Variable (string) version Attributes ID : 6 Scope : global - Text : 12 + Text : 13 Max. Text Size: 3 Variable (int32) log_len diff --git a/hmi/dev/nspanel_CJK_us_land_code/button.txt b/hmi/dev/nspanel_CJK_us_land_code/button.txt new file mode 100644 index 00000000..a6d0fc55 --- /dev/null +++ b/hmi/dev/nspanel_CJK_us_land_code/button.txt @@ -0,0 +1,277 @@ +Page button + Attributes + ID : 0 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + Width : 480 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Locked : no + Swide up page ID : disabled + Swide down page ID : disabled + Swide left page ID : disabled + Swide right page ID: disabled + Fill : picture + Back. Picture ID : 0 + + Events + Preinitialize Event + if(api==0) + { + page home_page_id + } + // set background image and fg color to all components + button.pic=pic_background_main + icon_state.picc=pic_background_main + page_label.picc=pic_background_main + button_back.font=button_back_font + button_back.pco=color_pco_navigation + button_back.picc2=pic_background_main + dim=brightness + sendme + +Variable (int32) state + Attributes + ID : 4 + Scope: local + Value: 4294967295 + +Variable (int32) color_idle + Attributes + ID : 5 + Scope: local + Value: 16904 + +Variable (int32) color_pressed + Attributes + ID : 6 + Scope: local + Value: 15483 + +Variable (int32) color_unavail + Attributes + ID : 7 + Scope: local + Value: 10565 + +Variable (int32) color_ring + Attributes + ID : 8 + Scope: local + Value: 21162 + +Variable (int32) cx + Attributes + ID : 9 + Scope: local + Value: 0 + +Variable (int32) cy + Attributes + ID : 10 + Scope: local + Value: 0 + +Variable (int32) outer_r + Attributes + ID : 13 + Scope: local + Value: 0 + +Variable (int32) inner_r + Attributes + ID : 14 + Scope: local + Value: 0 + +Variable (string) icon + Attributes + ID : 15 + Scope : local + Text : + Max. Text Size: 4 + +Variable (int32) inner_d + Attributes + ID : 16 + Scope: local + Value: 0 + +Variable (int32) icon_x + Attributes + ID : 17 + Scope: local + Value: 0 + +Variable (int32) icon_y + Attributes + ID : 18 + Scope: local + Value: 0 + +Text page_label + Attributes + ID : 1 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 48 + y coordinate : 8 + Width : 300 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 2 + Cropped Back. Picture ID: 0 + Horizontal Alignment : left + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 100 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Text icon_state + Attributes + ID : 2 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 12 + y coordinate : 8 + Width : 35 + Height : 35 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 8 + Cropped Back. Picture ID: 0 + Horizontal Alignment : center + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 10 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Button button_back + Attributes + ID : 3 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 385 + y coordinate : 0 + Width : 95 + Height : 48 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Font ID : 8 + Cropped Back. Picture ID (Unpressed): 0 + Back. Picture ID (Pressed) : 65535 + Cropped Back. Picture ID (Pressed) : 0 + Horizontal Alignment : center + Vertical Alignment : top + State : unpressed + Text : \xee\x85\x98 + Max. Text Size : 3 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + page back_page_id + +Hotspot touch_area + Attributes + ID : 11 + Scope : local + Dragging : 0 + Send Component ID: disabled + Opacity : 127 + x coordinate : 186 + y coordinate : 120 + Width : 80 + Height : 80 + Effect : load + Effect Priority : 0 + Effect Time : 300 + + Events + Touch Press Event + if(state.val==0) + { + // Draw pressed color immediately (local, no UART) + state.val=1 + cirs cx.val,cy.val,inner_r.val,color_pressed.val + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,color_pressed.val,1,1,3,icon.txt + // Send event to ESPHome + printh 92 + prints "localevent",0 + printh 00 + prints "button,press",0 + printh 00 + printh FF FF FF + } + +Timer render + Attributes + ID : 12 + Scope : local + Period (ms): 50 + Enabled : no + + Events + Timer Event + // Self-disable first + render.en=0 + // Derive center from touch_area position + sys0=touch_area.w/2 + sys1=touch_area.h/2 + cx.val=touch_area.x+sys0 + cy.val=touch_area.y+sys1 + // Pre-compute radii and icon coordinates + outer_r.val=sys0 + inner_r.val=outer_r.val-4 + inner_d.val=inner_r.val*2 + icon_x.val=cx.val-inner_r.val + icon_y.val=cy.val-inner_r.val + // Resolve fill color + if(state.val==0) + { + sys0=color_idle.val + }else if(state.val==1) + { + sys0=color_pressed.val + }else + { + sys0=color_unavail.val + } + // Draw ring + cirs cx.val,cy.val,outer_r.val,color_ring.val + cirs cx.val,cy.val,outer_r.val-1,color_ring.val + cirs cx.val,cy.val,outer_r.val-2,color_ring.val + cirs cx.val,cy.val,outer_r.val-3,color_ring.val + // Draw inner fill + cirs cx.val,cy.val,inner_r.val,sys0 + // Draw icon + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,sys0,1,1,3,icon.txt + // Ensure touch_area in the front + ref touch_area + diff --git a/hmi/dev/nspanel_easy_landscape/boot.txt b/hmi/dev/nspanel_easy_landscape/boot.txt index 234262c5..84e36f89 100644 --- a/hmi/dev/nspanel_easy_landscape/boot.txt +++ b/hmi/dev/nspanel_easy_landscape/boot.txt @@ -60,7 +60,7 @@ Variable (string) version Attributes ID : 6 Scope : global - Text : 12 + Text : 13 Max. Text Size: 3 Variable (int32) log_len diff --git a/hmi/dev/nspanel_eu_code/boot.txt b/hmi/dev/nspanel_eu_code/boot.txt index 1d48565d..33f6cb4c 100644 --- a/hmi/dev/nspanel_eu_code/boot.txt +++ b/hmi/dev/nspanel_eu_code/boot.txt @@ -60,7 +60,7 @@ Variable (string) version Attributes ID : 6 Scope : global - Text : 12 + Text : 13 Max. Text Size: 3 Variable (int32) log_len diff --git a/hmi/dev/nspanel_eu_code/button.txt b/hmi/dev/nspanel_eu_code/button.txt new file mode 100644 index 00000000..a6d0fc55 --- /dev/null +++ b/hmi/dev/nspanel_eu_code/button.txt @@ -0,0 +1,277 @@ +Page button + Attributes + ID : 0 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + Width : 480 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Locked : no + Swide up page ID : disabled + Swide down page ID : disabled + Swide left page ID : disabled + Swide right page ID: disabled + Fill : picture + Back. Picture ID : 0 + + Events + Preinitialize Event + if(api==0) + { + page home_page_id + } + // set background image and fg color to all components + button.pic=pic_background_main + icon_state.picc=pic_background_main + page_label.picc=pic_background_main + button_back.font=button_back_font + button_back.pco=color_pco_navigation + button_back.picc2=pic_background_main + dim=brightness + sendme + +Variable (int32) state + Attributes + ID : 4 + Scope: local + Value: 4294967295 + +Variable (int32) color_idle + Attributes + ID : 5 + Scope: local + Value: 16904 + +Variable (int32) color_pressed + Attributes + ID : 6 + Scope: local + Value: 15483 + +Variable (int32) color_unavail + Attributes + ID : 7 + Scope: local + Value: 10565 + +Variable (int32) color_ring + Attributes + ID : 8 + Scope: local + Value: 21162 + +Variable (int32) cx + Attributes + ID : 9 + Scope: local + Value: 0 + +Variable (int32) cy + Attributes + ID : 10 + Scope: local + Value: 0 + +Variable (int32) outer_r + Attributes + ID : 13 + Scope: local + Value: 0 + +Variable (int32) inner_r + Attributes + ID : 14 + Scope: local + Value: 0 + +Variable (string) icon + Attributes + ID : 15 + Scope : local + Text : + Max. Text Size: 4 + +Variable (int32) inner_d + Attributes + ID : 16 + Scope: local + Value: 0 + +Variable (int32) icon_x + Attributes + ID : 17 + Scope: local + Value: 0 + +Variable (int32) icon_y + Attributes + ID : 18 + Scope: local + Value: 0 + +Text page_label + Attributes + ID : 1 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 48 + y coordinate : 8 + Width : 300 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 2 + Cropped Back. Picture ID: 0 + Horizontal Alignment : left + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 100 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Text icon_state + Attributes + ID : 2 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 12 + y coordinate : 8 + Width : 35 + Height : 35 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 8 + Cropped Back. Picture ID: 0 + Horizontal Alignment : center + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 10 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Button button_back + Attributes + ID : 3 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 385 + y coordinate : 0 + Width : 95 + Height : 48 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Font ID : 8 + Cropped Back. Picture ID (Unpressed): 0 + Back. Picture ID (Pressed) : 65535 + Cropped Back. Picture ID (Pressed) : 0 + Horizontal Alignment : center + Vertical Alignment : top + State : unpressed + Text : \xee\x85\x98 + Max. Text Size : 3 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + page back_page_id + +Hotspot touch_area + Attributes + ID : 11 + Scope : local + Dragging : 0 + Send Component ID: disabled + Opacity : 127 + x coordinate : 186 + y coordinate : 120 + Width : 80 + Height : 80 + Effect : load + Effect Priority : 0 + Effect Time : 300 + + Events + Touch Press Event + if(state.val==0) + { + // Draw pressed color immediately (local, no UART) + state.val=1 + cirs cx.val,cy.val,inner_r.val,color_pressed.val + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,color_pressed.val,1,1,3,icon.txt + // Send event to ESPHome + printh 92 + prints "localevent",0 + printh 00 + prints "button,press",0 + printh 00 + printh FF FF FF + } + +Timer render + Attributes + ID : 12 + Scope : local + Period (ms): 50 + Enabled : no + + Events + Timer Event + // Self-disable first + render.en=0 + // Derive center from touch_area position + sys0=touch_area.w/2 + sys1=touch_area.h/2 + cx.val=touch_area.x+sys0 + cy.val=touch_area.y+sys1 + // Pre-compute radii and icon coordinates + outer_r.val=sys0 + inner_r.val=outer_r.val-4 + inner_d.val=inner_r.val*2 + icon_x.val=cx.val-inner_r.val + icon_y.val=cy.val-inner_r.val + // Resolve fill color + if(state.val==0) + { + sys0=color_idle.val + }else if(state.val==1) + { + sys0=color_pressed.val + }else + { + sys0=color_unavail.val + } + // Draw ring + cirs cx.val,cy.val,outer_r.val,color_ring.val + cirs cx.val,cy.val,outer_r.val-1,color_ring.val + cirs cx.val,cy.val,outer_r.val-2,color_ring.val + cirs cx.val,cy.val,outer_r.val-3,color_ring.val + // Draw inner fill + cirs cx.val,cy.val,inner_r.val,sys0 + // Draw icon + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,sys0,1,1,3,icon.txt + // Ensure touch_area in the front + ref touch_area + diff --git a/hmi/dev/nspanel_us_code/boot.txt b/hmi/dev/nspanel_us_code/boot.txt index af21a915..40b4e18a 100644 --- a/hmi/dev/nspanel_us_code/boot.txt +++ b/hmi/dev/nspanel_us_code/boot.txt @@ -60,7 +60,7 @@ Variable (string) version Attributes ID : 6 Scope : global - Text : 12 + Text : 13 Max. Text Size: 3 Variable (int32) log_len diff --git a/hmi/dev/nspanel_us_code/button.txt b/hmi/dev/nspanel_us_code/button.txt new file mode 100644 index 00000000..72f3e68e --- /dev/null +++ b/hmi/dev/nspanel_us_code/button.txt @@ -0,0 +1,277 @@ +Page button + Attributes + ID : 0 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + Width : 320 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Locked : no + Swide up page ID : disabled + Swide down page ID : disabled + Swide left page ID : disabled + Swide right page ID: disabled + Fill : picture + Back. Picture ID : 0 + + Events + Preinitialize Event + if(api==0) + { + page home_page_id + } + // set background image and fg color to all components + button.pic=pic_background_main + icon_state.picc=pic_background_main + page_label.picc=pic_background_main + button_back.font=button_back_font + button_back.pco=color_pco_navigation + button_back.picc2=pic_background_main + dim=brightness + sendme + +Variable (int32) state + Attributes + ID : 4 + Scope: local + Value: 4294967295 + +Variable (int32) color_idle + Attributes + ID : 5 + Scope: local + Value: 16904 + +Variable (int32) color_pressed + Attributes + ID : 6 + Scope: local + Value: 15483 + +Variable (int32) color_unavail + Attributes + ID : 7 + Scope: local + Value: 10565 + +Variable (int32) color_ring + Attributes + ID : 8 + Scope: local + Value: 21162 + +Variable (int32) cx + Attributes + ID : 9 + Scope: local + Value: 0 + +Variable (int32) cy + Attributes + ID : 10 + Scope: local + Value: 0 + +Variable (int32) outer_r + Attributes + ID : 13 + Scope: local + Value: 0 + +Variable (int32) inner_r + Attributes + ID : 14 + Scope: local + Value: 0 + +Variable (string) icon + Attributes + ID : 15 + Scope : local + Text : + Max. Text Size: 4 + +Variable (int32) inner_d + Attributes + ID : 16 + Scope: local + Value: 0 + +Variable (int32) icon_x + Attributes + ID : 17 + Scope: local + Value: 0 + +Variable (int32) icon_y + Attributes + ID : 18 + Scope: local + Value: 0 + +Text page_label + Attributes + ID : 1 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 46 + y coordinate : 8 + Width : 204 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 2 + Cropped Back. Picture ID: 0 + Horizontal Alignment : left + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 100 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Text icon_state + Attributes + ID : 2 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 10 + y coordinate : 8 + Width : 35 + Height : 35 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 8 + Cropped Back. Picture ID: 0 + Horizontal Alignment : center + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 10 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Button button_back + Attributes + ID : 3 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 260 + y coordinate : 0 + Width : 60 + Height : 48 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Font ID : 8 + Cropped Back. Picture ID (Unpressed): 0 + Back. Picture ID (Pressed) : 65535 + Cropped Back. Picture ID (Pressed) : 0 + Horizontal Alignment : center + Vertical Alignment : top + State : unpressed + Text : \xee\x85\x98 + Max. Text Size : 3 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + page back_page_id + +Hotspot touch_area + Attributes + ID : 11 + Scope : local + Dragging : 0 + Send Component ID: disabled + Opacity : 127 + x coordinate : 120 + y coordinate : 200 + Width : 80 + Height : 80 + Effect : load + Effect Priority : 0 + Effect Time : 300 + + Events + Touch Press Event + if(state.val==0) + { + // Draw pressed color immediately (local, no UART) + state.val=1 + cirs cx.val,cy.val,inner_r.val,color_pressed.val + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,color_pressed.val,1,1,3,icon.txt + // Send event to ESPHome + printh 92 + prints "localevent",0 + printh 00 + prints "button,press",0 + printh 00 + printh FF FF FF + } + +Timer render + Attributes + ID : 12 + Scope : local + Period (ms): 50 + Enabled : no + + Events + Timer Event + // Self-disable first + render.en=0 + // Derive center from touch_area position + sys0=touch_area.w/2 + sys1=touch_area.h/2 + cx.val=touch_area.x+sys0 + cy.val=touch_area.y+sys1 + // Pre-compute radii and icon coordinates + outer_r.val=sys0 + inner_r.val=outer_r.val-4 + inner_d.val=inner_r.val*2 + icon_x.val=cx.val-inner_r.val + icon_y.val=cy.val-inner_r.val + // Resolve fill color + if(state.val==0) + { + sys0=color_idle.val + }else if(state.val==1) + { + sys0=color_pressed.val + }else + { + sys0=color_unavail.val + } + // Draw ring + cirs cx.val,cy.val,outer_r.val,color_ring.val + cirs cx.val,cy.val,outer_r.val-1,color_ring.val + cirs cx.val,cy.val,outer_r.val-2,color_ring.val + cirs cx.val,cy.val,outer_r.val-3,color_ring.val + // Draw inner fill + cirs cx.val,cy.val,inner_r.val,sys0 + // Draw icon + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,sys0,1,1,3,icon.txt + // Ensure touch_area in the front + ref touch_area + diff --git a/hmi/dev/nspanel_us_land_code/boot.txt b/hmi/dev/nspanel_us_land_code/boot.txt index 1d48565d..33f6cb4c 100644 --- a/hmi/dev/nspanel_us_land_code/boot.txt +++ b/hmi/dev/nspanel_us_land_code/boot.txt @@ -60,7 +60,7 @@ Variable (string) version Attributes ID : 6 Scope : global - Text : 12 + Text : 13 Max. Text Size: 3 Variable (int32) log_len diff --git a/hmi/dev/nspanel_us_land_code/button.txt b/hmi/dev/nspanel_us_land_code/button.txt new file mode 100644 index 00000000..a6d0fc55 --- /dev/null +++ b/hmi/dev/nspanel_us_land_code/button.txt @@ -0,0 +1,277 @@ +Page button + Attributes + ID : 0 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + Width : 480 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Locked : no + Swide up page ID : disabled + Swide down page ID : disabled + Swide left page ID : disabled + Swide right page ID: disabled + Fill : picture + Back. Picture ID : 0 + + Events + Preinitialize Event + if(api==0) + { + page home_page_id + } + // set background image and fg color to all components + button.pic=pic_background_main + icon_state.picc=pic_background_main + page_label.picc=pic_background_main + button_back.font=button_back_font + button_back.pco=color_pco_navigation + button_back.picc2=pic_background_main + dim=brightness + sendme + +Variable (int32) state + Attributes + ID : 4 + Scope: local + Value: 4294967295 + +Variable (int32) color_idle + Attributes + ID : 5 + Scope: local + Value: 16904 + +Variable (int32) color_pressed + Attributes + ID : 6 + Scope: local + Value: 15483 + +Variable (int32) color_unavail + Attributes + ID : 7 + Scope: local + Value: 10565 + +Variable (int32) color_ring + Attributes + ID : 8 + Scope: local + Value: 21162 + +Variable (int32) cx + Attributes + ID : 9 + Scope: local + Value: 0 + +Variable (int32) cy + Attributes + ID : 10 + Scope: local + Value: 0 + +Variable (int32) outer_r + Attributes + ID : 13 + Scope: local + Value: 0 + +Variable (int32) inner_r + Attributes + ID : 14 + Scope: local + Value: 0 + +Variable (string) icon + Attributes + ID : 15 + Scope : local + Text : + Max. Text Size: 4 + +Variable (int32) inner_d + Attributes + ID : 16 + Scope: local + Value: 0 + +Variable (int32) icon_x + Attributes + ID : 17 + Scope: local + Value: 0 + +Variable (int32) icon_y + Attributes + ID : 18 + Scope: local + Value: 0 + +Text page_label + Attributes + ID : 1 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 48 + y coordinate : 8 + Width : 300 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 2 + Cropped Back. Picture ID: 0 + Horizontal Alignment : left + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 100 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Text icon_state + Attributes + ID : 2 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 12 + y coordinate : 8 + Width : 35 + Height : 35 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 8 + Cropped Back. Picture ID: 0 + Horizontal Alignment : center + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 10 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +Button button_back + Attributes + ID : 3 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 385 + y coordinate : 0 + Width : 95 + Height : 48 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Font ID : 8 + Cropped Back. Picture ID (Unpressed): 0 + Back. Picture ID (Pressed) : 65535 + Cropped Back. Picture ID (Pressed) : 0 + Horizontal Alignment : center + Vertical Alignment : top + State : unpressed + Text : \xee\x85\x98 + Max. Text Size : 3 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + page back_page_id + +Hotspot touch_area + Attributes + ID : 11 + Scope : local + Dragging : 0 + Send Component ID: disabled + Opacity : 127 + x coordinate : 186 + y coordinate : 120 + Width : 80 + Height : 80 + Effect : load + Effect Priority : 0 + Effect Time : 300 + + Events + Touch Press Event + if(state.val==0) + { + // Draw pressed color immediately (local, no UART) + state.val=1 + cirs cx.val,cy.val,inner_r.val,color_pressed.val + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,color_pressed.val,1,1,3,icon.txt + // Send event to ESPHome + printh 92 + prints "localevent",0 + printh 00 + prints "button,press",0 + printh 00 + printh FF FF FF + } + +Timer render + Attributes + ID : 12 + Scope : local + Period (ms): 50 + Enabled : no + + Events + Timer Event + // Self-disable first + render.en=0 + // Derive center from touch_area position + sys0=touch_area.w/2 + sys1=touch_area.h/2 + cx.val=touch_area.x+sys0 + cy.val=touch_area.y+sys1 + // Pre-compute radii and icon coordinates + outer_r.val=sys0 + inner_r.val=outer_r.val-4 + inner_d.val=inner_r.val*2 + icon_x.val=cx.val-inner_r.val + icon_y.val=cy.val-inner_r.val + // Resolve fill color + if(state.val==0) + { + sys0=color_idle.val + }else if(state.val==1) + { + sys0=color_pressed.val + }else + { + sys0=color_unavail.val + } + // Draw ring + cirs cx.val,cy.val,outer_r.val,color_ring.val + cirs cx.val,cy.val,outer_r.val-1,color_ring.val + cirs cx.val,cy.val,outer_r.val-2,color_ring.val + cirs cx.val,cy.val,outer_r.val-3,color_ring.val + // Draw inner fill + cirs cx.val,cy.val,inner_r.val,sys0 + // Draw icon + xstr icon_x.val,icon_y.val,inner_d.val,inner_d.val,10,WHITE,sys0,1,1,3,icon.txt + // Ensure touch_area in the front + ref touch_area + diff --git a/hmi/nspanel_CJK_eu.HMI b/hmi/nspanel_CJK_eu.HMI index a68b3bab..b208e081 100644 Binary files a/hmi/nspanel_CJK_eu.HMI and b/hmi/nspanel_CJK_eu.HMI differ diff --git a/hmi/nspanel_CJK_eu.tft b/hmi/nspanel_CJK_eu.tft index 788ae812..9813dd4a 100644 Binary files a/hmi/nspanel_CJK_eu.tft and b/hmi/nspanel_CJK_eu.tft differ diff --git a/hmi/nspanel_CJK_us.HMI b/hmi/nspanel_CJK_us.HMI index ab1c5aad..60d8c226 100644 Binary files a/hmi/nspanel_CJK_us.HMI and b/hmi/nspanel_CJK_us.HMI differ diff --git a/hmi/nspanel_CJK_us.tft b/hmi/nspanel_CJK_us.tft index eca0c146..946ed532 100644 Binary files a/hmi/nspanel_CJK_us.tft and b/hmi/nspanel_CJK_us.tft differ diff --git a/hmi/nspanel_CJK_us_land.HMI b/hmi/nspanel_CJK_us_land.HMI index 7c999cee..2030b041 100644 Binary files a/hmi/nspanel_CJK_us_land.HMI and b/hmi/nspanel_CJK_us_land.HMI differ diff --git a/hmi/nspanel_CJK_us_land.tft b/hmi/nspanel_CJK_us_land.tft index a191595d..210391bb 100644 Binary files a/hmi/nspanel_CJK_us_land.tft and b/hmi/nspanel_CJK_us_land.tft differ diff --git a/hmi/nspanel_easy_landscape.hmi b/hmi/nspanel_easy_landscape.hmi index 79d5c2a7..34624619 100644 Binary files a/hmi/nspanel_easy_landscape.hmi and b/hmi/nspanel_easy_landscape.hmi differ diff --git a/hmi/nspanel_easy_landscape.tft b/hmi/nspanel_easy_landscape.tft index 8c0d258a..b8049f94 100644 Binary files a/hmi/nspanel_easy_landscape.tft and b/hmi/nspanel_easy_landscape.tft differ diff --git a/hmi/nspanel_eu.HMI b/hmi/nspanel_eu.HMI index 62e570ef..16866366 100644 Binary files a/hmi/nspanel_eu.HMI and b/hmi/nspanel_eu.HMI differ diff --git a/hmi/nspanel_eu.tft b/hmi/nspanel_eu.tft index 2888a3ae..b6299589 100644 Binary files a/hmi/nspanel_eu.tft and b/hmi/nspanel_eu.tft differ diff --git a/hmi/nspanel_us.HMI b/hmi/nspanel_us.HMI index 6fd473c5..6794558d 100644 Binary files a/hmi/nspanel_us.HMI and b/hmi/nspanel_us.HMI differ diff --git a/hmi/nspanel_us.tft b/hmi/nspanel_us.tft index 5e54a3ac..6f096402 100644 Binary files a/hmi/nspanel_us.tft and b/hmi/nspanel_us.tft differ diff --git a/hmi/nspanel_us_land.HMI b/hmi/nspanel_us_land.HMI index 310b458c..8bbed52e 100644 Binary files a/hmi/nspanel_us_land.HMI and b/hmi/nspanel_us_land.HMI differ diff --git a/hmi/nspanel_us_land.tft b/hmi/nspanel_us_land.tft index b649f6df..207f07b8 100644 Binary files a/hmi/nspanel_us_land.tft and b/hmi/nspanel_us_land.tft differ diff --git a/nspanel_easy_blueprint.yaml b/nspanel_easy_blueprint.yaml index c99e7702..50c83e18 100644 --- a/nspanel_easy_blueprint.yaml +++ b/nspanel_easy_blueprint.yaml @@ -11,7 +11,7 @@ blueprint: description: > # NSPanel Easy Configuration via Blueprint - **Blueprint release**: 11 + **Blueprint release**: 12 This project enables comprehensive configuration of your NSPanel through a Blueprint featuring a user interface. @@ -4211,11 +4211,12 @@ trigger_variables: }} variables: - blueprint_version: 11 + blueprint_version: 12 pages: current: '{{ states(currentpage) }}' alarm: "alarm" boot: "boot" + button: "button" buttonpages: - "buttonpage01" - "buttonpage02" @@ -5136,7 +5137,7 @@ conditions: trigger.id != "trigger_buttonpage_state" or pages.current in pages.buttonpages or ( - pages.current in [pages.alarm, pages.climate, pages.cover, pages.fan, + pages.current in [pages.alarm, pages.button, pages.climate, pages.cover, pages.fan, pages.light, pages.switch, pages.water_heater] and trigger.entity_id is defined and detailed_entity | length > 0 and @@ -8526,6 +8527,67 @@ actions: visible: true continue_on_error: true + ## PAGE BUTTON ## + - alias: Button page + conditions: + - '{{ nspanel_event is defined }}' + - '{{ nspanel_event.page is defined }}' + - '{{ nspanel_event.page == pages.button }}' + sequence: &refresh_page_button + - &variables_button_entity + variables: + entity_id: > + {{ + nspanel_event.entity + if nspanel_event is defined and nspanel_event.entity is defined and nspanel_event.entity is string and nspanel_event.entity | length > 1 + else (trigger.entity_id if trigger.entity_id is defined else trigger.event.data.entity_id) + }} + - condition: + - '{{ entity_id is defined }}' + - '{{ entity_id is string }}' + - '{{ entity_id.split(".") | count == 2 }}' + - '{{ entity_id.split(".")[0] in ["button", "input_button"] }}' + - *variable_entity + - condition: '{{ entity is defined }}' + + - if: '{{ entity.name is defined and entity.name is string and entity.name | length > 0 }}' + then: + - *delay_default + - action: 'esphome.{{ nspanel_name }}_component_text' + data: + page: "" + id: page_label + txt: '{{ entity.name }}' + continue_on_error: true + - if: '{{ entity.icon is defined and entity.icon is string and entity.icon | length > 0 }}' + then: + - *delay_default + - action: 'esphome.{{ nspanel_name }}_component_text' + data: + page: "" + id: icon_state + txt: '{{ entity.icon }}' + continue_on_error: true + - *delay_default + - action: 'esphome.{{ nspanel_name }}_component_text' + data: + page: "" + id: icon + txt: '{{ entity.icon }}' + continue_on_error: true + - *delay_default + - action: 'esphome.{{ nspanel_name }}_component_val' + data: + page: "" + id: state + val: '{{ -1 if is_state(entity_id, "unavailable") else 0 }}' + continue_on_error: true + - *delay_default + - action: 'esphome.{{ nspanel_name }}_command' + data: + cmd: 'render.en=1' + continue_on_error: true + ## PAGE SWITCH ## - alias: Switch page conditions: @@ -9741,9 +9803,9 @@ actions: - alias: Default conditions: - '{{ last_click_button.hold_select == "Default" }}' - - '{{ entity_domain in ["alarm_control_panel", "climate", "cover", "fan", - "input_boolean", "light", "media_player", "switch", - "water_heater"] }}' + - '{{ entity_domain in ["alarm_control_panel", "button", "climate", "cover", + "fan", "input_boolean", "input_button", "light", + "media_player", "switch", "water_heater"] }}' sequence: - variables: back_page: '{{ pages.home }}' @@ -9884,8 +9946,9 @@ actions: conditions: - '{{ nspanel_event.command == "long_click" or entity_domain in ["alarm_control_panel", "climate", "media_player", "water_heater"] }}' - - '{{ entity_domain in ["alarm_control_panel", "climate", "cover", "fan", "input_boolean", - "light", "media_player", "switch", "water_heater"] }}' + - '{{ entity_domain in ["alarm_control_panel", "button", "climate", "cover", "fan", + "input_boolean", "input_button", "light", "media_player", "switch", + "water_heater"] }}' sequence: - variables: back_page: '{{ nspanel_event.page }}' @@ -10318,6 +10381,13 @@ actions: - '{{ trigger.entity_id is match "alarm_control_panel." }}' - '{{ trigger.entity_id == detailed_entity_state }}' sequence: *refresh_page_alarm + - alias: Button page + conditions: + - '{{ pages.current == pages.button }}' + - '{{ trigger.entity_id.split(".") | count == 2 }}' + - '{{ trigger.entity_id.split(".")[0] in ["button", "input_button"] }}' + - '{{ trigger.entity_id == detailed_entity_state }}' + sequence: *refresh_page_button - alias: Button pages conditions: - '{{ pages.current in pages.buttonpages }}' @@ -10537,6 +10607,13 @@ actions: - '{{ trigger_entity_id.split(".")[0] in ["switch", "input_boolean"] }}' - '{{ trigger_entity_id == detailed_entity_state }}' sequence: *refresh_page_switch + - alias: Button page + conditions: + - '{{ pages.current == pages.button }}' + - '{{ trigger_entity_id.split(".") | count == 2 }}' + - '{{ trigger_entity_id.split(".")[0] in ["button", "input_button"] }}' + - '{{ trigger_entity_id == detailed_entity_state }}' + sequence: *refresh_page_button - alias: 'Alarm page' conditions: - '{{ pages.current == pages.alarm }}'