diff --git a/.github/workflows/validate_esphome.yml b/.github/workflows/validate_esphome.yml index a8fdb38..077d33a 100644 --- a/.github/workflows/validate_esphome.yml +++ b/.github/workflows/validate_esphome.yml @@ -3,10 +3,12 @@ name: Validate ESPHome on: push: paths: - - "nspanel_esphome*.yaml" + - "nspanel_esphome.yaml" + - "advanced/esphome/nspanel_esphome*.yaml" pull_request: paths: - - "nspanel_esphome*.yaml" + - "nspanel_esphome.yaml" + - "advanced/esphome/nspanel_esphome*.yaml" #schedule: # - cron: "0 0 * * *" workflow_dispatch: @@ -25,11 +27,11 @@ jobs: - name: Validate nspanel_esphome.yaml run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome.yaml - name: Validate nspanel_esphome_advanced.yaml - run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_advanced.yaml + run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_advanced.yaml - name: Validate nspanel_esphome_addon_climate_cool.yaml - run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_addon_climate_cool.yaml + run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_addon_climate_cool.yaml - name: Validate nspanel_esphome_addon_climate_heat.yaml - run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_addon_climate_heat.yaml + run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_addon_climate_heat.yaml build_core: name: Core diff --git a/.github/workflows/validate_esphome_beta.yml b/.github/workflows/validate_esphome_beta.yml index 81e7f91..94abc6d 100644 --- a/.github/workflows/validate_esphome_beta.yml +++ b/.github/workflows/validate_esphome_beta.yml @@ -4,7 +4,8 @@ on: workflow_dispatch: pull_request: paths: - - "nspanel_esphome*.yaml" + - "nspanel_esphome.yaml" + - "advanced/esphome/nspanel_esphome*.yaml" #schedule: #- cron: "0 0 * * *" @@ -22,11 +23,11 @@ jobs: - name: Validate nspanel_esphome.yaml run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome.yaml - name: Validate nspanel_esphome_advanced.yaml - run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_advanced.yaml + run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_advanced.yaml - name: Validate nspanel_esphome_addon_climate_cool.yaml - run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_addon_climate_cool.yaml + run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_addon_climate_cool.yaml - name: Validate nspanel_esphome_addon_climate_heat.yaml - run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_addon_climate_heat.yaml + run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_addon_climate_heat.yaml build_core: name: Core @@ -108,18 +109,18 @@ jobs: yaml_file: "./.test/esphome_advanced_climate_cool_esp_idf.yaml" version: beta - build_climate_cool_advanced_esp_idf5: - name: esp-idf v5 & Bluetooth proxy - runs-on: "ubuntu-latest" - needs: - - build_climate_cool_advanced_esp_idf - steps: - - uses: actions/checkout@v4.1.0 - - name: Build core+advanced+climate_cool+esp_idf5 - uses: esphome/build-action@v1.8.0 - with: - yaml_file: "./.test/esphome_advanced_climate_cool_esp_idf5.yaml" - version: beta + #build_climate_cool_advanced_esp_idf5: + # name: esp-idf v5 & Bluetooth proxy + # runs-on: "ubuntu-latest" + # needs: + # - build_climate_cool_advanced_esp_idf + # steps: + # - uses: actions/checkout@v4.1.0 + # - name: Build core+advanced+climate_cool+esp_idf5 + # uses: esphome/build-action@v1.8.0 + # with: + # yaml_file: "./.test/esphome_advanced_climate_cool_esp_idf5.yaml" + # version: beta build_climate_heat_advanced_customization: name: Customizations diff --git a/.test/esphome_advanced.yaml b/.test/esphome_advanced.yaml index c908250..4a889b9 100644 --- a/.test/esphome_advanced.yaml +++ b/.test/esphome_advanced.yaml @@ -6,6 +6,6 @@ substitutions: packages: core_package: !include ../nspanel_esphome.yaml # Core package - advanced_package: !include ../nspanel_esphome_advanced.yaml - #addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml - #addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml + advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml + #addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml + #addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml diff --git a/.test/esphome_advanced_climate_cool_esp_idf.yaml b/.test/esphome_advanced_climate_cool_esp_idf.yaml index 23ab672..b43fc7d 100644 --- a/.test/esphome_advanced_climate_cool_esp_idf.yaml +++ b/.test/esphome_advanced_climate_cool_esp_idf.yaml @@ -6,9 +6,9 @@ substitutions: packages: core_package: !include ../nspanel_esphome.yaml # Core package - advanced_package: !include ../nspanel_esphome_advanced.yaml - #addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml - addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml + advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml + #addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml + addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml esp32: framework: diff --git a/.test/esphome_advanced_climate_cool_esp_idf5.yaml b/.test/esphome_advanced_climate_cool_esp_idf5.yaml index 1e99566..1db1f56 100644 --- a/.test/esphome_advanced_climate_cool_esp_idf5.yaml +++ b/.test/esphome_advanced_climate_cool_esp_idf5.yaml @@ -6,9 +6,9 @@ substitutions: packages: core_package: !include ../nspanel_esphome.yaml # Core package - advanced_package: !include ../nspanel_esphome_advanced.yaml - #addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml - addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml + advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml + #addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml + addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml esp32: framework: diff --git a/.test/esphome_advanced_climate_heat.yaml b/.test/esphome_advanced_climate_heat.yaml index 11d69e1..776e1e2 100644 --- a/.test/esphome_advanced_climate_heat.yaml +++ b/.test/esphome_advanced_climate_heat.yaml @@ -6,6 +6,6 @@ substitutions: packages: core_package: !include ../nspanel_esphome.yaml # Core package - advanced_package: !include ../nspanel_esphome_advanced.yaml - addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml - #addon_climate_cold: !include ../nspanel_esphome_addon_climate_cold.yaml + advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml + addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml + #addon_climate_cold: !include ../advanced/esphome/nspanel_esphome_addon_climate_cold.yaml diff --git a/.test/esphome_advanced_climate_heat_customizations.yaml b/.test/esphome_advanced_climate_heat_customizations.yaml index f442331..d2f57b7 100644 --- a/.test/esphome_advanced_climate_heat_customizations.yaml +++ b/.test/esphome_advanced_climate_heat_customizations.yaml @@ -7,9 +7,9 @@ substitutions: packages: core_package: !include ../nspanel_esphome.yaml # Core package - advanced_package: !include ../nspanel_esphome_advanced.yaml - addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml - #addon_climate_cold: !include ../nspanel_esphome_addon_climate_cold.yaml + advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml + addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml + #addon_climate_cold: !include ../advanced/esphome/nspanel_esphome_addon_climate_cold.yaml ##### Customizations from Wiki ##### api: diff --git a/.test/esphome_climate_cool.yaml b/.test/esphome_climate_cool.yaml index 128abac..0c9a354 100644 --- a/.test/esphome_climate_cool.yaml +++ b/.test/esphome_climate_cool.yaml @@ -6,6 +6,6 @@ substitutions: packages: core_package: !include ../nspanel_esphome.yaml # Core package - #advanced_package: !include ../nspanel_esphome_advanced.yaml - #addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml - addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml + #advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml + #addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml + addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml diff --git a/.test/esphome_climate_heat.yaml b/.test/esphome_climate_heat.yaml index c839972..8920018 100644 --- a/.test/esphome_climate_heat.yaml +++ b/.test/esphome_climate_heat.yaml @@ -6,6 +6,6 @@ substitutions: packages: core_package: !include ../nspanel_esphome.yaml # Core package - #advanced_package: !include ../nspanel_esphome_advanced.yaml - addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml - #addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml + #advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml + addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml + #addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml diff --git a/.test/esphome_core.yaml b/.test/esphome_core.yaml index 7eecc37..9010332 100644 --- a/.test/esphome_core.yaml +++ b/.test/esphome_core.yaml @@ -6,6 +6,6 @@ substitutions: packages: core_package: !include ../nspanel_esphome.yaml # Core package - #advanced_package: !include ../nspanel_esphome_advanced.yaml - #addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml - #addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml + #advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml + #addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml + #addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml diff --git a/ReleaseNotes.md b/ReleaseNotes.md index cee6dc8..5b2f050 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -19,9 +19,9 @@ So at this release we concentrated on cleaning up de code everywhere and shave s 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. ### Files that need to be reloaded: -1. nspanel_eu.tft, nspanel_us.tft or nspanel_us_land.tft - v4.1.2 -2. nspanel_esphome.yaml - v4.1.2 -3. nspanel_blueprint.yaml - v4.1.2 +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 #### @@ -103,6 +103,10 @@ packages: - 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` + - Upload TFT user's interface on the panel   ## Details of noteworthy changes diff --git a/nspanel_esphome_addon_climate_base.yaml b/advanced/esphome/nspanel_esphome_addon_climate_base.yaml similarity index 89% rename from nspanel_esphome_addon_climate_base.yaml rename to advanced/esphome/nspanel_esphome_addon_climate_base.yaml index 2bf121d..7c6e514 100644 --- a/nspanel_esphome_addon_climate_base.yaml +++ b/advanced/esphome/nspanel_esphome_addon_climate_base.yaml @@ -1,7 +1,11 @@ -#################################################################################################### -##### NSPanel ESPHome Add-on for Climate control - Shared - This will be called by heat/cool ##### -##### Add-on for https://github.com/Blackymas/NSPanel_HA_Blueprint ##### -#################################################################################################### +##################################################################################################### +##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint ##### +##### ESPHome Add-on for Climate control - Shared - This will be called by heat/cool ##### +##### PLEASE only make changes if it is necessary and also the required knowledge is available. ##### +##### For normal use with the Blueprint, no changes are necessary. ##### +##################################################################################################### +##### ATTENTION: This will add climate elements to the core system and requires the core part. ##### +##################################################################################################### substitutions: ### Local thermostat defaults ### diff --git a/advanced/esphome/nspanel_esphome_addon_climate_cool.yaml b/advanced/esphome/nspanel_esphome_addon_climate_cool.yaml new file mode 100644 index 0000000..f887e45 --- /dev/null +++ b/advanced/esphome/nspanel_esphome_addon_climate_cool.yaml @@ -0,0 +1,37 @@ +##################################################################################################### +##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint ##### +##### ESPHome Add-on for Climate control - Cool ##### +##### PLEASE only make changes if it is necessary and also the required knowledge is available. ##### +##### For normal use with the Blueprint, no changes are necessary. ##### +##################################################################################################### +##### ATTENTION: This will add climate elements to the core system and requires the core part. ##### +##################################################################################################### + +substitutions: + ### Local thermostat defaults ### + # https://esphome.io/components/climate/thermostat.html + cooler_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled + # https://esphome.io/components/climate/index.html#base-climate-configuration + temp_min: "15" + temp_max: "45" + + ##### DO NOT CHANGE THIS ##### + addon_climate_cool: "true" + addon_climate_heat: "false" + ############################## + +climate: + - id: !extend thermostat_embedded + min_cooling_off_time: ${min_off_time}s + min_cooling_run_time: ${min_run_time}s + cool_action: + - switch.turn_on: relay_${cooler_relay} + preset: + - name: "Off" + default_target_temperature_high: ${temp_min} ${temp_units} + mode: "off" + - name: Home + default_target_temperature_high: 21 ${temp_units} + +packages: + core_package: !include nspanel_esphome_addon_climate_base.yaml diff --git a/advanced/esphome/nspanel_esphome_addon_climate_heat.yaml b/advanced/esphome/nspanel_esphome_addon_climate_heat.yaml new file mode 100644 index 0000000..eab575d --- /dev/null +++ b/advanced/esphome/nspanel_esphome_addon_climate_heat.yaml @@ -0,0 +1,37 @@ +##################################################################################################### +##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint ##### +##### ESPHome Add-on for Climate control - Heat ##### +##### PLEASE only make changes if it is necessary and also the required knowledge is available. ##### +##### For normal use with the Blueprint, no changes are necessary. ##### +##################################################################################################### +##### ATTENTION: This will add climate elements to the core system and requires the core part. ##### +##################################################################################################### + +substitutions: + ### Local thermostat defaults ### + # https://esphome.io/components/climate/thermostat.html + heater_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled + # https://esphome.io/components/climate/index.html#base-climate-configuration + temp_min: "5" + temp_max: "25" + + ##### DO NOT CHANGE THIS ##### + addon_climate_cool: "false" + addon_climate_heat: "true" + ############################## + +climate: + - id: !extend thermostat_embedded + min_heating_off_time: ${min_off_time}s + min_heating_run_time: ${min_run_time}s + heat_action: + - switch.turn_on: relay_${heater_relay} + preset: + - name: "Off" + default_target_temperature_low: ${temp_min} ${temp_units} + mode: "off" + - name: Home + default_target_temperature_low: 21 ${temp_units} + +packages: + core_package: !include nspanel_esphome_addon_climate_base.yaml diff --git a/nspanel_esphome_addon_upload_tft.yaml b/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml similarity index 88% rename from nspanel_esphome_addon_upload_tft.yaml rename to advanced/esphome/nspanel_esphome_addon_upload_tft.yaml index 5158756..8d9b71e 100644 --- a/nspanel_esphome_addon_upload_tft.yaml +++ b/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml @@ -4,6 +4,8 @@ ##### PLEASE only make changes if it is necessary and also the required knowledge is available. ##### ##### For normal use with the Blueprint, no changes are necessary. ##### ##################################################################################################### +##### ATTENTION: This will add advanced elements to the core system and requires the core part. ##### +##################################################################################################### substitutions: @@ -138,20 +140,6 @@ script: static const char *const TAG = "script.upload_tft"; ESP_LOGD(TAG, "Starting..."); - nextion_init->publish_state(false); - disp1->set_backlight_brightness(1); - disp1->hide_component("255"); - stop_all->execute(); - - std::vector buffer_; - - bool is_updating_ = false; - - bool upload_first_chunk_sent_ = false; - - int content_length_ = 0; - int tft_size_ = 0; - auto delay_seconds_ = [](int seconds) { ESP_LOGD(TAG, "Wait %i seconds", seconds); for (int i = 0; i < (seconds*4); i++) { @@ -164,6 +152,54 @@ script: } }; + std::string framework = "Unknown"; + #ifdef ARDUINO + framework = "Arduino"; + #elif defined(ESP_PLATFORM) + framework = "ESP-IDF"; + #endif + + if (disp1->is_setup()) { + disp1->set_backlight_brightness(1); + disp1->set_component_text_printf("confirm.title", "Upload TFT\\r%s", framework.c_str()); + disp1->set_component_text_printf("confirm.body", "Preparing..."); + disp1->goto_page("confirm"); + disp1->hide_component("bt_close"); + disp1->hide_component("bt_accept"); + disp1->hide_component("bt_clear"); + disp1->hide_component("bt_close"); + delay_seconds_(1); + display_wrapped_text->execute("confirm.body", "Informing the blueprint that panel is unavailable...", 18); + disp1->hide_component("bt_close"); + } + nextion_init->publish_state(false); + if (disp1->is_setup()) { + delay_seconds_(1); + display_wrapped_text->execute("confirm.body", "Stopping scripts...", 18); + } + stop_all->execute(); + if (disp1->is_setup()) delay_seconds_(1); + + std::vector buffer_; + + bool is_updating_ = false; + + bool upload_first_chunk_sent_ = false; + + int content_length_ = 0; + int tft_size_ = 0; + + auto set_baud_rate_ = [](int baud_rate) { + #ifdef USE_ARDUINO + auto *uart = reinterpret_cast(tf_uart); + #endif + #ifdef USE_ESP_IDF + auto *uart = reinterpret_cast(tf_uart); + #endif + uart->set_baud_rate(baud_rate); + uart->setup(); + }; + auto send_nextion_command = [](const std::string &command) -> bool { static const char *const TAG = "script.upload_tft.send_nextion_command"; @@ -363,8 +399,8 @@ script: { static const char *const TAG = "script.upload_tft.upload_tft_arduino"; ESP_LOGD(TAG, "Nextion TFT upload requested"); - ESP_LOGD(TAG, "url: %s", url.c_str()); - ESP_LOGD(TAG, "baud_rate: %i", update_baud_rate_); + ESP_LOGD(TAG, " url: %s", url.c_str()); + ESP_LOGD(TAG, " baud_rate: %i", update_baud_rate_); if (is_updating_) { ESP_LOGD(TAG, "Currently updating"); @@ -440,8 +476,9 @@ script: // Tells the Nextion the content length of the tft file and baud rate it will be sent at // Once the Nextion accepts the command it will wait until the file is successfully uploaded // If it fails for any reason a power cycle of the display will be needed - sprintf(command, "whmi-wris %d,%" PRIu32 ",1", content_length_, update_baud_rate_); + sprintf(command, "whmi-wris %d,%d,1", content_length_, update_baud_rate_); + ESP_LOGD(TAG, "Clear serial receive buffer: %d", id(tf_uart).available()); // Clear serial receive buffer uint8_t d; while (id(tf_uart).available()) { @@ -450,16 +487,16 @@ script: send_nextion_command(command); - if (update_baud_rate_ != id(tf_uart).get_baud_rate()) - { - id(tf_uart).set_baud_rate(update_baud_rate_); - id(tf_uart).setup(); + if (update_baud_rate_ != id(tf_uart).get_baud_rate()) { + set_baud_rate_(update_baud_rate_); + //id(tf_uart).set_baud_rate(update_baud_rate_); + //id(tf_uart).setup(); + //delay_seconds_(2); } - std::string response; ESP_LOGD(TAG, "Waiting for upgrade response"); - recv_ret_string_(response, 2000, true); // This can take some time to return - + std::string response; + recv_ret_string_(response, 5000, true); // This can take some time to return // The Nextion display will, if it's ready to accept data, send a 0x05 byte. ESP_LOGD(TAG, "Upgrade response is [%s]", format_hex_pretty(reinterpret_cast(response.data()), response.size()).c_str()); @@ -628,8 +665,8 @@ script: auto upload_tft_ = [&](const std::string &url, unsigned int update_baud_rate_) -> bool { static const char *const TAG = "script.upload_tft.upload_tft_esp_idf"; ESP_LOGD(TAG, "Nextion TFT upload requested"); - ESP_LOGD(TAG, "url: %s", url.c_str()); - ESP_LOGD(TAG, "baud_rate: %i", update_baud_rate_); + ESP_LOGD(TAG, " url: %s", url.c_str()); + ESP_LOGD(TAG, " baud_rate: %i", update_baud_rate_); if (is_updating_) { ESP_LOGW(TAG, "Currently updating"); @@ -711,10 +748,10 @@ script: send_nextion_command(command); - if (update_baud_rate_ != id(tf_uart).get_baud_rate()) - { - id(tf_uart).set_baud_rate(update_baud_rate_); - id(tf_uart).setup(); + if (update_baud_rate_ != id(tf_uart).get_baud_rate()) { + set_baud_rate_(update_baud_rate_); + //id(tf_uart).set_baud_rate(update_baud_rate_); + //id(tf_uart).setup(); } std::string response; @@ -759,36 +796,43 @@ script: }; #endif - unsigned int upload_tries = 0; - while (upload_tries < 5) { - upload_tries++; - ESP_LOGD(TAG, "Try #%i", upload_tries); - if (upload_tft_(url, id(tf_uart).get_baud_rate())) id(restart_nspanel).press(); - ESP_LOGD(TAG, "Turn off Nextion"); - id(screen_power).turn_off(); - delay_seconds_(2); - ESP_LOGD(TAG, "Turn on Nextion"); - id(screen_power).turn_on(); - delay_seconds_(5); + ESP_LOGD(TAG, "Try #1 at 921600 bps"); + if (disp1->is_setup()) { + display_wrapped_text->execute("confirm.body", "Try #1 at 921600 bps", 18); + delay_seconds_(1); } - unsigned int new_baud_rate; - if (id(tf_uart).get_baud_rate() == 115200) { - new_baud_rate = 921600; - } else { - new_baud_rate = 115200; + if (upload_tft_(url, 921600)) id(restart_nspanel).press(); + ESP_LOGW(TAG, "Try #1 failed"); + if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "Try #1 failed", 18); + delay_seconds_(5); + ESP_LOGD(TAG, "Try #2 at 921600 bps"); + if (upload_tft_(url, 921600)) id(restart_nspanel).press(); + ESP_LOGW(TAG, "Try #2 failed"); + if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "Try #2 failed", 18); + delay_seconds_(5); + ESP_LOGD(TAG, "Try #3 at 115200 bps"); + if (upload_tft_(url, 115200)) id(restart_nspanel).press(); + ESP_LOGW(TAG, "Try #3 failed"); + if (disp1->is_setup()) { + display_wrapped_text->execute("confirm.body", "Try #3 failed. Restarting display.", 18); + delay_seconds_(3); } - ESP_LOGD(TAG, "Trying again at %i bps", new_baud_rate); - if (upload_tft_(url, new_baud_rate)) { - id(restart_nspanel).press(); - } - ESP_LOGE(TAG, "TFT upload failed."); ESP_LOGD(TAG, "Turn off Nextion"); id(screen_power).turn_off(); delay_seconds_(2); ESP_LOGD(TAG, "Turn on Nextion"); id(screen_power).turn_on(); - ESP_LOGD(TAG, "Restarting esphome"); + delay_seconds_(10); + ESP_LOGD(TAG, "Try #4 at 115200 bps"); + if (upload_tft_(url, 115200)) id(restart_nspanel).press(); + ESP_LOGE(TAG, "TFT upload failed"); + ESP_LOGD(TAG, "Turn off Nextion"); + id(screen_power).turn_off(); + delay_seconds_(2); + ESP_LOGD(TAG, "Turn on Nextion"); + id(screen_power).turn_on(); + ESP_LOGD(TAG, "Restarting ESPHome"); delay_seconds_(2); id(restart_nspanel).press(); - ESP_LOGD(TAG, "Finished!"); \ No newline at end of file + ESP_LOGD(TAG, "Finished!"); diff --git a/nspanel_esphome_advanced.yaml b/advanced/esphome/nspanel_esphome_advanced.yaml similarity index 95% rename from nspanel_esphome_advanced.yaml rename to advanced/esphome/nspanel_esphome_advanced.yaml index dfb2e06..a789833 100644 --- a/nspanel_esphome_advanced.yaml +++ b/advanced/esphome/nspanel_esphome_advanced.yaml @@ -1,6 +1,6 @@ ##################################################################################################### ##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint ##### -##### ADVANCED CONFIG + FULL ESPHOME CODE! ##### +##### ESPHOME ADVANCED ##### ##### PLEASE only make changes if it is necessary and also the required knowledge is available. ##### ##### For normal use with the Blueprint, no changes are necessary. ##### ##################################################################################################### @@ -84,10 +84,6 @@ time: - component.update: api_timestamp - component.update: device_timestamp -uart: - - id: !extend tf_uart - baud_rate: 921600 - web_server: id: web_server_std port: 80 diff --git a/nspanel_esphome_core.yaml b/advanced/esphome/nspanel_esphome_core.yaml similarity index 98% rename from nspanel_esphome_core.yaml rename to advanced/esphome/nspanel_esphome_core.yaml index 9959780..ae77239 100644 --- a/nspanel_esphome_core.yaml +++ b/advanced/esphome/nspanel_esphome_core.yaml @@ -1,13 +1,13 @@ ##################################################################################################### ##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint ##### -##### ADVANCED CONFIG + FULL ESPHOME CODE! ##### +##### ESPHOME CORE ##### ##### PLEASE only make changes if it is necessary and also the required knowledge is available. ##### ##### For normal use with the Blueprint, no changes are necessary. ##### ##################################################################################################### substitutions: ##### DON'T CHANGE THIS ##### - version: "4.1.3" + version: "4.1.4" ############################# #external_components: @@ -68,7 +68,7 @@ esphome: - wait_until: condition: - lambda: !lambda return disp1->is_setup(); - timeout: 45s + timeout: 20s - lambda: |- static const char *const TAG = "on_boot"; nextion_status->execute(); @@ -226,6 +226,9 @@ api: // Alarm page - Header update_alarm_icon->execute("icon_state", state.c_str()); + if (page_title.find("\\r") != std::string::npos) { + page_title = page_title.replace(page_title.find("\\r"), 2, " "); + } disp1->set_component_text_printf("page_label", "%s", page_title.c_str()); disp1->set_component_text_printf("code_format", "%s", code_format.c_str()); if (code_arm_required) disp1->set_component_text_printf("code_arm_req", "1"); else disp1->set_component_text_printf("code_arm_req", "0"); @@ -432,6 +435,9 @@ api: detailed_entity->publish_state(entity); std::string cmd_page = std::string("page ") + page.c_str(); disp1->send_command_printf(cmd_page.c_str()); + if (page_label.find("\\r") != std::string::npos) { + page_label = page_label.replace(page_label.find("\\r"), 2, " "); + } disp1->set_component_text_printf("page_label", "%s", page_label.c_str()); disp1->set_component_text_printf("back_page", "%s", back_page.c_str()); if (page == "climate") @@ -2094,23 +2100,27 @@ script: int startPos = 0; int endPos = 0; std::string wrappedText = ""; - while (startPos < text_to_display.length()) { - while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; } - int endPos = startPos + line_length_limit; - if (endPos >= text_to_display.length()) endPos = text_to_display.length(); - else - { - while (endPos > startPos && text_to_display[endPos] != ' ') { endPos--; } - if (endPos == startPos) endPos = startPos + line_length_limit; // Handle case of long word - } - wrappedText += text_to_display.substr(startPos, endPos-startPos); - if (endPos < text_to_display.length()) - { - while (text_to_display[endPos] == ' ') { endPos--; } - if (endPos >= startPos) wrappedText += "\\r"; - } - startPos = endPos + 1; // Skip the space - while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; } + if (text_to_display.find("\\r") != std::string::npos) { + wrappedText = text_to_display; + } else { + while (startPos < text_to_display.length()) { + while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; } + int endPos = startPos + line_length_limit; + if (endPos >= text_to_display.length()) endPos = text_to_display.length(); + else + { + while (endPos > startPos && text_to_display[endPos] != ' ') { endPos--; } + if (endPos == startPos) endPos = startPos + line_length_limit; // Handle case of long word + } + wrappedText += text_to_display.substr(startPos, endPos-startPos); + if (endPos < text_to_display.length()) + { + while (text_to_display[endPos] == ' ') { endPos--; } + if (endPos >= startPos) wrappedText += "\\r"; + } + startPos = endPos + 1; // Skip the space + while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; } + } } disp1->set_component_text_printf(component.c_str(), "%s", wrappedText.c_str()); diff --git a/custom_configuration/nspanel_blank.HMI b/advanced/hmi/nspanel_blank.HMI similarity index 100% rename from custom_configuration/nspanel_blank.HMI rename to advanced/hmi/nspanel_blank.HMI diff --git a/custom_configuration/nspanel_blank_code/Program.s.txt b/advanced/hmi/nspanel_blank_code/Program.s.txt similarity index 100% rename from custom_configuration/nspanel_blank_code/Program.s.txt rename to advanced/hmi/nspanel_blank_code/Program.s.txt diff --git a/custom_configuration/nspanel_blank_code/blank.txt b/advanced/hmi/nspanel_blank_code/blank.txt similarity index 100% rename from custom_configuration/nspanel_blank_code/blank.txt rename to advanced/hmi/nspanel_blank_code/blank.txt diff --git a/custom_configuration/nspanel_blank_code/page0.txt b/advanced/hmi/nspanel_blank_code/page0.txt similarity index 100% rename from custom_configuration/nspanel_blank_code/page0.txt rename to advanced/hmi/nspanel_blank_code/page0.txt diff --git a/custom_configuration/nspanel_blank_code/screensaver.txt b/advanced/hmi/nspanel_blank_code/screensaver.txt similarity index 100% rename from custom_configuration/nspanel_blank_code/screensaver.txt rename to advanced/hmi/nspanel_blank_code/screensaver.txt diff --git a/nspanel_eu.HMI b/advanced/hmi/nspanel_eu.HMI similarity index 99% rename from nspanel_eu.HMI rename to advanced/hmi/nspanel_eu.HMI index e495a49..c037338 100644 Binary files a/nspanel_eu.HMI and b/advanced/hmi/nspanel_eu.HMI differ diff --git a/nspanel_eu_code/Program.s.txt b/advanced/hmi/nspanel_eu_code/Program.s.txt similarity index 98% rename from nspanel_eu_code/Program.s.txt rename to advanced/hmi/nspanel_eu_code/Program.s.txt index 81c87af..00cf31b 100644 --- a/nspanel_eu_code/Program.s.txt +++ b/advanced/hmi/nspanel_eu_code/Program.s.txt @@ -1,26 +1,26 @@ -Program.s - //The following code is only run once when power on, and is generally used for global variable definition and power on initialization data - int sys0=0,sys1=0,sys2=0,swipex=0,swipey=0,swipex2=0,swipey2=0,swipec=0,swipec2=0,swipedx=100,swipedy=100 //At present, the definition of global variable only supports 4-byte signed integer (int), and other types of global quantity declaration are not supported. If you want to use string type, you can use variable control in the page to implement - int r=0,g=0,b=0 - int h=0,s=0,v=0 - int p=0,q=0,t=0,f=0 - int dimdelta=0 - int api=0 // 0 = disconnected from HA, 1 = connected to HA - int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0 - int brightness=100,brightness_dim=40 - int display_mode=1 // 1 = EU, 2 = US, 3 = US landscape - //bauds=115200//Configure baudrate - recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode - randset 0,65535//used for touchevent sensor - printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port - if(display_mode==1) - { - lcd_dev fffb 0002 0000 0020// Fix touch offset for EU Version - } - printh 92 - prints "currentpage",0 - printh 00 - prints "",0 - printh 00 - printh FF FF FF - page 8//Power on start page boot +Program.s + //The following code is only run once when power on, and is generally used for global variable definition and power on initialization data + int sys0=0,sys1=0,sys2=0,swipex=0,swipey=0,swipex2=0,swipey2=0,swipec=0,swipec2=0,swipedx=100,swipedy=100 //At present, the definition of global variable only supports 4-byte signed integer (int), and other types of global quantity declaration are not supported. If you want to use string type, you can use variable control in the page to implement + int r=0,g=0,b=0 + int h=0,s=0,v=0 + int p=0,q=0,t=0,f=0 + int dimdelta=0 + int api=0 // 0 = disconnected from HA, 1 = connected to HA + int is_alarm=0,is_entities=0,is_qrcode=0,is_notification=0 + int brightness=100,brightness_dim=40 + int display_mode=1 // 1 = EU, 2 = US, 3 = US landscape + //bauds=115200//Configure baudrate + recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode + randset 0,65535//used for touchevent sensor + printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port + if(display_mode==1) + { + lcd_dev fffb 0002 0000 0020// Fix touch offset for EU Version + } + printh 92 + prints "currentpage",0 + printh 00 + prints "",0 + printh 00 + printh FF FF FF + page 8//Power on start page boot diff --git a/nspanel_eu_code/alarm.txt b/advanced/hmi/nspanel_eu_code/alarm.txt similarity index 100% rename from nspanel_eu_code/alarm.txt rename to advanced/hmi/nspanel_eu_code/alarm.txt diff --git a/nspanel_eu_code/boot.txt b/advanced/hmi/nspanel_eu_code/boot.txt similarity index 95% rename from nspanel_eu_code/boot.txt rename to advanced/hmi/nspanel_eu_code/boot.txt index dab95f5..59c4df2 100644 --- a/nspanel_eu_code/boot.txt +++ b/advanced/hmi/nspanel_eu_code/boot.txt @@ -1,278 +1,278 @@ -Page boot - Attributes - ID : 0 - Scope : local - Dragging : 0 - Send Component ID : disabled - Locked : no - Swide up page ID : disabled - Swide down page ID : disabled - Swide left page ID : disabled - Swide right page ID: disabled - - Events - Preinitialize Event - printh 92 - prints "currentpage",0 - printh 00 - prints "boot",0 - printh 00 - printh FF FF FF - dim=0 - vis bt_reboot,0 - covx baud,baud_rate.txt,0,0 - baud_rate.txt+=" bps" - covx display_mode,aux2.txt,0,0 - nspanelevent.txt="{\"page\": \"boot\", \"event\": \"pagechanged\", \"version\": \""+tft_version.txt+"\", \"display_mode\": \""+aux2.txt+"\"}" - printh 92 - prints "localevent",0 - printh 00 - prints nspanelevent.txt,0 - printh 00 - printh FF FF FF - - Touch Press Event - printh 91 - prints "touchevent",0 - printh 00 - prints rand,0 - printh FF FF FF - - Touch Release Event - printh 91 - prints "touchevent",0 - printh 00 - prints rand,0 - printh FF FF FF - - Page Exit Event - dim=0 - -Variable (int32) counter - Attributes - ID : 12 - Scope: local - Value: 0 - -Variable (string) aux1 - Attributes - ID : 13 - Scope : local - Text : - Max. Text Size: 10 - -Variable (string) nspanelevent - Attributes - ID : 14 - Scope : local - Text : - Max. Text Size: 150 - -Variable (string) aux2 - Attributes - ID : 15 - Scope : local - Text : - Max. Text Size: 10 - -Text ip_addr - Attributes - ID : 1 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : Initializing... - Max. Text Size : 15 - -Text t0 - Attributes - ID : 2 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : Please wait... - Max. Text Size : 15 - -Text t1 - Attributes - ID : 3 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : The process can take several seconds! - Max. Text Size : 50 - -Text tft_label - Attributes - ID : 5 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : TFT: - Max. Text Size : 4 - -Text esph_label - Attributes - ID : 6 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : ESPHome: - Max. Text Size : 8 - -Text bluep_label - Attributes - ID : 7 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : Blueprint: - Max. Text Size : 10 - -Text tft_version - Attributes - ID : 8 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : 4.1.3 - Max. Text Size : 9 - -Text esph_version - Attributes - ID : 9 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 9 - -Text bluep_version - Attributes - ID : 10 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 9 - -Text baud_rate - Attributes - ID : 18 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text framework - Attributes - ID : 20 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Dual-state Button bt_reboot - Attributes - ID : 4 - Scope : local - Dragging : 0 - Send Component ID: on press and release - State : unpressed - Text : Reboot - Max. Text Size : 6 - -Timer timer - Attributes - ID : 11 - Scope : local - Period (ms): 65534 - Enabled : yes - - Events - Timer Event - counter.val++ - covx counter.val,aux1.txt,0,0 - covx display_mode,aux2.txt,0,0 - nspanelevent.txt="{\"page\": \"boot\", \"event\": \"timeout\", \"value\": "+aux1.txt+", \"version\": \""+tft_version.txt+"\", \"display_mode\": \""+aux2.txt+"\"}" - bluep_version.txt="Retry: "+aux1.txt - printh 92 - prints "nspanelevent",0 - printh 00 - prints nspanelevent.txt,0 - printh 00 - printh FF FF FF - -Timer wakeup_timer - Attributes - ID : 16 - Scope : local - Period (ms): 50 - Enabled : yes - - Events - Timer Event - if(dim<100) - { - dimdelta=100-dim - dimdelta/=25 - if(dimdelta<1) - { - dimdelta=1 - } - dim+=dimdelta - }else - { - wakeup_timer.en=0 - } - -Timer tm_esphome - Attributes - ID : 17 - Scope : local - Period (ms): 30000 - Enabled : yes - - Events - Timer Event - if(baud==115200) - { - bauds=921600 - }else - { - bauds=115200 - } - covx baud,baud_rate.txt,0,0 - baud_rate.txt+=" bps" - -Timer tm_pageid - Attributes - ID : 19 - Scope : local - Period (ms): 2500 - Enabled : yes - - Events - Timer Event - covx display_mode,aux2.txt,0,0 - nspanelevent.txt="{\"page\": \"boot\", \"event\": \"pagechanged\", \"version\": \""+tft_version.txt+"\", \"display_mode\": \""+aux2.txt+"\"}" - printh 92 - prints "localevent",0 - printh 00 - prints nspanelevent.txt,0 - printh 00 - printh FF FF FF - +Page boot + Attributes + ID : 0 + Scope : local + Dragging : 0 + Send Component ID : disabled + Locked : no + Swide up page ID : disabled + Swide down page ID : disabled + Swide left page ID : disabled + Swide right page ID: disabled + + Events + Preinitialize Event + printh 92 + prints "currentpage",0 + printh 00 + prints "boot",0 + printh 00 + printh FF FF FF + dim=0 + vis bt_reboot,0 + covx baud,baud_rate.txt,0,0 + baud_rate.txt+=" bps" + covx display_mode,aux2.txt,0,0 + nspanelevent.txt="{\"page\": \"boot\", \"event\": \"pagechanged\", \"version\": \""+tft_version.txt+"\", \"display_mode\": \""+aux2.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints nspanelevent.txt,0 + printh 00 + printh FF FF FF + + Touch Press Event + printh 91 + prints "touchevent",0 + printh 00 + prints rand,0 + printh FF FF FF + + Touch Release Event + printh 91 + prints "touchevent",0 + printh 00 + prints rand,0 + printh FF FF FF + + Page Exit Event + dim=0 + +Variable (int32) counter + Attributes + ID : 12 + Scope: local + Value: 0 + +Variable (string) aux1 + Attributes + ID : 13 + Scope : local + Text : + Max. Text Size: 10 + +Variable (string) nspanelevent + Attributes + ID : 14 + Scope : local + Text : + Max. Text Size: 150 + +Variable (string) aux2 + Attributes + ID : 15 + Scope : local + Text : + Max. Text Size: 10 + +Text ip_addr + Attributes + ID : 1 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Initializing... + Max. Text Size : 15 + +Text t0 + Attributes + ID : 2 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Please wait... + Max. Text Size : 15 + +Text t1 + Attributes + ID : 3 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : The process can take several seconds! + Max. Text Size : 50 + +Text tft_label + Attributes + ID : 5 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : TFT: + Max. Text Size : 4 + +Text esph_label + Attributes + ID : 6 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : ESPHome: + Max. Text Size : 8 + +Text bluep_label + Attributes + ID : 7 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Blueprint: + Max. Text Size : 10 + +Text tft_version + Attributes + ID : 8 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 4.1.4 + Max. Text Size : 9 + +Text esph_version + Attributes + ID : 9 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 9 + +Text bluep_version + Attributes + ID : 10 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 9 + +Text baud_rate + Attributes + ID : 18 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 10 + +Text framework + Attributes + ID : 20 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 10 + +Dual-state Button bt_reboot + Attributes + ID : 4 + Scope : local + Dragging : 0 + Send Component ID: on press and release + State : unpressed + Text : Reboot + Max. Text Size : 6 + +Timer timer + Attributes + ID : 11 + Scope : local + Period (ms): 65534 + Enabled : yes + + Events + Timer Event + counter.val++ + covx counter.val,aux1.txt,0,0 + covx display_mode,aux2.txt,0,0 + nspanelevent.txt="{\"page\": \"boot\", \"event\": \"timeout\", \"value\": "+aux1.txt+", \"version\": \""+tft_version.txt+"\", \"display_mode\": \""+aux2.txt+"\"}" + bluep_version.txt="Retry: "+aux1.txt + printh 92 + prints "nspanelevent",0 + printh 00 + prints nspanelevent.txt,0 + printh 00 + printh FF FF FF + +Timer wakeup_timer + Attributes + ID : 16 + Scope : local + Period (ms): 50 + Enabled : yes + + Events + Timer Event + if(dim<100) + { + dimdelta=100-dim + dimdelta/=25 + if(dimdelta<1) + { + dimdelta=1 + } + dim+=dimdelta + }else + { + wakeup_timer.en=0 + } + +Timer tm_esphome + Attributes + ID : 17 + Scope : local + Period (ms): 30000 + Enabled : yes + + Events + Timer Event + if(baud==115200) + { + bauds=921600 + }else + { + bauds=115200 + } + covx baud,baud_rate.txt,0,0 + baud_rate.txt+=" bps" + +Timer tm_pageid + Attributes + ID : 19 + Scope : local + Period (ms): 2500 + Enabled : yes + + Events + Timer Event + covx display_mode,aux2.txt,0,0 + nspanelevent.txt="{\"page\": \"boot\", \"event\": \"pagechanged\", \"version\": \""+tft_version.txt+"\", \"display_mode\": \""+aux2.txt+"\"}" + printh 92 + prints "localevent",0 + printh 00 + prints nspanelevent.txt,0 + printh 00 + printh FF FF FF + diff --git a/nspanel_us_land_code/buttonpage01.txt b/advanced/hmi/nspanel_eu_code/buttonpage01.txt similarity index 100% rename from nspanel_us_land_code/buttonpage01.txt rename to advanced/hmi/nspanel_eu_code/buttonpage01.txt diff --git a/nspanel_us_land_code/buttonpage02.txt b/advanced/hmi/nspanel_eu_code/buttonpage02.txt similarity index 100% rename from nspanel_us_land_code/buttonpage02.txt rename to advanced/hmi/nspanel_eu_code/buttonpage02.txt diff --git a/nspanel_us_land_code/buttonpage03.txt b/advanced/hmi/nspanel_eu_code/buttonpage03.txt similarity index 100% rename from nspanel_us_land_code/buttonpage03.txt rename to advanced/hmi/nspanel_eu_code/buttonpage03.txt diff --git a/nspanel_us_land_code/buttonpage04.txt b/advanced/hmi/nspanel_eu_code/buttonpage04.txt similarity index 100% rename from nspanel_us_land_code/buttonpage04.txt rename to advanced/hmi/nspanel_eu_code/buttonpage04.txt diff --git a/nspanel_eu_code/climate.txt b/advanced/hmi/nspanel_eu_code/climate.txt similarity index 100% rename from nspanel_eu_code/climate.txt rename to advanced/hmi/nspanel_eu_code/climate.txt diff --git a/nspanel_us_land_code/confirm.txt b/advanced/hmi/nspanel_eu_code/confirm.txt similarity index 99% rename from nspanel_us_land_code/confirm.txt rename to advanced/hmi/nspanel_eu_code/confirm.txt index a56d23c..240e7bc 100644 --- a/nspanel_us_land_code/confirm.txt +++ b/advanced/hmi/nspanel_eu_code/confirm.txt @@ -109,7 +109,7 @@ Text body Send Component ID : disabled Associated Keyboard: none Text : Please confirm - Max. Text Size : 22 + Max. Text Size : 254 Events Touch Press Event diff --git a/nspanel_eu_code/cover.txt b/advanced/hmi/nspanel_eu_code/cover.txt similarity index 96% rename from nspanel_eu_code/cover.txt rename to advanced/hmi/nspanel_eu_code/cover.txt index de7bbf2..1b18b80 100644 --- a/nspanel_eu_code/cover.txt +++ b/advanced/hmi/nspanel_eu_code/cover.txt @@ -1,243 +1,243 @@ -Page cover - Attributes - ID : 0 - Scope : local - Dragging : 0 - Send Component ID : disabled - Locked : no - Swide up page ID : disabled - Swide down page ID : disabled - Swide left page ID : disabled - Swide right page ID: disabled - - Events - Preinitialize Event - if(api==0) - { - page home - }else - { - printh 92 - prints "currentpage",0 - printh 00 - prints "cover",0 - printh 00 - printh FF FF FF - } - - Touch Press Event - printh 91 - prints "touchevent",0 - printh 00 - prints rand,0 - printh FF FF FF - - Touch Release Event - printh 91 - prints "touchevent",0 - printh 00 - prints rand,0 - printh FF FF FF - -Variable (string) va1 - Attributes - ID : 7 - Scope : local - Text : newtxt - Max. Text Size: 10 - -Variable (string) coversetting - Attributes - ID : 11 - Scope : local - Text : - Max. Text Size: 255 - -Variable (string) back_page - Attributes - ID : 12 - Scope : local - Text : home - Max. Text Size: 15 - -Text battery_value - Attributes - ID : 1 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text cover_value - Attributes - ID : 2 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text page_label - Attributes - ID : 3 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 25 - -Text icon_state - Attributes - ID : 9 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Text battery_icon - Attributes - ID : 10 - Scope : local - Dragging : 0 - Send Component ID : disabled - Associated Keyboard: none - Text : - Max. Text Size : 10 - -Slider coverslider - Attributes - ID : 6 - Scope : local - Dragging : 0 - Send Component ID: disabled - Position : 0 - Upper range limit: 100 - Lower range limit: 0 - - Events - Touch Release Event - covx coverslider.val,va1.txt,0,0 - cover_value.txt=va1.txt+"%" - coversetting.txt="{\"page\": \"cover\", \"key\": \"position\", \"value\": "+va1.txt+"}" - printh 92 - prints "localevent",0 - printh 00 - prints coversetting.txt,0 - printh 00 - printh FF FF FF - -Button cover_open - Attributes - ID : 4 - Scope : local - Dragging : 0 - Send Component ID: disabled - State : unpressed - Text : - Max. Text Size : 3 - - Events - Touch Press Event - printh 92 - prints "localevent",0 - printh 00 - prints "{\"page\": \"cover\", \"key\": \"open_cover\", \"value\": \"press\"}",0 - printh 00 - printh FF FF FF - -Button cover_close - Attributes - ID : 5 - Scope : local - Dragging : 0 - Send Component ID: disabled - State : unpressed - Text : - Max. Text Size : 3 - - Events - Touch Press Event - printh 92 - prints "localevent",0 - printh 00 - prints "{\"page\": \"cover\", \"key\": \"close_cover\", \"value\": \"press\"}",0 - printh 00 - printh FF FF FF - -Button cover_stop - Attributes - ID : 8 - Scope : local - Dragging : 0 - Send Component ID: disabled - State : unpressed - Text : - Max. Text Size : 3 - - Events - Touch Press Event - printh 92 - prints "localevent",0 - printh 00 - prints "{\"page\": \"cover\", \"key\": \"stop_cover\", \"value\": \"press\"}",0 - printh 00 - printh FF FF FF - -Button button_back - Attributes - ID : 13 - Scope : local - Dragging : 0 - Send Component ID: disabled - State : unpressed - Text :  - Max. Text Size : 3 - - Events - Touch Press Event - if(back_page.txt=="buttonpage01") - { - page buttonpage01 - }else if(back_page.txt=="buttonpage02") - { - page buttonpage02 - }else if(back_page.txt=="buttonpage03") - { - page buttonpage03 - }else if(back_page.txt=="buttonpage04") - { - page buttonpage04 - }else - { - page home - } - -Timer wakeup_timer - Attributes - ID : 14 - Scope : local - Period (ms): 100 - Enabled : yes - - Events - Timer Event - if(dim