diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 105b9c5..3ae54e5 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -208,7 +208,7 @@ blueprint: ##### PLACEHOLDER ###################################################################### placeholder02: name: ' ' - description: '# ✅ SENSOR HOME PAGE ✅' + description: '# ✅ HOME PAGE - SENSORS ✅' default: ' ' selector: *placeholder-selector ##### PLACEHOLDER ###################################################################### @@ -316,7 +316,7 @@ blueprint: ##### PLACEHOLDER ###################################################################### placeholder03: name: ' ' - description: '# ✅ CHIPS ✅' + description: '# ✅ HOME PAGE - CHIPS ✅' default: ' ' selector: *placeholder-selector ##### PLACEHOLDER ###################################################################### @@ -496,6 +496,73 @@ blueprint: *Icon color which should be displayed* default: [128, 128, 128] #33808 Grey light selector: *color-selector + ## Custom buttons - Page Home + ##### PLACEHOLDER ###################################################################### + placeholder18: + name: ' ' + description: '# ✅ HOME PAGE - CUSTOM BUTTONS ✅' + default: ' ' + selector: *placeholder-selector + ##### PLACEHOLDER ###################################################################### + ## Page Home - Custom button 01 + home_custom_button01: + name: Custom button 01 - ENTITY (Optional) + description: > + *HOME page* + + *Entity which should be displayed (ONLY climate | cover | fan | light | media_player)* + default: [] + selector: &home-custom-button-entity-selector + entity: + filter: + domain: + - climate + - cover + - fan + - light + - media_player + home_custom_button01_icon: + name: Custom button 01 - ICON (Optional) + description: > + *HOME page* + + *Icon which should be displayed (Default - an icon matching the entity will be set automatically)* + default: [] + selector: *icon-selector + ## Page Home - Custom button 02 + home_custom_button02: + name: Custom button 02 - ENTITY (Optional) + description: > + *HOME page* + + *Entity which should be displayed (ONLY climate | cover | fan | light | media_player)* + default: [] + selector: *home-custom-button-entity-selector + home_custom_button02_icon: + name: Custom button 02 - ICON (Optional) + description: > + *HOME page* + + *Icon which should be displayed (Default - an icon matching the entity will be set automatically)* + default: [] + selector: *icon-selector + ## Page Home - Custom button 03 + home_custom_button03: + name: Custom button 03 - ENTITY (Optional) + description: > + *HOME page* + + *Entity which should be displayed (ONLY climate | cover | fan | light | media_player)* + default: [] + selector: *home-custom-button-entity-selector + home_custom_button03_icon: + name: Custom button 03 - ICON (Optional) + description: > + *HOME page* + + *Icon which should be displayed (Default - an icon matching the entity will be set automatically)* + default: [] + selector: *icon-selector ##### Alarm Control Panel - Page Alarm ##### PLACEHOLDER ###################################################################### @@ -6745,6 +6812,54 @@ action: cmd: home.right_bt_pic.val={{ 1 if right_button_state in ["on", "open", "opened", "opening", "true", true, 1] else 0 }} continue_on_error: true + ###### Custom buttons ###### + - &update-home_page-custom_buttons + if: '{{ true }}' + then: + - &variables-home_page-custom_buttons + variables: + home_page_custom_buttons: + - entity: !input home_custom_button01 + icon: !input home_custom_button01_icon + component: button01 + - entity: !input home_custom_button02 + icon: !input home_custom_button02_icon + component: button02 + - entity: !input home_custom_button03 + icon: !input home_custom_button03_icon + component: button03 + - repeat: + for_each: '{{ home_page_custom_buttons }}' + sequence: &display-home_page-custom_buttons + - if: '{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}' + then: + - service: '{{ nextion.command.text_printf }}' + data: + component: '{{ repeat.item.component }}' + message: > + {% if repeat.item.icon | length > 0 %} + {{ + all_icons[repeat.item.icon.split(":")[1]] | default(all_icons.unknown) + if repeat.item.icon.split(":") | count > 0 + else repeat.item.icon + }} + {% elif repeat.item.entity and repeat.item.entity.split(".") | count > 1 %} + {{ nextion.icon.domain[repeat.item.entity.split(".")[0] if repeat.item.entity else "unknown"] }} + {% else %}{{ nextion.icon.domain.unknown }} + {% endif %} + continue_on_error: true + - *delay-default + - service: '{{ nextion.command.show }}' + data: + component: '{{ repeat.item.component }}' + continue_on_error: true + else: + - service: '{{ nextion.command.hide }}' + data: + component: '{{ repeat.item.component }}' + continue_on_error: true + - *delay-default + ###### Climate chip ###### - &update-home_page-climate_chip if: '{{ (not embedded_climate) and climate is string and climate is match "climate." }}' @@ -7619,6 +7734,7 @@ action: sequence: &refresh_page_media_player - variables: media_player_entity: '{{ nspanel_event.entity if nspanel_event is defined and nspanel_event.entity is defined else trigger.entity_id }}' + wait_completed: false - alias: Refresh page in a loop repeat: sequence: @@ -7629,25 +7745,42 @@ action: continue_on_error: true - delay: milliseconds: 500 + - variables: + media_player: + state: '{{ states(media_player_entity) }}' + is_volume_muted: '{{ state_attr(media_player_entity, "is_volume_muted") | default(false) }}' + friendly_name: '{{ state_attr(media_player_entity, "friendly_name") | default("Media player") }}' + volume_level: '{{ (state_attr(media_player_entity, "volume_level") | round(2, default=0) * 100) | int(0) }}' + media_title: '{{ state_attr(media_player_entity, "media_title") }}' + media_artist: '{{ state_attr(media_player_entity, "media_artist") }}' + media_duration: '{{ state_attr(media_player_entity, "media_duration") | int(0) }}' + media_position: '{{ state_attr(media_player_entity, "media_position") | int(0) }}' + #media_position_updated_at: '{{ state_attr(media_player_entity, "media_position_updated_at") }}' + supported_features: '{{ state_attr(media_player_entity, "supported_features") | int(0) }}' - service: '{{ nextion.command.media_player }}' data: entity: '{{ media_player_entity }}' - state: '{{ states(media_player_entity) }}' - is_volume_muted: '{{ state_attr(media_player_entity, "is_volume_muted") | default(false) }}' - friendly_name: '{{ state_attr(media_player_entity, "friendly_name") | default("Media player") }}' - volume_level: '{{ (state_attr(media_player_entity, "volume_level") | round(2, default=0) * 100) | int(0) }}' - media_title: '{{ state_attr(media_player_entity, "media_title") }}' - media_artist: '{{ state_attr(media_player_entity, "media_artist") }}' - media_duration: '{{ state_attr(media_player_entity, "media_duration") | int(0) }}' - media_position: '{{ state_attr(media_player_entity, "media_position") | int(0) }}' - #media_position_updated_at: '{{ state_attr(media_player_entity, "media_position_updated_at") }}' - supported_features: '{{ state_attr(media_player_entity, "supported_features") | int(0) }}' + state: '{{ media_player.state }}' + is_volume_muted: '{{ media_player.is_volume_muted }}' + friendly_name: '{{ media_player.friendly_name }}' + volume_level: '{{ media_player.volume_level }}' + media_title: '{{ media_player.media_title if media_player.media_title is string and media_player.media_title not in [null, None, "unknown", "unavailable"] else "" }}' + media_artist: '{{ media_player.media_artist if media_player.media_artist is string and media_player.media_artist not in [null, None, "unknown", "unavailable"] else "" }}' + media_duration: '{{ media_player.media_duration }}' + media_position: '{{ media_player.media_position }}' + supported_features: '{{ media_player.supported_features }}' continue_on_error: true - - delay: 10 + - wait_template: '{{ states(currentpage) != page.media_player }}' + timeout: + seconds: 10 + continue_on_timeout: true + - variables: + wait_completed: '{{ wait.completed }}' until: - - not: - - '{{ states(currentpage) == page.media_player }}' # Do not change this to `page.current` as this have to be reloaded every time - - '{{ nspanel_event.type == "page_changed"}}' + - or: + - '{{ wait_completed }}' + - '{{ states(currentpage) != page.media_player }}' # Don't replace this by page.current as this have to be evaluated all the time + - '{{ nspanel_event.type != "page_changed" }}' ## PAGE ALARM ## - alias: Alarm settings page @@ -8479,7 +8612,7 @@ action: - service: '{{ nextion.command.open_entity_settings_page }}' data: page: '{{ button_domain }}' - page_label: '{{ (button_context.name | replace("\\r", " ")) if button_context.name is string and button_context.name | length > 0 else state_attr(button_context.entity, "friendly_name") }}' + page_label: '{{ button_context.name if button_context.name is string and button_context.name | length > 0 else state_attr(button_context.entity, "friendly_name") }}' page_icon: '{{ nextion.icon.domain[button_domain] }}' page_icon_color: [-1 ] #No color set entity: '{{ "embedded_climate" if button_context.entity == thermostat_embedded else button_context.entity }}' @@ -8556,7 +8689,7 @@ action: - service: '{{ nextion.command.open_entity_settings_page }}' data: page: '{{ entity_domain }}' - page_label: '{{ (last_click_button.name | replace("\\r", " ")) if last_click_button.name is string and last_click_button.name | length > 0 else state_attr(last_click_button.entity, "friendly_name") }}' + page_label: '{{ last_click_button.name if last_click_button.name is string and last_click_button.name | length > 0 else state_attr(last_click_button.entity, "friendly_name") }}' page_icon: > {{ all_icons[last_click_button.icon.split(":")[1]] | default(last_click_button.icon if last_click_button.icon is defined and last_click_button.icon is string else nextion.icon.domain[entity_domain]) @@ -8637,6 +8770,44 @@ action: - '{{ entity_domain not in ["unknown", "person", "binary_sensor", "sensor"] }}' sequence: - *service-button_changed + - alias: Home page custom buttons + conditions: + - '{{ nspanel_event.page == page.home }}' + sequence: + - *variables-home_page-custom_buttons + - variables: + last_click_button: '{{ home_page_custom_buttons | selectattr("component", "defined") | selectattr("component", "eq", nspanel_event.component) | list }}' + - condition: '{{ last_click_button | count >= 0 }}' + - variables: + last_click_button: '{{ last_click_button[0] }}' + entity_domain: > + {{ + last_click_button.entity.split(".")[0] | default("unknown") + if + last_click_button.entity is string and + last_click_button.entity | length > 0 and + last_click_button.entity.split(".") | count > 0 + else "unknown" + }} + - if: + - '{{ entity_domain != "cover" or state_attr(last_click_button.entity, "supported_features") | int(0) | bitwise_and(4) > 0 }}' + - '{{ entity_domain != "fan" or state_attr(last_click_button.entity, "supported_features") | int(0) | bitwise_and(1) > 0 }}' + - '{{ entity_domain != "light" or state_attr(last_click_button.entity, "supported_color_modes") | default("unknown") | string not in ["unknown", "onoff", enum.color_mode.unknown, enum.color_mode.onoff, "", none] }}' + then: + - service: '{{ nextion.command.open_entity_settings_page }}' + data: + page: '{{ entity_domain }}' + page_label: '{{ last_click_button.name if last_click_button.name is string and last_click_button.name | length > 0 else state_attr(last_click_button.entity, "friendly_name") }}' + page_icon: > + {{ + all_icons[last_click_button.icon.split(":")[1]] | default(last_click_button.icon if last_click_button.icon is defined and last_click_button.icon is string else nextion.icon.domain[entity_domain]) + if last_click_button.icon not in ["unavailable", "unknown", "", None] and last_click_button.icon | length > 0 + else nextion.icon.domain[entity_domain] + }} + page_icon_color: [-1 ] #No color set + entity: '{{ "embedded_climate" if last_click_button.entity == thermostat_embedded else last_click_button.entity }}' + back_page: '{{ page.home }}' + continue_on_error: true ##### Versions mismatch ##### - alias: Versions diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index 7e519fc..94597a9 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -1397,7 +1397,7 @@ text_sensor: ESP_LOGV("text_sensor.localevent", "Construct new page"); } else if (event=="short_click" or event=="long_click") id(ha_button)->execute(page.c_str(), component.c_str(), event.c_str()); - else if (page == "light" or page == "climate" or page == "notification" or page == "media_player")// Generic event + else if (page == "light" or page == "climate" or page == "notification")// Generic event { ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", { diff --git a/nspanel_eu.HMI b/nspanel_eu.HMI index e7856d0..49951f7 100644 Binary files a/nspanel_eu.HMI and b/nspanel_eu.HMI differ diff --git a/nspanel_eu.tft b/nspanel_eu.tft index 061a4af..9fb1e0a 100644 Binary files a/nspanel_eu.tft and b/nspanel_eu.tft differ diff --git a/nspanel_eu_code/climate.txt b/nspanel_eu_code/climate.txt index 6f26a24..90071dc 100644 --- a/nspanel_eu_code/climate.txt +++ b/nspanel_eu_code/climate.txt @@ -696,7 +696,7 @@ Timer click_timer Events Timer Event - lastclick.txt="{\"page\": \"buttonpage01\", \"event\": \"long_click\", \"component\": \""+click_comp.txt+"\"}" + lastclick.txt="{\"page\": \"climate\", \"event\": \"long_click\", \"component\": \""+click_comp.txt+"\"}" printh 92 prints "localevent",0 printh 00 diff --git a/nspanel_eu_code/home.txt b/nspanel_eu_code/home.txt index 70944d5..7ea80d1 100644 --- a/nspanel_eu_code/home.txt +++ b/nspanel_eu_code/home.txt @@ -52,18 +52,25 @@ Variable (int32) disdim Variable (string) lastclick Attributes - ID : 45 + ID : 39 Scope : local Text : Max. Text Size: 100 Variable (string) climate_entity Attributes - ID : 46 + ID : 40 Scope : global Text : Max. Text Size: 100 +Variable (string) click_comp + Attributes + ID : 48 + Scope : local + Text : + Max. Text Size: 8 + Text time Attributes ID : 5 @@ -142,7 +149,7 @@ Text icon_top_01 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_02 Attributes @@ -152,7 +159,7 @@ Text icon_top_02 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_03 Attributes @@ -162,7 +169,7 @@ Text icon_top_03 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_04 Attributes @@ -172,7 +179,7 @@ Text icon_top_04 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_05 Attributes @@ -182,7 +189,7 @@ Text icon_top_05 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_06 Attributes @@ -192,7 +199,7 @@ Text icon_top_06 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_07 Attributes @@ -202,7 +209,7 @@ Text icon_top_07 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_08 Attributes @@ -212,7 +219,7 @@ Text icon_top_08 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_09 Attributes @@ -222,7 +229,7 @@ Text icon_top_09 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_10 Attributes @@ -232,7 +239,7 @@ Text icon_top_10 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value01_icon Attributes @@ -242,7 +249,7 @@ Text value01_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value03_state Attributes @@ -262,7 +269,7 @@ Text value03_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value02_icon Attributes @@ -272,7 +279,7 @@ Text value02_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value02_state Attributes @@ -302,9 +309,9 @@ Text indoortempicon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 -Text button01_icon +Text bt_notific Attributes ID : 33 Scope : global @@ -312,37 +319,7 @@ Text button01_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 - -Text button02_icon - Attributes - ID : 34 - Scope : global - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text button03_icon - Attributes - ID : 35 - Scope : global - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text bt_notific - Attributes - ID : 36 - Scope : global - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -353,13 +330,13 @@ Text bt_notific Text bt_qrcode Attributes - ID : 37 + ID : 34 Scope : global Dragging : 0 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -367,13 +344,13 @@ Text bt_qrcode Text bt_entities Attributes - ID : 38 + ID : 35 Scope : global Dragging : 0 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -384,13 +361,13 @@ Text bt_entities Text bt_alarm Attributes - ID : 39 + ID : 36 Scope : global Dragging : 0 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -401,7 +378,7 @@ Text bt_alarm Text meridiem Attributes - ID : 44 + ID : 38 Scope : global Dragging : 0 Send Component ID : disabled @@ -409,6 +386,90 @@ Text meridiem Text : Max. Text Size : 10 +Text button01 + Attributes + ID : 45 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 3 + + Events + Touch Press Event + click_comp.txt="button01" + click_timer.en=1 + + Touch Release Event + if(click_timer.en==1) + { + click_timer.en=0 + lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + } + +Text button02 + Attributes + ID : 46 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 3 + + Events + Touch Press Event + click_comp.txt="button02" + click_timer.en=1 + + Touch Release Event + if(click_timer.en==1) + { + click_timer.en=0 + lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + } + +Text button03 + Attributes + ID : 47 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 3 + + Events + Touch Press Event + click_comp.txt="button03" + click_timer.en=1 + + Touch Release Event + if(click_timer.en==1) + { + click_timer.en=0 + lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + } + Picture weather Attributes ID : 9 @@ -418,7 +479,7 @@ Picture weather Dual-state Button left_bt_pic Attributes - ID : 48 + ID : 42 Scope : global Dragging : 0 Send Component ID: disabled @@ -428,7 +489,7 @@ Dual-state Button left_bt_pic Dual-state Button right_bt_pic Attributes - ID : 49 + ID : 43 Scope : global Dragging : 0 Send Component ID: disabled @@ -489,60 +550,9 @@ Hotspot jump_climate page climate } -Hotspot button01 - Attributes - ID : 40 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button01\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - -Hotspot button02 - Attributes - ID : 41 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button02\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - -Hotspot button03 - Attributes - ID : 42 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button03\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - Hotspot settings_click Attributes - ID : 43 + ID : 37 Scope : local Dragging : 0 Send Component ID: disabled @@ -598,7 +608,7 @@ Timer sleeptimer Timer settings_timer Attributes - ID : 47 + ID : 41 Scope : local Period (ms): 1000 Enabled : no @@ -609,7 +619,7 @@ Timer settings_timer Timer wakeup_timer Attributes - ID : 50 + ID : 44 Scope : local Period (ms): 50 Enabled : yes @@ -630,6 +640,24 @@ Timer wakeup_timer wakeup_timer.en=0 } +Timer click_timer + Attributes + ID : 49 + Scope : local + Period (ms): 800 + Enabled : no + + Events + Timer Event + lastclick.txt="{\"page\": \"home\", \"event\": \"long_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + click_timer.en=0 + TouchCap swipe Attributes ID : 3 diff --git a/nspanel_us.HMI b/nspanel_us.HMI index 8032f85..96b4276 100644 Binary files a/nspanel_us.HMI and b/nspanel_us.HMI differ diff --git a/nspanel_us.tft b/nspanel_us.tft index 938312a..0812997 100644 Binary files a/nspanel_us.tft and b/nspanel_us.tft differ diff --git a/nspanel_us_code/climate.txt b/nspanel_us_code/climate.txt index 70d4b27..743d435 100644 --- a/nspanel_us_code/climate.txt +++ b/nspanel_us_code/climate.txt @@ -692,7 +692,7 @@ Timer click_timer Events Timer Event - lastclick.txt="{\"page\": \"buttonpage01\", \"event\": \"long_click\", \"component\": \""+click_comp.txt+"\"}" + lastclick.txt="{\"page\": \"climate\", \"event\": \"long_click\", \"component\": \""+click_comp.txt+"\"}" printh 92 prints "localevent",0 printh 00 diff --git a/nspanel_us_code/home.txt b/nspanel_us_code/home.txt index 77d9314..d57486e 100644 --- a/nspanel_us_code/home.txt +++ b/nspanel_us_code/home.txt @@ -52,18 +52,25 @@ Variable (int32) disdim Variable (string) lastclick Attributes - ID : 45 + ID : 39 Scope : local Text : Max. Text Size: 100 Variable (string) climate_entity Attributes - ID : 46 + ID : 40 Scope : global Text : Max. Text Size: 100 +Variable (string) click_comp + Attributes + ID : 48 + Scope : local + Text : + Max. Text Size: 8 + Text time Attributes ID : 5 @@ -142,7 +149,7 @@ Text icon_top_01 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_02 Attributes @@ -152,7 +159,7 @@ Text icon_top_02 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_03 Attributes @@ -162,7 +169,7 @@ Text icon_top_03 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_04 Attributes @@ -172,7 +179,7 @@ Text icon_top_04 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_05 Attributes @@ -182,7 +189,7 @@ Text icon_top_05 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_06 Attributes @@ -192,7 +199,7 @@ Text icon_top_06 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_07 Attributes @@ -202,7 +209,7 @@ Text icon_top_07 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_08 Attributes @@ -212,7 +219,7 @@ Text icon_top_08 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_09 Attributes @@ -222,7 +229,7 @@ Text icon_top_09 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_10 Attributes @@ -232,7 +239,7 @@ Text icon_top_10 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value01_icon Attributes @@ -242,7 +249,7 @@ Text value01_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value03_state Attributes @@ -262,7 +269,7 @@ Text value03_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value02_icon Attributes @@ -272,7 +279,7 @@ Text value02_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value02_state Attributes @@ -302,9 +309,9 @@ Text indoortempicon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 -Text button01_icon +Text bt_notific Attributes ID : 33 Scope : global @@ -312,37 +319,7 @@ Text button01_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 - -Text button02_icon - Attributes - ID : 34 - Scope : global - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text button03_icon - Attributes - ID : 35 - Scope : global - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text bt_notific - Attributes - ID : 36 - Scope : global - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -353,13 +330,13 @@ Text bt_notific Text bt_qrcode Attributes - ID : 37 + ID : 34 Scope : global Dragging : 0 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -367,13 +344,13 @@ Text bt_qrcode Text bt_entities Attributes - ID : 38 + ID : 35 Scope : global Dragging : 0 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -384,13 +361,13 @@ Text bt_entities Text bt_alarm Attributes - ID : 39 + ID : 36 Scope : global Dragging : 0 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -401,7 +378,7 @@ Text bt_alarm Text meridiem Attributes - ID : 44 + ID : 38 Scope : global Dragging : 0 Send Component ID : disabled @@ -409,6 +386,90 @@ Text meridiem Text : Max. Text Size : 2 +Text button01 + Attributes + ID : 45 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 3 + + Events + Touch Press Event + click_comp.txt="button01" + click_timer.en=1 + + Touch Release Event + if(click_timer.en==1) + { + click_timer.en=0 + lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + } + +Text button02 + Attributes + ID : 46 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 3 + + Events + Touch Press Event + click_comp.txt="button02" + click_timer.en=1 + + Touch Release Event + if(click_timer.en==1) + { + click_timer.en=0 + lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + } + +Text button03 + Attributes + ID : 47 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 3 + + Events + Touch Press Event + click_comp.txt="button03" + click_timer.en=1 + + Touch Release Event + if(click_timer.en==1) + { + click_timer.en=0 + lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + } + Picture weather Attributes ID : 9 @@ -418,7 +479,7 @@ Picture weather Dual-state Button left_bt_pic Attributes - ID : 48 + ID : 42 Scope : global Dragging : 0 Send Component ID: disabled @@ -428,7 +489,7 @@ Dual-state Button left_bt_pic Dual-state Button right_bt_pic Attributes - ID : 49 + ID : 43 Scope : global Dragging : 0 Send Component ID: disabled @@ -489,60 +550,9 @@ Hotspot jump_climate page climate } -Hotspot button01 - Attributes - ID : 40 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button01\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - -Hotspot button02 - Attributes - ID : 41 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button02\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - -Hotspot button03 - Attributes - ID : 42 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button03\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - Hotspot settings_click Attributes - ID : 43 + ID : 37 Scope : local Dragging : 0 Send Component ID: disabled @@ -598,7 +608,7 @@ Timer sleeptimer Timer settings_timer Attributes - ID : 47 + ID : 41 Scope : local Period (ms): 1000 Enabled : no @@ -609,7 +619,7 @@ Timer settings_timer Timer wakeup_timer Attributes - ID : 50 + ID : 44 Scope : local Period (ms): 50 Enabled : yes @@ -630,6 +640,24 @@ Timer wakeup_timer wakeup_timer.en=0 } +Timer click_timer + Attributes + ID : 49 + Scope : local + Period (ms): 800 + Enabled : no + + Events + Timer Event + lastclick.txt="{\"page\": \"home\", \"event\": \"long_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + click_timer.en=0 + TouchCap swipe Attributes ID : 3 diff --git a/nspanel_us_land.HMI b/nspanel_us_land.HMI index cd07af2..c11b2b6 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 54f4cbf..90c9e03 100644 Binary files a/nspanel_us_land.tft and b/nspanel_us_land.tft differ diff --git a/nspanel_us_land_code/climate.txt b/nspanel_us_land_code/climate.txt index 6f26a24..90071dc 100644 --- a/nspanel_us_land_code/climate.txt +++ b/nspanel_us_land_code/climate.txt @@ -696,7 +696,7 @@ Timer click_timer Events Timer Event - lastclick.txt="{\"page\": \"buttonpage01\", \"event\": \"long_click\", \"component\": \""+click_comp.txt+"\"}" + lastclick.txt="{\"page\": \"climate\", \"event\": \"long_click\", \"component\": \""+click_comp.txt+"\"}" printh 92 prints "localevent",0 printh 00 diff --git a/nspanel_us_land_code/home.txt b/nspanel_us_land_code/home.txt index 7a24f0a..60f8ba4 100644 --- a/nspanel_us_land_code/home.txt +++ b/nspanel_us_land_code/home.txt @@ -52,18 +52,25 @@ Variable (int32) disdim Variable (string) lastclick Attributes - ID : 45 + ID : 39 Scope : local Text : Max. Text Size: 100 Variable (string) climate_entity Attributes - ID : 46 + ID : 40 Scope : global Text : Max. Text Size: 100 +Variable (string) click_comp + Attributes + ID : 48 + Scope : local + Text : + Max. Text Size: 8 + Text time Attributes ID : 5 @@ -142,7 +149,7 @@ Text icon_top_01 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_02 Attributes @@ -152,7 +159,7 @@ Text icon_top_02 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_03 Attributes @@ -162,7 +169,7 @@ Text icon_top_03 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_04 Attributes @@ -172,7 +179,7 @@ Text icon_top_04 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_05 Attributes @@ -182,7 +189,7 @@ Text icon_top_05 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_06 Attributes @@ -192,7 +199,7 @@ Text icon_top_06 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_07 Attributes @@ -202,7 +209,7 @@ Text icon_top_07 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_08 Attributes @@ -212,7 +219,7 @@ Text icon_top_08 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_09 Attributes @@ -222,7 +229,7 @@ Text icon_top_09 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text icon_top_10 Attributes @@ -232,7 +239,7 @@ Text icon_top_10 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value01_icon Attributes @@ -242,7 +249,7 @@ Text value01_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value03_state Attributes @@ -262,7 +269,7 @@ Text value03_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value02_icon Attributes @@ -272,7 +279,7 @@ Text value02_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Text value02_state Attributes @@ -302,9 +309,9 @@ Text indoortempicon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 -Text button01_icon +Text bt_notific Attributes ID : 33 Scope : global @@ -312,37 +319,7 @@ Text button01_icon Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 - -Text button02_icon - Attributes - ID : 34 - Scope : global - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text button03_icon - Attributes - ID : 35 - Scope : global - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text bt_notific - Attributes - ID : 36 - Scope : global - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -353,13 +330,13 @@ Text bt_notific Text bt_qrcode Attributes - ID : 37 + ID : 34 Scope : global Dragging : 0 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -367,13 +344,13 @@ Text bt_qrcode Text bt_entities Attributes - ID : 38 + ID : 35 Scope : global Dragging : 0 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -384,13 +361,13 @@ Text bt_entities Text bt_alarm Attributes - ID : 39 + ID : 36 Scope : global Dragging : 0 Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 3 Events Touch Release Event @@ -401,7 +378,7 @@ Text bt_alarm Text meridiem Attributes - ID : 44 + ID : 38 Scope : global Dragging : 0 Send Component ID : disabled @@ -409,6 +386,90 @@ Text meridiem Text : Max. Text Size : 10 +Text button01 + Attributes + ID : 45 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 3 + + Events + Touch Press Event + click_comp.txt="button01" + click_timer.en=1 + + Touch Release Event + if(click_timer.en==1) + { + click_timer.en=0 + lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + } + +Text button02 + Attributes + ID : 46 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 3 + + Events + Touch Press Event + click_comp.txt="button02" + click_timer.en=1 + + Touch Release Event + if(click_timer.en==1) + { + click_timer.en=0 + lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + } + +Text button03 + Attributes + ID : 47 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 3 + + Events + Touch Press Event + click_comp.txt="button03" + click_timer.en=1 + + Touch Release Event + if(click_timer.en==1) + { + click_timer.en=0 + lastclick.txt="{\"page\": \"home\", \"event\": \"short_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + } + Picture weather Attributes ID : 9 @@ -418,7 +479,7 @@ Picture weather Dual-state Button left_bt_pic Attributes - ID : 48 + ID : 42 Scope : global Dragging : 0 Send Component ID: disabled @@ -428,7 +489,7 @@ Dual-state Button left_bt_pic Dual-state Button right_bt_pic Attributes - ID : 49 + ID : 43 Scope : global Dragging : 0 Send Component ID: disabled @@ -489,60 +550,9 @@ Hotspot jump_climate page climate } -Hotspot button01 - Attributes - ID : 40 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button01\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - -Hotspot button02 - Attributes - ID : 41 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button02\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - -Hotspot button03 - Attributes - ID : 42 - Scope : local - Dragging : 0 - Send Component ID: disabled - - Events - Touch Release Event - lastclick.txt="{\"page\": \"home\", \"component\": \"button03\", \"value\": \"release\"}" - printh 92 - prints "nspanelevent",0 - printh 00 - prints lastclick.txt,0 - printh 00 - printh FF FF FF - Hotspot settings_click Attributes - ID : 43 + ID : 37 Scope : local Dragging : 0 Send Component ID: disabled @@ -598,7 +608,7 @@ Timer sleeptimer Timer settings_timer Attributes - ID : 47 + ID : 41 Scope : local Period (ms): 1000 Enabled : no @@ -609,7 +619,7 @@ Timer settings_timer Timer wakeup_timer Attributes - ID : 50 + ID : 44 Scope : local Period (ms): 50 Enabled : yes @@ -630,6 +640,24 @@ Timer wakeup_timer wakeup_timer.en=0 } +Timer click_timer + Attributes + ID : 49 + Scope : local + Period (ms): 800 + Enabled : no + + Events + Timer Event + lastclick.txt="{\"page\": \"home\", \"event\": \"long_click\", \"component\": \""+click_comp.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints lastclick.txt,0 + printh 00 + printh FF FF FF + click_timer.en=0 + TouchCap swipe Attributes ID : 3