diff --git a/.github/workflows/validate_esphome_beta.yml b/.github/workflows/validate_esphome_beta.yml index 81e7f91..ab5a45f 100644 --- a/.github/workflows/validate_esphome_beta.yml +++ b/.github/workflows/validate_esphome_beta.yml @@ -2,9 +2,9 @@ name: Validate ESPHome (beta) on: workflow_dispatch: - pull_request: - paths: - - "nspanel_esphome*.yaml" + #pull_request: + # paths: + # - "nspanel_esphome*.yaml" #schedule: #- cron: "0 0 * * *" diff --git a/.gitignore b/.gitignore index f78c73f..db0c583 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ Nextion2Text.* # Ignore dev folder dev -nspanel_esphome_prebuilt.yaml \ No newline at end of file +nspanel_esphome_prebuilt.yaml diff --git a/.test/esphome_advanced_climate_heat_customizations.yaml b/.test/esphome_advanced_climate_heat_customizations.yaml index f442331..c86b074 100644 --- a/.test/esphome_advanced_climate_heat_customizations.yaml +++ b/.test/esphome_advanced_climate_heat_customizations.yaml @@ -120,14 +120,14 @@ light: on_turn_on: then: - lambda: |- - ESP_LOGV("light.display_light", "Turn-on"); - if (id(current_page).state == "screensaver") id(disp1).goto_page(id(wakeup_page_name).state.c_str()); - id(timer_reset_all).execute(id(wakeup_page_name).state.c_str()); + ESP_LOGD("light.display_light", "Turn-on"); + if (current_page->state == "screensaver") disp1->goto_page(wakeup_page_name->state.c_str()); + timer_reset_all->execute(wakeup_page_name->state.c_str()); on_turn_off: then: - lambda: |- - ESP_LOGV("light.display_light", "Turn-off"); - id(disp1).goto_page("screensaver"); + ESP_LOGD("light.display_light", "Turn-off"); + disp1->goto_page("screensaver"); logger: # Enable hardware UART serial logging @@ -146,22 +146,22 @@ output: write_action: - lambda: |- ESP_LOGV("output.display_output", "state: %f", state); - uint current_brightness = int(round(id(display_light).current_values.is_on() ? (id(display_light).current_values.get_brightness() * 100.0f) : 0.0)); + uint8_t current_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0)); ESP_LOGV("output.display_output", "current_brightness: %i%%", current_brightness); - id(set_brightness).execute(current_brightness); - + set_brightness->execute(current_brightness); + script: # Updates the existing `page_changed` script to update the `display_light` status when a page changes - id: !extend page_changed then: - lambda: |- - ESP_LOGV("script.page_changed(custom)", "page: %s", page.c_str()); - ESP_LOGV("script.page_changed(custom)", "is_on(): %i", id(display_light).current_values.is_on() ? 1 : 0); - if (page == "screensaver" and id(display_light).current_values.is_on()) { - auto call = id(display_light).turn_off(); + ESP_LOGD("script.page_changed(custom)", "page: %s", page.c_str()); + ESP_LOGV("script.page_changed(custom)", "is_on(): %s", display_light->current_values.is_on() ? "True" : "False"); + if (page == "screensaver" and display_light->current_values.is_on()) { + auto call = display_light->turn_off(); call.perform(); - } else if (page != "screensaver" and (not id(display_light).current_values.is_on())) { - auto call = id(display_light).turn_on(); + } else if (page != "screensaver" and (not display_light->current_values.is_on())) { + auto call = display_light->turn_on(); call.perform(); } @@ -169,14 +169,19 @@ script: - id: !extend set_brightness then: - lambda: |- - ESP_LOGD("script.set_brightness(custom)", "brightness: %i", brightness); - if (id(current_page).state != "screensaver" and brightness > 0) { - auto call = id(display_light).turn_on(); - call.set_brightness(static_cast(id(display_last_brightness)) / 100.0f); - call.perform(); - } else { - auto call = id(display_light).turn_off(); - call.perform(); + ESP_LOGD("script.set_brightness(custom)", "brightness: %i%%", brightness); + uint8_t current_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0)); + ESP_LOGV("script.set_brightness(custom)", "current_brightness: %i%%", current_brightness); + if (brightness != current_brightness) { + if (current_page->state != "screensaver" and brightness > 0) { + auto call = display_light->turn_on(); + call.set_brightness(static_cast(id(display_last_brightness)) / 100.0f); + call.perform(); + } else if (display_light->current_values.is_on()) { + auto call = display_light->turn_off(); + call.set_brightness(0); + call.perform(); + } } time: diff --git a/ReleaseNotes.md b/ReleaseNotes.md index da4f711..7609539 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,4 +1,4 @@ -# v4.1.1 - Easier TFT transfer +# v4.2 <= pending update ## Support this project @@ -7,7 +7,7 @@ [![Paypal](https://user-images.githubusercontent.com/41958506/212499642-b2fd097a-0938-4bfc-b37b-74df64592c58.png)](https://www.paypal.com/donate/?hosted_button_id=S974SWQMB8PB2)   -## General +## General <= pending update The focus this time was on making easier to transfer the TFT files. As this project grows with features, it becomes more hungry of resources from all sides (ESPHome, your Home Assistant server and even the Nextion display) and with that the chances of something going wrong when updating increased. @@ -16,12 +16,12 @@ So at this release we concentrated on cleaning up de code everywhere and shave s   ## Updating -Since in this update lots of input to the blueprint changed, we highly recommend you review your settings and make sure all fields have the correct selection. We did our best to support your legacy settings and avoid breaking your system, but please double check your settings if you see something not working as expected. +Updates may come with changes on the blueprint inputs and we highly recommend you review your settings and make sure all fields have the correct selection. We did our best to support your legacy settings and avoid breaking your system, but please double check your settings if you see something not working as expected. ### Files that need to be reloaded: -1. nspanel_eu.tft, nspanel_us.tft or nspanel_us_land.tft - v4.1.4 -2. nspanel_esphome.yaml - v4.1.4 -3. nspanel_blueprint.yaml - v4.1.4 +1. nspanel_eu.tft, nspanel_us.tft or nspanel_us_land.tft - v4.2 +2. nspanel_esphome.yaml - v4.2 +3. nspanel_blueprint.yaml - v4.2 #### @@ -33,152 +33,33 @@ Since in this update lots of input to the blueprint changed, we highly recommend   ## Breaking changes -1. Home Assistant 2023.9.0 or later is now required -
This is necessary in order to support the new [Weather Forecast Service](https://www.home-assistant.io/blog/2023/09/06/release-20239/#weather-forecast-service). -
The legacy forecast based on attributes will be deprecated in Home Assistant on the begining of 2024. +1. Service `esphome.xxxxx_set_component_color` parameter `background` is deprecated. -2. The following components are now deprecated: - - Buttons: - - Exit reparse (`button.xxxxx_exit_reparse`) - It shouldn't be necessary with the new TFT upload engine - - ~~Services:~~ - - ~~Play rtttl (`esphome.xxxxx_play_rtttl`)~~ - - Sensors: - - API uptime - - Device uptime - - RSSI - - ESPhome Version - - IP - - SSID - - BSSID - - ESPHome components: - - Web server - - You can still add these components (except by "Exit reparse") by adding the file `nspanel_esphome_advanced.yaml` in your ESPHome settings as in the example bellow, but please have in mind that these are not used by the blueprint and will be using some memory of your ESPHome. -```yaml -... -packages: - remote_package: - url: https://github.com/Blackymas/NSPanel_HA_Blueprint - ref: main - files: - - nspanel_esphome.yaml # Core package - - nspanel_esphome_advanced.yaml # activate advanced (legacy) elements - can be useful for troubleshooting -... -``` - -3. Very long press on hardware buttons -
If you have a custom automation using very long hold (more than 15s) of hardware buttons it may fail as now the panel will restart with button hold for 15s. - -4. Logger via UART is disable -
You can add it back as a [customization](https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/%28EN%29-Customization/_edit#logger-via-uart). -5. Service `notification_show` parameter `text` was renamed to `message` to support ESPHome 2023.11.0. - -6. Buttons now will run an automation -
On the previous versions, a button with an automation will enable or disable the automation. Now the button will trigger the automation. -
If you want the legacy behavior, please create a script to enable/disable the automation and assign this to your button. 😉   ## Overview of noteworthy changes -1. New Upload TFT engine -2. Hardware restarts with button hold for 15s -3. Support to `esp-idf` framework -4. Support to 921600 bps -5. Font size for chips -6. Short click to open Climate and Media Player - -- 4.1.1 patch: - - Service `esphome.xxxxx_play_rtttl` is back to core package - - Stop the fallback to Home page when Notification or Confirm pages are shown - - Display current temperature on buttons even when climate is off - - Buttons on both the Home and Buttons pages shows entity's icon when available -- 4.1.2 patch: - - Fix light icon color not being used for buttons - - Add option to wake-up to Climate page - - New switch "Nextion display - Power" which can turn the screen on/off - - Fix for button image update when local fallback is enabled. - - Don't show thermostat chip when state is `auto` and no action is available. - - Fallback to legacy forecast (attributes based) when new method (service based) fails. - - Fix custom buttons icons not updating on Home page - - Fix Nextion not communicating with ESPHome 2023.11.6 -- 4.1.3 patch: - - Upload TFT remove dependency to from ESPHome Nextion component - - Fix light icon color on buttons - - Fix climate page not updating properly -- 4.1.4 patch: - - Supports new `weather.get_forecasts` introduced by Home Assistant 2023.12.0 - - Manual line break on multiline text with `\r` +1. Standardized entity's icons   ## Details of noteworthy changes -### 1. New Upload TFT engine -We rebuilt the Upload TFT engine and now it will be using less resources from ESPHome during the transfer and, in addition, will provide more logs for troubleshooting. - -The original engine from Nextion component still as a fallback in case the new engine fails, but it might be removed in a future version. +### 1. Standardized entity's icons +The engine for defining the icons to be shown and it's color was standardize between all the pages, so now you may see a more consistent User's Interface.   -### 2. Hardware restarts with button hold for 15s -Now if you press the hardware buttons for more than 15s, the panel will act as the following: -| Button | Action | Details | -| :--: | :--: | :- | -| Left | Power cycle the screen | It can remove the need to power cycle the panel when the screen can't stablish connection to ESPHome (`Nextion is not connected!` on logs). | -| Right | Restarts the panel | It is equivalent to press the "Restart" button on the Settings page or from Home Assistant, but is available even when the Wi-Fi isn't connected or Home Assistant is out. | - -  -### 3. Support to `esp-idf` framework -Although this project still using ESPHome default framework (currently `arduino`), we started supporting the framework `esp-idf` as this is a recomendation from ESPHome team since an year ago or so. -The `arduino` protocol still more popular and therefore more components are available, but there are some advantages with the ESP-IDF framework: -- It is updated more frequently by EspressIF, which means it is more secure and stable. -- It reduces a layer, as Arduino is developed in top of ESP-IDF, so basically we are changing from ESPHome -> Arduino -> ESP-IDF -> Hardware to ESPHome -> ESP-IDF -> Hardware. -- By reducing a layer, more memory is available for future features and for the custom components you might want to add to your panel. -- The memory management is more efficient, which makes critical tasks, like uploading a TFT file, more reliable. -
In the future we will probably make this as the default framework, so if you are a new user or if for some reason you have to flash your panel via serial/usb, it's a good idea to change to ESP-IDF now. -
Please look at [customizations docs in the Wiki](https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/(EN)-Customization#framework-esp-idf) for more details on how to change the framework. -
-> The ESP-IDF framework will be used when you enable the advanced mode. - -  -### 4. Support to 921600 bps -Until this point, the communication between ESPHome and the Nextion display is at 115200 bps. This is not changing for now, but we are preparing to change this in the near future to a higer rate of 921600 bps, which is 8 times higher than the one used currently. -After installing the latest TFT v4.1, you will be able to [change the speed as a customization](https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/(EN)-Customization#change-uarts-baud-rate) and your system will switch to the higher transfer rate after the next boot. -
In most of the cases, you are not going to see any diference related tho this change, but it will reduce significantly the time to upload a TFT file. - -  -### 5. Font size for chips -We ran a poll, the maiority select one option, but we respect the minority and... we supported both options. :smiley: -
Now you can have your chips a bit bigger, making it easier to see from the distance: - -| 24px | 32px | -| :--: | :--: | -| As before | New option | -| ![EU font 8](https://github.com/Blackymas/NSPanel_HA_Blueprint/assets/94725493/dfb79856-8456-443c-b4de-a955be8e4561) | ![EU font 9](https://github.com/Blackymas/NSPanel_HA_Blueprint/assets/94725493/268ec945-94dc-4f17-be94-8abd691ef2ed) | -| ![US font 8](https://github.com/Blackymas/NSPanel_HA_Blueprint/assets/94725493/a9eb3578-901a-444f-9d52-3909f2aa4f34) | ![US font 9](https://github.com/Blackymas/NSPanel_HA_Blueprint/assets/94725493/e46bac5e-8a84-4cfe-a01d-159042828350) | - -If you wanna try the new option, just go to your blueprint setting and select the font size: -![image](https://github.com/Blackymas/NSPanel_HA_Blueprint/assets/94725493/83e64dfa-b2cf-4186-af2a-6f89c96e9044) - -  -### 6. Short click to open Climate and Media Player -Now on any button page, buttons assigned to Climate or Media Player entities will always open the detailed page. As it is hard to define an adequate toggle action for all the different cases, it makes more sense to just open the page and let the control to the users. +### 2.   ## Next topics we are currently working on See here: https://github.com/Blackymas/NSPanel_HA_Blueprint/labels/roadmap +  ## Special thanks to: -- @misery - Fixing a typo in the docs (#1176) -- @Floppe - Adding space for value fields on Home page (#1180) -- @bkbartk: - - Display current temperature on buttons even when climate is off (#1268) - - Button pages shows entity's icon when available (#1269) - - Home page buttons shows entity's icon when available (#1276) - - New switch "Nextion display - Power" which can turn the screen on/off (#1327) - - Fix for button image update when local fallback is enabled (#1333) ## New Contributors -@misery -@Floppe -@bkbartk ## Previous releases +- [v4.1.2 - Bug fixes and minor enhancements](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.1.2) +- [v4.1.1 - UI Enhancements and Reintroduction of `play_rtttl` Service](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.1.1) - [v4.1 - Easier TFT transfer](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.1) - [v4.0.2 - Bug fixes](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.0.2) - [v4.0.1 - Bug fixes](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.0.1) diff --git a/custom_configuration/nspanel_blank.HMI b/custom_configuration/nspanel_blank.HMI index 61a391f..7fb4a37 100644 Binary files a/custom_configuration/nspanel_blank.HMI and b/custom_configuration/nspanel_blank.HMI differ diff --git a/custom_configuration/nspanel_blank.tft b/custom_configuration/nspanel_blank.tft index f93e2d2..e3ef411 100644 Binary files a/custom_configuration/nspanel_blank.tft and b/custom_configuration/nspanel_blank.tft differ diff --git a/custom_configuration/nspanel_blank_code/blank.txt b/custom_configuration/nspanel_blank_code/blank.txt index 6b85507..9a8214a 100644 --- a/custom_configuration/nspanel_blank_code/blank.txt +++ b/custom_configuration/nspanel_blank_code/blank.txt @@ -3,7 +3,7 @@ Page blank ID : 0 Scope : local Dragging : 0 - Send Component ID : disabled + Send Component ID : on press and release Locked : no Swide up page ID : disabled Swide down page ID : disabled @@ -22,7 +22,7 @@ Page blank printh 92 prints "nspanelevent",0 printh 00 - prints "{\"page\": \"blank\", \"component\": \"currentpage\", \"value\": \"pagechange\", \"version\": \"2023.11.0\"}",0 + prints "{\"page\": \"blank\", \"component\": \"currentpage\", \"value\": \"pagechange\", \"version\": \"2023.11.1\"}",0 printh 00 printh FF FF FF covx baud,baud_rate.txt,0,0 @@ -48,7 +48,7 @@ Text file_name ID : 4 Scope : local Dragging : 0 - Send Component ID : disabled + Send Component ID : on press and release Associated Keyboard: none Text : nspanel_blank.tft Max. Text Size : 20 @@ -67,7 +67,7 @@ Text baud_rate ID : 5 Scope : local Dragging : 0 - Send Component ID : disabled + Send Component ID : on press and release Associated Keyboard: none Text : Max. Text Size : 20 @@ -95,7 +95,7 @@ Text tft_version ID : 6 Scope : local Dragging : 0 - Send Component ID : disabled + Send Component ID : on press and release Associated Keyboard: none Text : TFT: v2023.11.2 Max. Text Size : 20 @@ -133,7 +133,7 @@ Text esp_version ID : 8 Scope : local Dragging : 0 - Send Component ID : disabled + Send Component ID : on press and release Associated Keyboard: none Text : ESP: Waiting... Max. Text Size : 20 @@ -152,7 +152,7 @@ QR Code qr0 ID : 1 Scope : local Dragging : 0 - Send Component ID: disabled + Send Component ID: on press and release Text : https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/en/nspanel_blank.md#what-to-do-after-installing-nspanel_blanktft Max. Text Size : 150 diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 3a97779..aef5766 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -33,7 +33,7 @@ blueprint: 🎉 Roadmap can be found here: [Roadmap](https://github.com/Blackymas/NSPanel_HA_Blueprint/labels/roadmap) - â„šī¸ Version: v4.1.4 + â„šī¸ Version: v4.2dev source_url: https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/nspanel_blueprint.yaml domain: automation @@ -3526,7 +3526,7 @@ blueprint: Attention! The **"Folder-Watcher"** must also be configured in the configuration.yaml. - **Only necessary for manual upload of TFT file in ESPHome Advaced mode.** + **Only necessary for manual upload of TFT file in ESPHome Advanced mode.** See HowTo* default: [] @@ -3599,7 +3599,7 @@ trigger_variables: variables: ##### GENERAL ##### - blueprint_version: '4.1.4' + blueprint_version: '4.2dev' date_format_temp: !input 'date_format' #Avoid breaking change for existing users with legacy type format date_format: > @@ -6449,7 +6449,7 @@ condition: conditions: - '{{ trigger.event is defined and trigger.event.data is defined }}' - '{{ trigger.event.data.entity_id is defined }}' - #- '{{ trigger.event.data.entity_id is match "light." }}' + - '{{ trigger.event.data.entity_id is match "light." }}' - condition: and conditions: - '{{ trigger.event is defined and trigger.event.data is defined }}' @@ -6532,6 +6532,106 @@ condition: ##### START - Action ##### ############################################################# action: + - if: '{{ false }}' # Global anchor repository + then: + - variables: + entity_id: '{{ None }}' + overlap: + icon: '{{ None }}' + icon_color: '{{ None }}' + frendly_name: '{{ None }}' + - &variable_entity #DEBUG + variables: + entity_id_is_valid: '{{ entity_id is defined and entity_id is string and entity_id.split(".") | count == 2 }}' + entity_state: '{{ states(entity_id) | default(None) if entity_id_is_valid else None }}' + entity_domain: '{{ entity_id.split(".")[0] if entity_id_is_valid else None }}' + entity_hvac_action: '{{ state_attr(entity_id, "hvac_action") | default(None) if entity_id_is_valid else None }}' + entity_climate_action: '{{ (entity_hvac_action if entity_hvac_action not in ["unavailable", "unknown", "", None] else entity_state) if entity_domain == "climate" else None }}' + entity_rgb_color: '{{ state_attr(entity_id, "rgb_color") | default(None) if entity_id_is_valid else None }}' + entity_brightness: '{{ state_attr(entity_id, "brightness") | default(None) if entity_id_is_valid else None }}' + entity_brightness_index: '{{ (entity_brightness | int(255))/255 if entity_brightness else 1 }}' + entity_icon: '{{ state_attr(entity_id, "icon") | default(None) if entity_id_is_valid else None }}' + entity_icon_color: > + {{ + entity_rgb_color | list + if entity_rgb_color is sequence + else + ( + nextion.color.on + if entity_state in enum.states.on + else nextion.color.off + ) + }} + entity_icon_color_adjusted: > + {{ + [ + min(255,entity_icon_color[0] * entity_brightness_index) | round(0), + min(255,entity_icon_color[1] * entity_brightness_index) | round(0), + min(255,entity_icon_color[2] * entity_brightness_index) | round(0) + ] + if entity_icon_color is sequence and entity_icon_color | count == 3 + else entity_icon_color + }} + entity: + id: '{{ entity_id }}' + valid: '{{ entity_id_is_valid }}' + has_value: '{{ has_value(entity_id) if entity_id_is_valid else false }}' + state: '{{ entity_state }}' + state_is_number: '{{ is_number(entity_state) }}' + domain: '{{ entity_domain }}' + unit_of_measurement: '{{ state_attr(entity_id, "unit_of_measurement") | default(None) if entity_id_is_valid else None }}' + friendly_name: > + {{ + overlap.frendly_name + if overlap is defined and overlap.frendly_name is defined and overlap.frendly_name is string + else + ( + state_attr(entity_id, "friendly_name") | default(None) + if entity_id_is_valid + else None + ) + }} + supported_features: '{{ state_attr(entity_id, "supported_features") | default(None) if entity_id_is_valid else None }}' + icon: > + {% set icon_domain = nextion.icon.domain[entity_domain] | default(all_icons.blank) %} + {% if overlap is defined and overlap.icon is defined and overlap.icon is string and overlap.icon.split(":") | count == 2 %} + {{ all_icons[overlap.icon[1]] | default(icon_domain) }} + {% elif entity_domain == "climate" %} + {% if "off" in entity_climate_action %}{{ all_icons.blank }} + {% elif "heating" in entity_climate_action or "heat" in entity_climate_action %}{{ all_icons["thermometer-lines"] }} + {% elif "cooling" in entity_climate_action or "cool" in entity_climate_action %}{{ all_icons.snowflake }} + {% elif "drying" in entity_climate_action or "dry" in entity_climate_action %}{{ all_icons["water-percent"] }} + {% elif "fan" in entity_climate_action or "fan_only" in entity_climate_action %}{{ all_icons.fan }} + {% elif "heat_cool" in entity_climate_action %}{{ all_icons.autorenew }} + {% elif "auto" in entity_climate_action %}{{ all_icons.blank }} + {% elif "idle" in entity_climate_action %}{{ all_icons.thermometer }} + {% else %}{{ icon_domain }} + {% endif %} + {% else %} + {{ + all_icons[entity_icon[1]] | default(icon_domain) + if entity_id_is_valid and entity_icon is string and entity_icon.split(":") | count == 2 + else icon_domain + }} + {% endif %} + icon_color: > + {% if entity_domain == "climate" %} + {% if "off" in entity_climate_action %}{{ nextion.color["off"] }} + {% elif "heating" in entity_climate_action or "heat" in entity_climate_action %}{{ nextion.color["deep-orange"]}} + {% elif "cooling" in entity_climate_action or "cool" in entity_climate_action %}{{ nextion.color["blue"] }} + {% elif "drying" in entity_climate_action or "dry" in entity_climate_action %}{{ nextion.color["orange"] }} + {% elif "fan" in entity_climate_action or "fan_only" in entity_climate_action %}{{ nextion.color["cyan"] }} + {% elif "heat_cool" in entity_climate_action %}{{ nextion.color["amber"] }} + {% elif "auto" in entity_climate_action %}{{ nextion.color["off"] }} + {% elif "idle" in entity_climate_action %}{{ nextion.color["off"] }} + {% else %}{{ nextion.color["off"] }} + {% endif %} + {% else %}{{ entity_icon_color_adjusted }} + {% endif %} + rgb_color: '{{ entity_rgb_color }}' + hvac_action: '{{ entity_hvac_action }}' + climate_action: '{{ entity_climate_action }}' + - alias: Main choices choose: ##### DATE ##### @@ -6837,7 +6937,6 @@ action: data: component: home.outdoor_temp foreground: '{{ [ outdoor_temp_color_rgb ] if is_number(outdoor_temp_color_rgb) else outdoor_temp_color_rgb }}' - background: [] continue_on_error: true ### LABEL Outdoor Temp Font ### - *delay-default @@ -6895,7 +6994,6 @@ action: data: component: home.indoortempicon foreground: '{{ [ indoor_temp.icon.color_rgb ] if is_number(indoor_temp.icon.color_rgb) else indoor_temp.icon.color_rgb }}' - background: [] continue_on_error: true ### ICON Indoor Temp Font ### - *delay-default @@ -6920,7 +7018,6 @@ action: data: component: home.current_temp foreground: '{{ [ indoor_temp.label.color_rgb ] if is_number(indoor_temp.label.color_rgb) else indoor_temp.label.color_rgb }}' - background: [] continue_on_error: true - if: '{{ not embedded_indoor_temperature }}' then: @@ -6947,7 +7044,6 @@ action: data: component: home.left_bt_text foreground: '{{ [ hardware.buttons.left.color_rgb ] if is_number(hardware.buttons.left.color_rgb) else hardware.buttons.left.color_rgb }}' - background: [] continue_on_error: true ### LABEL Font ### - *delay-default @@ -6976,7 +7072,6 @@ action: data: component: home.right_bt_text foreground: '{{ [ hardware.buttons.right.color_rgb ] if is_number(hardware.buttons.right.color_rgb) else hardware.buttons.right.color_rgb }}' - background: [] continue_on_error: true ### LABEL Font ### - *delay-default @@ -7019,54 +7114,20 @@ action: if: '{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}' then: - variables: - entity_domain: '{{ repeat.item.entity.split(".")[0] if repeat.item.entity and repeat.item.entity.split(".") | count > 1 else "unknown" }}' - entity_state: '{{ states(repeat.item.entity) }}' - rgb_color: '{{ state_attr(repeat.item.entity, "rgb_color") | default(None) }}' - brightness: '{{ (state_attr(repeat.item.entity, "brightness") | int(255))/255 }}' - icon_color: > - {{ - rgb_color | list - if rgb_color is sequence - else - ( - nextion.color.on - if entity_state in enum.states.on - else nextion.color.off - ) - }} - icon_color_adjusted: > - {{ - [ - min(255,icon_color[0] * brightness) | round(0), - min(255,icon_color[1] * brightness) | round(0), - min(255,icon_color[2] * brightness) | round(0) - ] - if icon_color is sequence and icon_color | count == 3 - else icon_color - }} + entity_id: '{{ repeat.item.entity }}' + overlap: + icon: '{{ repeat.item.icon }}' + - *variable_entity - service: '{{ nextion.command.set_component_color }}' data: component: 'home.{{ repeat.item.component }}' - foreground: '{{ icon_color_adjusted }}' - background: [] + foreground: '{{ entity.icon_color }}' continue_on_error: true - *delay-default - service: '{{ nextion.command.text_printf }}' data: component: 'home.{{ 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 state_attr(repeat.item.entity, "icon") | default("") not in ["unavailable", "unknown", "", None] and all_icons[state_attr(repeat.item.entity, "icon").split(":")[1]] != null %} - {{ all_icons[state_attr(repeat.item.entity, "icon").split(":")[1]] | default(all_icons.unknown) }} - {% elif repeat.item.entity and repeat.item.entity.split(".") | count > 1 %} - {{ nextion.icon.domain[entity_domain] }} - {% else %}{{ nextion.icon.domain.unknown }} - {% endif %} + message: '{{ entity.icon }}' continue_on_error: true - if: '{{ page.current == page.home }}' then: @@ -7086,49 +7147,27 @@ action: ###### Climate chip ###### - &update-home_page-climate_chip if: '{{ (not embedded_climate) and climate is string and climate is match "climate." }}' - then: - - if: '{{ has_value(climate) }}' + then: # DEBUG + - variables: + entity_id: '{{ climate }}' + - *variable_entity + - if: '{{ entity.has_value }}' then: - - variables: - climate_state: '{{ states(climate) | default("unavailable") if climate is string else "unavailable" }}' - hvac_action: '{{ state_attr(climate, "hvac_action") | default("unavailable") if climate is string else "unavailable" }}' - climate_action: '{{ hvac_action if hvac_action not in ["unavailable", "unknown", "", None] else climate_state }}' - *delay-default - - if: '{{ climate_action in ["off", "heating", "heat", "cooling", "cool", "dry", "fan", "fan_only", "heat_cool", "auto", "idle"] }}' + - if: '{{ entity.climate_action in ["off", "heating", "heat", "cooling", "cool", "dry", "fan", "fan_only", "heat_cool", "auto", "idle"] }}' then: ### ICON Font Color ### - service: '{{ nextion.command.set_component_color }}' data: component: home.icon_top_03 - foreground: > - {% if "off" in climate_action %}{{ nextion.color["off"] }} - {% elif "heating" in climate_action or "heat" in climate_action %}{{ nextion.color["deep-orange"]}} - {% elif "cooling" in climate_action or "cool" in climate_action %}{{ nextion.color["blue"] }} - {% elif "drying" in climate_action or "dry" in climate_action %}{{ nextion.color["orange"] }} - {% elif "fan" in climate_action or "fan_only" in climate_action %}{{ nextion.color["cyan"] }} - {% elif "heat_cool" in climate_action %}{{ nextion.color["amber"] }} - {% elif "auto" in climate_action %}{{ nextion.color["off"] }} - {% elif "idle" in climate_action %}{{ nextion.color["off"] }} - {% else %}{{ nextion.color["off"] }} - {% endif %} - background: [] + foreground: '{{ entity.icon_color }}' continue_on_error: true ### ICON Font ### - *delay-default - service: '{{ nextion.command.text_printf }}' data: component: home.icon_top_03 - message: > - {% if "off" in climate_action %}{{ all_icons.blank }} - {% elif "heating" in climate_action or "heat" in climate_action %}{{ all_icons["thermometer-lines"] }} - {% elif "cooling" in climate_action or "cool" in climate_action %}{{ all_icons.snowflake }} - {% elif "drying" in climate_action or "dry" in climate_action %}{{ all_icons["water-percent"] }} - {% elif "fan" in climate_action or "fan_only" in climate_action %}{{ all_icons.fan }} - {% elif "heat_cool" in climate_action %}{{ all_icons.autorenew }} - {% elif "auto" in climate_action %}{{ all_icons.blank }} - {% elif "idle" in climate_action %}{{ all_icons.thermometer }} - {% else %}{{ all_icons.blank }} - {% endif %} + message: '{{ entity.icon }}' continue_on_error: true else: - &hide-home_page-climate_chip @@ -7201,7 +7240,6 @@ action: data: component: 'home.{{ repeat.item.component }}' foreground: '{{ [ repeat.item.icon_color_rgb ] if is_number(repeat.item.icon_color_rgb) else repeat.item.icon_color_rgb }}' - background: [] continue_on_error: true ### ICON Font ### - *delay-default @@ -7257,7 +7295,6 @@ action: data: component: '{{ repeat.item.page }}.{{ repeat.item.component }}_icon' foreground: '{{ [ repeat.item.icon_color_rgb ] if is_number(repeat.item.icon_color_rgb) else repeat.item.icon_color_rgb }}' - background: [] continue_on_error: true ### ICON Font ### - *delay-default @@ -7286,7 +7323,6 @@ action: data: component: '{{ repeat.item.page }}.{{ repeat.item.component }}{{ "_state" if repeat.item.page == page.home }}' foreground: '{{ [ repeat.item.label_color_rgb ] if is_number(repeat.item.label_color_rgb) else repeat.item.label_color_rgb }}' - background: [] continue_on_error: true ### LABEL Font ### - *delay-default @@ -7596,7 +7632,8 @@ action: {{ repeat.item.entity is string and repeat.item.entity | length > 0 and - repeat.item.entity.split(".") | default([]) | count > 0 + repeat.item.entity.split(".") | default([]) | count > 0 and + repeat.item.page == states(currentpage) }} then: - variables: @@ -7707,17 +7744,16 @@ action: - *delay-default - service: '{{ nextion.command.set_button }}' data: - btn_id: '{{ repeat.item.page }}.{{ repeat.item.component }}' - btn_pic: '{{ btn_pic }}' - btn_bg: '{{ [ btn_bg ] if is_number(btn_bg) else btn_bg }}' - btn_icon_font: '{{ [ btn_icon_font ] if is_number(btn_icon_font) else btn_icon_font }}' - btn_txt_font: '{{ [ btn_txt_font ] if is_number(btn_txt_font) else btn_txt_font }}' - btn_bri_font: '{{ [ btn_bri_font ] if is_number(btn_bri_font) else btn_bri_font }}' - btn_icon: '{{ btn_icon }}' - btn_label: '{{ btn_label }}' - btn_bri_txt: '{{ btn_bri_txt }}' - #btn_confirm: '{{ repeat.item.confirm }}' - #entity: '{{ repeat.item.entity }}' + page: '{{ repeat.item.page }}' + id: '{{ repeat.item.component }}' + pic: '{{ btn_pic }}' + bg: '{{ [ btn_bg ] if is_number(btn_bg) else btn_bg }}' + icon: '{{ btn_icon }}' + icon_color: '{{ [ btn_icon_font ] if is_number(btn_icon_font) else btn_icon_font }}' + bri: '{{ btn_bri_txt }}' + bri_color: '{{ [ btn_bri_font ] if is_number(btn_bri_font) else btn_bri_font }}' + label: '{{ btn_label }}' + label_color: '{{ [ btn_txt_font ] if is_number(btn_txt_font) else btn_txt_font }}' continue_on_error: true - if: > {{ @@ -7729,17 +7765,16 @@ action: milliseconds: 800 - service: '{{ nextion.command.set_button }}' data: - btn_id: '{{ repeat.item.page }}.{{ repeat.item.component }}' - btn_pic: '{{ nextion.pic.button.off }}' - btn_bg: '{{ nextion.color.grey_dark }}' - btn_icon_font: '{{ nextion.color.grey_light }}' - btn_txt_font: '{{ nextion.color.white }}' - btn_bri_font: '{{ [ btn_bri_font ] if is_number(btn_bri_font) else btn_bri_font }}' - btn_icon: '{{ btn_icon }}' - btn_label: '{{ btn_label }}' - btn_bri_txt: '{{ btn_bri_txt }}' - #btn_confirm: '{{ repeat.item.confirm }}' - #entity: '{{ repeat.item.entity }}' + page: '{{ repeat.item.page }}' + id: '{{ repeat.item.component }}' + pic: '{{ nextion.pic.button.off }}' + bg: '{{ nextion.color.grey_dark }}' + icon: '{{ btn_icon }}' + icon_color: '{{ nextion.color.grey_light }}' + bri: '{{ btn_bri_txt }}' + bri_color: '{{ [ btn_bri_font ] if is_number(btn_bri_font) else btn_bri_font }}' + label: '{{ btn_label }}' + label_color: '{{ nextion.color.white }}' continue_on_error: true ###### SHOW All component when page loading done ##### - if: '{{ not show_while_loading }}' @@ -7935,7 +7970,6 @@ action: data: component: cover.battery_icon foreground: '{{ nextion.color.grey_super_light }}' - background: [] continue_on_error: true ### ICON Battery Font ### - *delay-default @@ -7988,21 +8022,18 @@ action: data: component: fan.button_up foreground: '{{ nextion.color.grey_white if fan.percentage < 100 else nextion.color.grey_dark }}' - background: [] continue_on_error: true - *delay-default - service: '{{ nextion.command.set_component_color }}' data: component: fan.button_down foreground: '{{ nextion.color.grey_white if fan.percentage > 0 else nextion.color.grey_dark }}' - background: [] continue_on_error: true - *delay-default - service: '{{ nextion.command.set_component_color }}' data: component: fan.button_off foreground: '{{ nextion.color.grey_white if fan.percentage > 0 else nextion.color.grey_dark }}' - background: [] continue_on_error: true ## PAGE MEDIA PLAYER ## @@ -8218,7 +8249,6 @@ action: if states(climate_entity) == repeat.item.mode else nextion.color.disabled }} - background: [] continue_on_error: true ### ICON Font ### - *delay-default @@ -8276,7 +8306,6 @@ action: if states(repeat.item.entity) in ["on", "true", true, "open", "opening"] else nextion.color.disabled }} - background: [] continue_on_error: true ### ICON Font ### - *delay-default @@ -8904,37 +8933,34 @@ action: - *variables_hardware - variables: last_click_button: '{{ hardware.buttons.left if nspanel_event.component == "hw_bt_left" else hardware.buttons.right }}' - 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" - }} + entity_id: '{{ last_click_button.entity }}' + - *variable_entity + - condition: '{{ entity.valid }}' - choose: - alias: Long click conditions: - - '{{ nspanel_event.command == "long_click" or entity_domain in ["climate", "media_player"] }}' + - '{{ nspanel_event.command == "long_click" or entity.domain in ["climate", "media_player"] }}' sequence: - choose: - alias: Default conditions: - - '{{ last_click_button.hold_select == "Default" and last_click_button.entity | length > 0 }}' - - '{{ entity_domain in ["climate", "cover", "light", "fan", "media_player"] }}' - #- '{{ 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] }}' + - '{{ last_click_button.hold_select == "Default" }}' + - '{{ entity.domain in ["climate", "cover", "light", "fan", "media_player"] }}' + #- '{{ entity.domain != "cover" or entity.supported_features | bitwise_and(4) > 0 }}' + #- '{{ entity.domain != "fan" or entity.supported_features | bitwise_and(1) > 0 }}' + #- '{{ entity.domain != "light" or state_attr(entity.id, "supported_color_modes") | default("unknown") | string not in ["unknown", "onoff", enum.color_mode.unknown, enum.color_mode.onoff, "", none] }}' sequence: - - 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: '{{ 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 }}' + - variables: back_page: '{{ page.home }}' + - &open_entity_settings_page + service: '{{ nextion.command.open_entity_settings_page }}' + data: + page: '{{ entity.domain }}' + page_label: '{{ entity.friendly_name }}' + page_icon: '{{ entity.icon }}' + page_icon_color: '{{ entity.icon_color }}' + entity: '{{ "embedded_climate" if entity.id == thermostat_embedded else entity.id }}' + back_page: '{{ back_page }}' continue_on_error: true - alias: Custom action - Left conditions: '{{ last_click_button.hold_select == "Custom Action" and nspanel_event.component == "hw_bt_left" }}' @@ -8990,43 +9016,28 @@ action: - 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" - }} + entity_id: '{{ last_click_button.entity }}' + overlap: + icon: '{{ last_click_button.icon }}' + friendly_name: '{{ last_click_button.name }}' + - *variable_entity + - condition: '{{ entity.valid }}' - choose: - alias: Long click conditions: - - '{{ nspanel_event.command == "long_click" or entity_domain in ["climate", "media_player"] }}' - - '{{ last_click_button.entity | length > 0 }}' - - '{{ entity_domain in ["climate", "cover", "light", "fan", "media_player"] }}' - #- '{{ 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] }}' + - '{{ nspanel_event.command == "long_click" or entity.domain in ["climate", "media_player"] }}' + - '{{ entity.domain in ["climate", "cover", "light", "fan", "media_player"] }}' + #- '{{ entity.domain != "cover" or entity.supported_features | bitwise_and(4) > 0 }}' + #- '{{ entity.domain != "fan" or entity.supported_features | bitwise_and(1) > 0 }}' + #- '{{ entity.domain != "light" or state_attr(entity_id, "supported_color_modes") | default("unknown") | string not in ["unknown", "onoff", enum.color_mode.unknown, enum.color_mode.onoff, "", none] }}' sequence: - - 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: '{{ [ last_click_button.icon_color_rgb ] if is_number(last_click_button.icon_color_rgb) else last_click_button.icon_color_rgb }}' - entity: '{{ "embedded_climate" if last_click_button.entity == thermostat_embedded else last_click_button.entity }}' + - variables: back_page: '{{ nspanel_event.page }}' - continue_on_error: true + - *open_entity_settings_page - alias: Short click conditions: - - '{{ nspanel_event.command == "short_click" and entity_domain not in ["climate", "media_player"] }}' - - '{{ entity_domain not in ["unknown", "person", "binary_sensor", "sensor"] }}' + - '{{ nspanel_event.command == "short_click" and entity.domain not in ["climate", "media_player"] }}' + - '{{ entity.domain not in ["unknown", "person", "binary_sensor", "sensor"] }}' sequence: - *short_press-service_call @@ -9075,36 +9086,21 @@ action: - 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" - }} + entity_id: '{{ last_click_button.entity }}' + overlap: + icon: '{{ last_click_button.icon }}' + friendly_name: '{{ last_click_button.name }}' + - *variable_entity + - condition: '{{ entity.valid }}' - if: - - '{{ entity_domain in ["climate", "cover", "fan", "light", "media_player"] }}' - - '{{ last_click_button.entity | length > 0 }}' - #- '{{ 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] }}' + - '{{ entity.domain in ["climate", "cover", "fan", "light", "media_player"] }}' + #- '{{ entity.domain != "cover" or entity.supported_features | bitwise_and(4) > 0 }}' + #- '{{ entity.domain != "fan" or entity.supported_features | bitwise_and(1) > 0 }}' + #- '{{ entity.domain != "light" or state_attr(entity.id, "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 }}' + - variables: back_page: '{{ page.home }}' - continue_on_error: true + - *open_entity_settings_page else: - *short_press-service_call @@ -9185,15 +9181,12 @@ action: - '{{ nspanel_event.value == "release" }}' - '{{ climate | length > 0 }} ' sequence: - - service: '{{ nextion.command.open_entity_settings_page }}' - data: - page: 'climate' - page_label: '{{ state_attr(climate, "friendly_name") }}' - page_icon: '' - page_icon_color: [ -1 ] #No color set - entity: '{{ "embedded_climate" if climate == thermostat_embedded else climate }}' + - variables: + entity_id: '{{ climate }}' back_page: '{{ page.home }}' - continue_on_error: true + - *variable_entity + - condition: '{{ entity.valid }}' + - *open_entity_settings_page - alias: Show button - Notification clear conditions: diff --git a/nspanel_esphome_core.yaml b/nspanel_esphome_core.yaml index 721af5b..1fab858 100644 --- a/nspanel_esphome_core.yaml +++ b/nspanel_esphome_core.yaml @@ -7,13 +7,14 @@ substitutions: ##### DON'T CHANGE THIS ##### - version: "4.1.4" + version: "4.2dev" ############################# -#external_components: -# - source: github://pr#5825 # Remove this when that pr is merged and released -# components: -# - nextion +external_components: + - source: github://pr#5825 #5683 # Remove this when that pr is merged and released + components: + - nextion + refresh: 1s ##### ESPHOME CONFIGURATION ##### esphome: @@ -32,8 +33,8 @@ esphome: timeout: 60s - wait_until: condition: - - lambda: !lambda return disp1->is_setup(); - timeout: 20s + - lambda: !lambda return disp1->is_detected(); + timeout: 45s - script.execute: exit_reparse - wait_until: condition: @@ -190,9 +191,8 @@ api: variables: component: string foreground: int[] - background: int[] then: - - lambda: set_component_color->execute(component, foreground, background); + - lambda: set_component_color->execute(component, foreground, {}); ##### Service to play a rtttl tones ##### # Example tones : https://codebender.cc/sketch:109888#RTTTL%20Songs.ino @@ -486,30 +486,37 @@ api: #### Service to set the buttons #### - service: set_button variables: - btn_id: string - btn_pic: int - btn_bg: int[] - btn_icon_font: int[] - btn_txt_font: int[] - btn_bri_font: int[] - btn_icon: string - btn_label: string - btn_bri_txt: string + page: string + id: string + pic: int + bg: int[] + icon: string + icon_color: int[] + bri: string + bri_color: int[] + label: string + label_color: int[] then: - lambda: |- - std::string btnicon = btn_id.c_str() + std::string("icon"); - std::string btntext = btn_id.c_str() + std::string("text"); - std::string btnbri = btn_id.c_str() + std::string("bri"); - disp1->send_command_printf("%spic.pic=%" PRIu32, btn_id.c_str(), btn_pic); - set_component_color->execute(btnicon.c_str(), btn_icon_font, btn_bg); - set_component_color->execute(btntext.c_str(), btn_txt_font, btn_bg); - set_component_color->execute(btnbri.c_str(), btn_bri_font, btn_bg); - disp1->set_component_text_printf(btnicon.c_str(), "%s", btn_icon.c_str()); - display_wrapped_text->execute(btntext.c_str(), btn_label.c_str(), 10); - if (strcmp(btn_bri_txt.c_str(), "0") != 0) - disp1->set_component_text_printf(btnbri.c_str(), "%s", btn_bri_txt.c_str()); - else - disp1->set_component_text_printf(btnbri.c_str(), " "); + static const char *const TAG = "service.set_button"; + if (page == current_page->state) { + std::string btnicon = id.c_str() + std::string("icon"); + std::string btntext = id.c_str() + std::string("text"); + std::string btnbri = id.c_str() + std::string("bri"); + disp1->send_command_printf("%spic.pic=%" PRIu32, id.c_str(), pic); + set_component_color->execute(btnicon.c_str(), icon_color, bg); + set_component_color->execute(btntext.c_str(), label_color, bg); + set_component_color->execute(btnbri.c_str(), bri_color, bg); + disp1->set_component_text_printf(btnicon.c_str(), "%s", icon.c_str()); + display_wrapped_text->execute(btntext.c_str(), label.c_str(), 10); + if (strcmp(bri.c_str(), "0") != 0) + disp1->set_component_text_printf(btnbri.c_str(), "%s", bri.c_str()); + else + disp1->set_component_text_printf(btnbri.c_str(), " "); + } else { + ESP_LOGW(TAG, "Skipping button `%s.%s` as page has changed to %s.", page.c_str(), id.c_str(), current_page->state.c_str()); + } + ##### SERVICE TO WAKE UP THE DISPLAY ##### - service: wake_up @@ -747,11 +754,14 @@ display: platform: nextion uart_id: tf_uart start_up_page: 8 - on_page: # This requires `sendme` to be executed on Nextion side + on_page: lambda: |- static const char *const TAG = "display.disp1.on_page"; ESP_LOGD(TAG, "Nextion page changed"); ESP_LOGD(TAG, "New page: %s (%i)" , id(page_names)[x].c_str(), x); + current_page->publish_state(id(page_names)[x].c_str()); + page_changed->execute(id(page_names)[x].c_str()); + on_setup: - script.execute: boot_sequence @@ -1399,25 +1409,25 @@ text_sensor: ##### Current page name ##### - name: ${device_name} Current page id: current_page - #platform: template - platform: nextion - nextion_id: disp1 - component_name: currentpage + platform: template + #platform: nextion + #nextion_id: disp1 + #component_name: currentpage icon: mdi:tablet-dashboard internal: false disabled_by_default: false - filters: - - lambda: |- - x = x.c_str(); - x.shrink_to_fit(); - return x; - on_value: - then: - - lambda: |- - static const char *const TAG = "text_sensor.current_page"; - // Construct new page - ESP_LOGV(TAG, "Construct new page"); - page_changed->execute(x.c_str()); + #filters: + # - lambda: |- + # x = x.c_str(); + # x.shrink_to_fit(); + # return x; + #on_value: + # then: + # - lambda: |- + # static const char *const TAG = "text_sensor.current_page"; + # // Construct new page + # ESP_LOGV(TAG, "Construct new page"); + # page_changed->execute(x.c_str()); - name: ${device_name} Notification Label platform: template diff --git a/nspanel_eu.HMI b/nspanel_eu.HMI index e495a49..201e11a 100644 Binary files a/nspanel_eu.HMI and b/nspanel_eu.HMI differ diff --git a/nspanel_eu.tft b/nspanel_eu.tft index d551324..c2f65cc 100644 Binary files a/nspanel_eu.tft and b/nspanel_eu.tft differ diff --git a/nspanel_eu_code/alarm.txt b/nspanel_eu_code/alarm.txt index e04f9c1..f8fbcda 100644 --- a/nspanel_eu_code/alarm.txt +++ b/nspanel_eu_code/alarm.txt @@ -17,12 +17,7 @@ Page alarm page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "alarm",0 - printh 00 - printh FF FF FF + sendme vis bt_home,0 vis bt_away,0 vis bt_night,0 diff --git a/nspanel_eu_code/boot.txt b/nspanel_eu_code/boot.txt index dab95f5..5213736 100644 --- a/nspanel_eu_code/boot.txt +++ b/nspanel_eu_code/boot.txt @@ -12,12 +12,7 @@ Page boot Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "boot",0 - printh 00 - printh FF FF FF + sendme dim=0 vis bt_reboot,0 covx baud,baud_rate.txt,0,0 @@ -142,7 +137,7 @@ Text tft_version Dragging : 0 Send Component ID : disabled Associated Keyboard: none - Text : 4.1.3 + Text : 4.2dev Max. Text Size : 9 Text esph_version diff --git a/nspanel_eu_code/buttonpage01.txt b/nspanel_eu_code/buttonpage01.txt index 485f67f..b97439d 100644 --- a/nspanel_eu_code/buttonpage01.txt +++ b/nspanel_eu_code/buttonpage01.txt @@ -17,12 +17,7 @@ Page buttonpage01 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage01",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_eu_code/buttonpage02.txt b/nspanel_eu_code/buttonpage02.txt index 68fa710..e5810c6 100644 --- a/nspanel_eu_code/buttonpage02.txt +++ b/nspanel_eu_code/buttonpage02.txt @@ -17,12 +17,7 @@ Page buttonpage02 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage02",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_eu_code/buttonpage03.txt b/nspanel_eu_code/buttonpage03.txt index 63c0cac..1c2f8bb 100644 --- a/nspanel_eu_code/buttonpage03.txt +++ b/nspanel_eu_code/buttonpage03.txt @@ -17,12 +17,7 @@ Page buttonpage03 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage03",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_eu_code/buttonpage04.txt b/nspanel_eu_code/buttonpage04.txt index 83a6204..84c3af7 100644 --- a/nspanel_eu_code/buttonpage04.txt +++ b/nspanel_eu_code/buttonpage04.txt @@ -17,12 +17,7 @@ Page buttonpage04 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage04",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_eu_code/climate.txt b/nspanel_eu_code/climate.txt index 3af8119..0310f84 100644 --- a/nspanel_eu_code/climate.txt +++ b/nspanel_eu_code/climate.txt @@ -14,12 +14,7 @@ Page climate Preinitialize Event if(api==1||embedded.val==1) { - printh 92 - prints "currentpage",0 - printh 00 - prints "climate",0 - printh 00 - printh FF FF FF + sendme vis target_icon,0 vis target_temp,0 vis current_temp,0 diff --git a/nspanel_eu_code/confirm.txt b/nspanel_eu_code/confirm.txt index a56d23c..75191ec 100644 --- a/nspanel_eu_code/confirm.txt +++ b/nspanel_eu_code/confirm.txt @@ -17,12 +17,7 @@ Page confirm page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "confirm",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/cover.txt b/nspanel_eu_code/cover.txt index de7bbf2..461625b 100644 --- a/nspanel_eu_code/cover.txt +++ b/nspanel_eu_code/cover.txt @@ -17,12 +17,7 @@ Page cover page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "cover",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/entitypage01.txt b/nspanel_eu_code/entitypage01.txt index 403e6da..fc04b65 100644 --- a/nspanel_eu_code/entitypage01.txt +++ b/nspanel_eu_code/entitypage01.txt @@ -17,12 +17,7 @@ Page entitypage01 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage01",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/entitypage02.txt b/nspanel_eu_code/entitypage02.txt index 6c9bd51..01a658d 100644 --- a/nspanel_eu_code/entitypage02.txt +++ b/nspanel_eu_code/entitypage02.txt @@ -17,12 +17,7 @@ Page entitypage02 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage02",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/entitypage03.txt b/nspanel_eu_code/entitypage03.txt index 067b5f2..7bf9195 100644 --- a/nspanel_eu_code/entitypage03.txt +++ b/nspanel_eu_code/entitypage03.txt @@ -17,12 +17,7 @@ Page entitypage03 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage03",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/entitypage04.txt b/nspanel_eu_code/entitypage04.txt index f97110f..5b19f8a 100644 --- a/nspanel_eu_code/entitypage04.txt +++ b/nspanel_eu_code/entitypage04.txt @@ -17,12 +17,7 @@ Page entitypage04 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage04",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/fan.txt b/nspanel_eu_code/fan.txt index d2e7ba1..3675007 100644 --- a/nspanel_eu_code/fan.txt +++ b/nspanel_eu_code/fan.txt @@ -17,12 +17,7 @@ Page fan page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "fan",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/home.txt b/nspanel_eu_code/home.txt index 5ffceed..ccff3da 100644 --- a/nspanel_eu_code/home.txt +++ b/nspanel_eu_code/home.txt @@ -12,12 +12,7 @@ Page home Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "home",0 - printh 00 - printh FF FF FF + sendme vis bt_notific,is_notification vis bt_qrcode,is_qrcode vis bt_entities,is_entities diff --git a/nspanel_eu_code/keyb_num.txt b/nspanel_eu_code/keyb_num.txt index 26a81e8..89c756b 100644 --- a/nspanel_eu_code/keyb_num.txt +++ b/nspanel_eu_code/keyb_num.txt @@ -17,12 +17,7 @@ Page keyb_num page page_id.val }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "keyb_num",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/light.txt b/nspanel_eu_code/light.txt index b655c90..11c235f 100644 --- a/nspanel_eu_code/light.txt +++ b/nspanel_eu_code/light.txt @@ -17,12 +17,7 @@ Page light page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "light",0 - printh 00 - printh FF FF FF + sendme vis light_b_press,1 vis lightslider,1 vis light_value,1 diff --git a/nspanel_eu_code/media_player.txt b/nspanel_eu_code/media_player.txt index c83aed5..5dcbd3e 100644 --- a/nspanel_eu_code/media_player.txt +++ b/nspanel_eu_code/media_player.txt @@ -17,12 +17,7 @@ Page media_player page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "media_player",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/notification.txt b/nspanel_eu_code/notification.txt index 300ce12..85d00df 100644 --- a/nspanel_eu_code/notification.txt +++ b/nspanel_eu_code/notification.txt @@ -17,12 +17,7 @@ Page notification page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "notification",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/qrcode.txt b/nspanel_eu_code/qrcode.txt index 7a0ee3c..46499ea 100644 --- a/nspanel_eu_code/qrcode.txt +++ b/nspanel_eu_code/qrcode.txt @@ -12,12 +12,7 @@ Page qrcode Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "qrcode",0 - printh 00 - printh FF FF FF + sendme Touch Press Event printh 91 diff --git a/nspanel_eu_code/screensaver.txt b/nspanel_eu_code/screensaver.txt index 85dc9a3..62abd11 100644 --- a/nspanel_eu_code/screensaver.txt +++ b/nspanel_eu_code/screensaver.txt @@ -12,12 +12,7 @@ Page screensaver Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "screensaver",0 - printh 00 - printh FF FF FF + sendme dim=0 Touch Release Event diff --git a/nspanel_eu_code/settings.txt b/nspanel_eu_code/settings.txt index c56003c..b1d04e4 100644 --- a/nspanel_eu_code/settings.txt +++ b/nspanel_eu_code/settings.txt @@ -12,12 +12,7 @@ Page settings Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "settings",0 - printh 00 - printh FF FF FF + sendme covx brightslider.val,bright_text.txt,0,0 bright_text.txt+="%" covx dimslider.val,dim_text.txt,0,0 diff --git a/nspanel_eu_code/weather01.txt b/nspanel_eu_code/weather01.txt index a9d4149..254b347 100644 --- a/nspanel_eu_code/weather01.txt +++ b/nspanel_eu_code/weather01.txt @@ -17,12 +17,7 @@ Page weather01 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather01",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/weather02.txt b/nspanel_eu_code/weather02.txt index 46cfb72..8ced5b4 100644 --- a/nspanel_eu_code/weather02.txt +++ b/nspanel_eu_code/weather02.txt @@ -17,12 +17,7 @@ Page weather02 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather02",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/weather03.txt b/nspanel_eu_code/weather03.txt index eea35c2..dcfe440 100644 --- a/nspanel_eu_code/weather03.txt +++ b/nspanel_eu_code/weather03.txt @@ -17,12 +17,7 @@ Page weather03 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather03",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/weather04.txt b/nspanel_eu_code/weather04.txt index b7997bf..2beb330 100644 --- a/nspanel_eu_code/weather04.txt +++ b/nspanel_eu_code/weather04.txt @@ -17,12 +17,7 @@ Page weather04 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather04",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_eu_code/weather05.txt b/nspanel_eu_code/weather05.txt index 6f12899..da5d7f1 100644 --- a/nspanel_eu_code/weather05.txt +++ b/nspanel_eu_code/weather05.txt @@ -17,12 +17,7 @@ Page weather05 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather05",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us.HMI b/nspanel_us.HMI index 511511b..4646cbd 100644 Binary files a/nspanel_us.HMI and b/nspanel_us.HMI differ diff --git a/nspanel_us.tft b/nspanel_us.tft index 63e7e5e..060e879 100644 Binary files a/nspanel_us.tft and b/nspanel_us.tft differ diff --git a/nspanel_us_code/alarm.txt b/nspanel_us_code/alarm.txt index 05f6d1f..7230653 100644 --- a/nspanel_us_code/alarm.txt +++ b/nspanel_us_code/alarm.txt @@ -17,12 +17,7 @@ Page alarm page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "alarm",0 - printh 00 - printh FF FF FF + sendme vis bt_home,0 vis bt_away,0 vis bt_night,0 diff --git a/nspanel_us_code/boot.txt b/nspanel_us_code/boot.txt index dab95f5..5213736 100644 --- a/nspanel_us_code/boot.txt +++ b/nspanel_us_code/boot.txt @@ -12,12 +12,7 @@ Page boot Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "boot",0 - printh 00 - printh FF FF FF + sendme dim=0 vis bt_reboot,0 covx baud,baud_rate.txt,0,0 @@ -142,7 +137,7 @@ Text tft_version Dragging : 0 Send Component ID : disabled Associated Keyboard: none - Text : 4.1.3 + Text : 4.2dev Max. Text Size : 9 Text esph_version diff --git a/nspanel_us_code/buttonpage01.txt b/nspanel_us_code/buttonpage01.txt index 485f67f..b97439d 100644 --- a/nspanel_us_code/buttonpage01.txt +++ b/nspanel_us_code/buttonpage01.txt @@ -17,12 +17,7 @@ Page buttonpage01 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage01",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_us_code/buttonpage02.txt b/nspanel_us_code/buttonpage02.txt index f709809..7d158bb 100644 --- a/nspanel_us_code/buttonpage02.txt +++ b/nspanel_us_code/buttonpage02.txt @@ -17,12 +17,7 @@ Page buttonpage02 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage02",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_us_code/buttonpage03.txt b/nspanel_us_code/buttonpage03.txt index 63c0cac..1c2f8bb 100644 --- a/nspanel_us_code/buttonpage03.txt +++ b/nspanel_us_code/buttonpage03.txt @@ -17,12 +17,7 @@ Page buttonpage03 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage03",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_us_code/buttonpage04.txt b/nspanel_us_code/buttonpage04.txt index 9b09428..f6079b5 100644 --- a/nspanel_us_code/buttonpage04.txt +++ b/nspanel_us_code/buttonpage04.txt @@ -17,12 +17,7 @@ Page buttonpage04 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage04",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_us_code/climate.txt b/nspanel_us_code/climate.txt index 6e2a868..07eac92 100644 --- a/nspanel_us_code/climate.txt +++ b/nspanel_us_code/climate.txt @@ -14,12 +14,7 @@ Page climate Preinitialize Event if(api==1||embedded.val==1) { - printh 92 - prints "currentpage",0 - printh 00 - prints "climate",0 - printh 00 - printh FF FF FF + sendme vis target_icon,0 vis target_temp,0 vis current_temp,0 diff --git a/nspanel_us_code/confirm.txt b/nspanel_us_code/confirm.txt index 05a64f0..8aa5cb8 100644 --- a/nspanel_us_code/confirm.txt +++ b/nspanel_us_code/confirm.txt @@ -17,12 +17,7 @@ Page confirm page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "confirm",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/cover.txt b/nspanel_us_code/cover.txt index de7bbf2..461625b 100644 --- a/nspanel_us_code/cover.txt +++ b/nspanel_us_code/cover.txt @@ -17,12 +17,7 @@ Page cover page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "cover",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/entitypage01.txt b/nspanel_us_code/entitypage01.txt index 403e6da..fc04b65 100644 --- a/nspanel_us_code/entitypage01.txt +++ b/nspanel_us_code/entitypage01.txt @@ -17,12 +17,7 @@ Page entitypage01 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage01",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/entitypage02.txt b/nspanel_us_code/entitypage02.txt index 6c9bd51..01a658d 100644 --- a/nspanel_us_code/entitypage02.txt +++ b/nspanel_us_code/entitypage02.txt @@ -17,12 +17,7 @@ Page entitypage02 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage02",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/entitypage03.txt b/nspanel_us_code/entitypage03.txt index c7d9820..ce8d89d 100644 --- a/nspanel_us_code/entitypage03.txt +++ b/nspanel_us_code/entitypage03.txt @@ -17,12 +17,7 @@ Page entitypage03 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage03",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/entitypage04.txt b/nspanel_us_code/entitypage04.txt index f97110f..5b19f8a 100644 --- a/nspanel_us_code/entitypage04.txt +++ b/nspanel_us_code/entitypage04.txt @@ -17,12 +17,7 @@ Page entitypage04 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage04",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/fan.txt b/nspanel_us_code/fan.txt index 2d15fc1..4c9f50a 100644 --- a/nspanel_us_code/fan.txt +++ b/nspanel_us_code/fan.txt @@ -17,12 +17,7 @@ Page fan page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "fan",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/home.txt b/nspanel_us_code/home.txt index 5726f9d..e94e7ea 100644 --- a/nspanel_us_code/home.txt +++ b/nspanel_us_code/home.txt @@ -12,12 +12,7 @@ Page home Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "home",0 - printh 00 - printh FF FF FF + sendme vis bt_notific,is_notification vis bt_qrcode,is_qrcode vis bt_entities,is_entities diff --git a/nspanel_us_code/keyb_num.txt b/nspanel_us_code/keyb_num.txt index 3387379..80c0013 100644 --- a/nspanel_us_code/keyb_num.txt +++ b/nspanel_us_code/keyb_num.txt @@ -17,12 +17,7 @@ Page keyb_num page page_id.val }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "keyb_num",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/light.txt b/nspanel_us_code/light.txt index b655c90..11c235f 100644 --- a/nspanel_us_code/light.txt +++ b/nspanel_us_code/light.txt @@ -17,12 +17,7 @@ Page light page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "light",0 - printh 00 - printh FF FF FF + sendme vis light_b_press,1 vis lightslider,1 vis light_value,1 diff --git a/nspanel_us_code/media_player.txt b/nspanel_us_code/media_player.txt index 84234a0..fe32648 100644 --- a/nspanel_us_code/media_player.txt +++ b/nspanel_us_code/media_player.txt @@ -17,12 +17,7 @@ Page media_player page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "media_player",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/notification.txt b/nspanel_us_code/notification.txt index 7ffcf81..38dd7bc 100644 --- a/nspanel_us_code/notification.txt +++ b/nspanel_us_code/notification.txt @@ -17,12 +17,7 @@ Page notification page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "notification",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/qrcode.txt b/nspanel_us_code/qrcode.txt index 7a0ee3c..46499ea 100644 --- a/nspanel_us_code/qrcode.txt +++ b/nspanel_us_code/qrcode.txt @@ -12,12 +12,7 @@ Page qrcode Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "qrcode",0 - printh 00 - printh FF FF FF + sendme Touch Press Event printh 91 diff --git a/nspanel_us_code/screensaver.txt b/nspanel_us_code/screensaver.txt index 85dc9a3..62abd11 100644 --- a/nspanel_us_code/screensaver.txt +++ b/nspanel_us_code/screensaver.txt @@ -12,12 +12,7 @@ Page screensaver Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "screensaver",0 - printh 00 - printh FF FF FF + sendme dim=0 Touch Release Event diff --git a/nspanel_us_code/settings.txt b/nspanel_us_code/settings.txt index a55915a..f3afb7b 100644 --- a/nspanel_us_code/settings.txt +++ b/nspanel_us_code/settings.txt @@ -12,12 +12,7 @@ Page settings Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "settings",0 - printh 00 - printh FF FF FF + sendme covx brightslider.val,bright_text.txt,0,0 bright_text.txt+="%" covx dimslider.val,dim_text.txt,0,0 diff --git a/nspanel_us_code/weather01.txt b/nspanel_us_code/weather01.txt index bdd99f1..ba51c85 100644 --- a/nspanel_us_code/weather01.txt +++ b/nspanel_us_code/weather01.txt @@ -17,12 +17,7 @@ Page weather01 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather01",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/weather02.txt b/nspanel_us_code/weather02.txt index 46cfb72..8ced5b4 100644 --- a/nspanel_us_code/weather02.txt +++ b/nspanel_us_code/weather02.txt @@ -17,12 +17,7 @@ Page weather02 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather02",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/weather03.txt b/nspanel_us_code/weather03.txt index eea35c2..dcfe440 100644 --- a/nspanel_us_code/weather03.txt +++ b/nspanel_us_code/weather03.txt @@ -17,12 +17,7 @@ Page weather03 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather03",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/weather04.txt b/nspanel_us_code/weather04.txt index b7997bf..2beb330 100644 --- a/nspanel_us_code/weather04.txt +++ b/nspanel_us_code/weather04.txt @@ -17,12 +17,7 @@ Page weather04 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather04",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_code/weather05.txt b/nspanel_us_code/weather05.txt index 6f12899..da5d7f1 100644 --- a/nspanel_us_code/weather05.txt +++ b/nspanel_us_code/weather05.txt @@ -17,12 +17,7 @@ Page weather05 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather05",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land.HMI b/nspanel_us_land.HMI index 21fbc40..1d30ea8 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 4be1c69..8875fe8 100644 Binary files a/nspanel_us_land.tft and b/nspanel_us_land.tft differ diff --git a/nspanel_us_land_code/alarm.txt b/nspanel_us_land_code/alarm.txt index e04f9c1..f8fbcda 100644 --- a/nspanel_us_land_code/alarm.txt +++ b/nspanel_us_land_code/alarm.txt @@ -17,12 +17,7 @@ Page alarm page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "alarm",0 - printh 00 - printh FF FF FF + sendme vis bt_home,0 vis bt_away,0 vis bt_night,0 diff --git a/nspanel_us_land_code/boot.txt b/nspanel_us_land_code/boot.txt index dab95f5..5213736 100644 --- a/nspanel_us_land_code/boot.txt +++ b/nspanel_us_land_code/boot.txt @@ -12,12 +12,7 @@ Page boot Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "boot",0 - printh 00 - printh FF FF FF + sendme dim=0 vis bt_reboot,0 covx baud,baud_rate.txt,0,0 @@ -142,7 +137,7 @@ Text tft_version Dragging : 0 Send Component ID : disabled Associated Keyboard: none - Text : 4.1.3 + Text : 4.2dev Max. Text Size : 9 Text esph_version diff --git a/nspanel_us_land_code/buttonpage01.txt b/nspanel_us_land_code/buttonpage01.txt index 0e40a85..6b8793a 100644 --- a/nspanel_us_land_code/buttonpage01.txt +++ b/nspanel_us_land_code/buttonpage01.txt @@ -17,12 +17,7 @@ Page buttonpage01 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage01",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_us_land_code/buttonpage02.txt b/nspanel_us_land_code/buttonpage02.txt index 3279884..b089538 100644 --- a/nspanel_us_land_code/buttonpage02.txt +++ b/nspanel_us_land_code/buttonpage02.txt @@ -17,12 +17,7 @@ Page buttonpage02 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage02",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_us_land_code/buttonpage03.txt b/nspanel_us_land_code/buttonpage03.txt index 42e1356..553e3cf 100644 --- a/nspanel_us_land_code/buttonpage03.txt +++ b/nspanel_us_land_code/buttonpage03.txt @@ -17,12 +17,7 @@ Page buttonpage03 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage03",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_us_land_code/buttonpage04.txt b/nspanel_us_land_code/buttonpage04.txt index 6632d16..b64eabd 100644 --- a/nspanel_us_land_code/buttonpage04.txt +++ b/nspanel_us_land_code/buttonpage04.txt @@ -17,12 +17,7 @@ Page buttonpage04 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "buttonpage04",0 - printh 00 - printh FF FF FF + sendme vis 255,0 vis button_back,1 vis page_index,1 diff --git a/nspanel_us_land_code/climate.txt b/nspanel_us_land_code/climate.txt index 3af8119..0310f84 100644 --- a/nspanel_us_land_code/climate.txt +++ b/nspanel_us_land_code/climate.txt @@ -14,12 +14,7 @@ Page climate Preinitialize Event if(api==1||embedded.val==1) { - printh 92 - prints "currentpage",0 - printh 00 - prints "climate",0 - printh 00 - printh FF FF FF + sendme vis target_icon,0 vis target_temp,0 vis current_temp,0 diff --git a/nspanel_us_land_code/confirm.txt b/nspanel_us_land_code/confirm.txt index a56d23c..75191ec 100644 --- a/nspanel_us_land_code/confirm.txt +++ b/nspanel_us_land_code/confirm.txt @@ -17,12 +17,7 @@ Page confirm page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "confirm",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/cover.txt b/nspanel_us_land_code/cover.txt index de7bbf2..461625b 100644 --- a/nspanel_us_land_code/cover.txt +++ b/nspanel_us_land_code/cover.txt @@ -17,12 +17,7 @@ Page cover page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "cover",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/entitypage01.txt b/nspanel_us_land_code/entitypage01.txt index d824602..ba23709 100644 --- a/nspanel_us_land_code/entitypage01.txt +++ b/nspanel_us_land_code/entitypage01.txt @@ -17,12 +17,7 @@ Page entitypage01 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage01",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/entitypage02.txt b/nspanel_us_land_code/entitypage02.txt index 56b2ae4..6efb8b4 100644 --- a/nspanel_us_land_code/entitypage02.txt +++ b/nspanel_us_land_code/entitypage02.txt @@ -17,12 +17,7 @@ Page entitypage02 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage02",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/entitypage03.txt b/nspanel_us_land_code/entitypage03.txt index 1e38380..9527653 100644 --- a/nspanel_us_land_code/entitypage03.txt +++ b/nspanel_us_land_code/entitypage03.txt @@ -17,12 +17,7 @@ Page entitypage03 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage03",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/entitypage04.txt b/nspanel_us_land_code/entitypage04.txt index c1fbdd7..34f378d 100644 --- a/nspanel_us_land_code/entitypage04.txt +++ b/nspanel_us_land_code/entitypage04.txt @@ -17,12 +17,7 @@ Page entitypage04 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "entitypage04",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/fan.txt b/nspanel_us_land_code/fan.txt index d2e7ba1..3675007 100644 --- a/nspanel_us_land_code/fan.txt +++ b/nspanel_us_land_code/fan.txt @@ -17,12 +17,7 @@ Page fan page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "fan",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/home.txt b/nspanel_us_land_code/home.txt index 5d45e1f..d4e3776 100644 --- a/nspanel_us_land_code/home.txt +++ b/nspanel_us_land_code/home.txt @@ -12,12 +12,7 @@ Page home Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "home",0 - printh 00 - printh FF FF FF + sendme vis bt_notific,is_notification vis bt_qrcode,is_qrcode vis bt_entities,is_entities diff --git a/nspanel_us_land_code/keyb_num.txt b/nspanel_us_land_code/keyb_num.txt index 26a81e8..89c756b 100644 --- a/nspanel_us_land_code/keyb_num.txt +++ b/nspanel_us_land_code/keyb_num.txt @@ -17,12 +17,7 @@ Page keyb_num page page_id.val }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "keyb_num",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/light.txt b/nspanel_us_land_code/light.txt index b655c90..11c235f 100644 --- a/nspanel_us_land_code/light.txt +++ b/nspanel_us_land_code/light.txt @@ -17,12 +17,7 @@ Page light page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "light",0 - printh 00 - printh FF FF FF + sendme vis light_b_press,1 vis lightslider,1 vis light_value,1 diff --git a/nspanel_us_land_code/media_player.txt b/nspanel_us_land_code/media_player.txt index c83aed5..5dcbd3e 100644 --- a/nspanel_us_land_code/media_player.txt +++ b/nspanel_us_land_code/media_player.txt @@ -17,12 +17,7 @@ Page media_player page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "media_player",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/notification.txt b/nspanel_us_land_code/notification.txt index 300ce12..85d00df 100644 --- a/nspanel_us_land_code/notification.txt +++ b/nspanel_us_land_code/notification.txt @@ -17,12 +17,7 @@ Page notification page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "notification",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/qrcode.txt b/nspanel_us_land_code/qrcode.txt index 7a0ee3c..46499ea 100644 --- a/nspanel_us_land_code/qrcode.txt +++ b/nspanel_us_land_code/qrcode.txt @@ -12,12 +12,7 @@ Page qrcode Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "qrcode",0 - printh 00 - printh FF FF FF + sendme Touch Press Event printh 91 diff --git a/nspanel_us_land_code/screensaver.txt b/nspanel_us_land_code/screensaver.txt index 85dc9a3..62abd11 100644 --- a/nspanel_us_land_code/screensaver.txt +++ b/nspanel_us_land_code/screensaver.txt @@ -12,12 +12,7 @@ Page screensaver Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "screensaver",0 - printh 00 - printh FF FF FF + sendme dim=0 Touch Release Event diff --git a/nspanel_us_land_code/settings.txt b/nspanel_us_land_code/settings.txt index 87d34d8..5690a1d 100644 --- a/nspanel_us_land_code/settings.txt +++ b/nspanel_us_land_code/settings.txt @@ -12,12 +12,7 @@ Page settings Events Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "settings",0 - printh 00 - printh FF FF FF + sendme covx brightslider.val,bright_text.txt,0,0 bright_text.txt+="%" covx dimslider.val,dim_text.txt,0,0 diff --git a/nspanel_us_land_code/weather01.txt b/nspanel_us_land_code/weather01.txt index 55be75d..a515d5e 100644 --- a/nspanel_us_land_code/weather01.txt +++ b/nspanel_us_land_code/weather01.txt @@ -17,12 +17,7 @@ Page weather01 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather01",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/weather02.txt b/nspanel_us_land_code/weather02.txt index 89fcdf8..3da14ff 100644 --- a/nspanel_us_land_code/weather02.txt +++ b/nspanel_us_land_code/weather02.txt @@ -17,12 +17,7 @@ Page weather02 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather02",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/weather03.txt b/nspanel_us_land_code/weather03.txt index 149532d..c51bd6b 100644 --- a/nspanel_us_land_code/weather03.txt +++ b/nspanel_us_land_code/weather03.txt @@ -17,12 +17,7 @@ Page weather03 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather03",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/weather04.txt b/nspanel_us_land_code/weather04.txt index 092c81d..0549fcd 100644 --- a/nspanel_us_land_code/weather04.txt +++ b/nspanel_us_land_code/weather04.txt @@ -17,12 +17,7 @@ Page weather04 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather04",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event diff --git a/nspanel_us_land_code/weather05.txt b/nspanel_us_land_code/weather05.txt index 308041b..26bf06f 100644 --- a/nspanel_us_land_code/weather05.txt +++ b/nspanel_us_land_code/weather05.txt @@ -17,12 +17,7 @@ Page weather05 page home }else { - printh 92 - prints "currentpage",0 - printh 00 - prints "weather05",0 - printh 00 - printh FF FF FF + sendme } Touch Press Event