From 801fc8398636939d4bf5face14127d498b0d0725 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Wed, 27 Dec 2023 18:18:37 +0100 Subject: [PATCH] Removed `lovelace_custom_command` It was not in use --- .../nspanel_esphome_addon_climate_base.yaml | 2 +- .../nspanel_esphome_addon_upload_tft.yaml | 28 ------------- advanced/esphome/nspanel_esphome_core.yaml | 39 ------------------- 3 files changed, 1 insertion(+), 68 deletions(-) diff --git a/advanced/esphome/nspanel_esphome_addon_climate_base.yaml b/advanced/esphome/nspanel_esphome_addon_climate_base.yaml index 64a4ec1..f82f626 100644 --- a/advanced/esphome/nspanel_esphome_addon_climate_base.yaml +++ b/advanced/esphome/nspanel_esphome_addon_climate_base.yaml @@ -205,4 +205,4 @@ script: (addon_climate_heat && addon_climate_dual) || (!addon_climate_cool && !addon_climate_heat && !addon_climate_dual)) { ESP_LOGE(TAG, "Invalid settings for add-on Climate"); - } \ No newline at end of file + } diff --git a/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml b/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml index 4b60c2f..cc0d6b1 100644 --- a/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml +++ b/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml @@ -885,10 +885,6 @@ script: disp1->hide_component("bt_close"); delay_seconds_(1); display_wrapped_text->execute("confirm.body", "Stopping scripts...", 18); - } else { - lovelace_custom_command->execute("pageType~popupNotify"); - sprintf(update_msg, "entityUpdateDetail~~Upload TFT - %s~65535~~0~~0~Preparing to upload TFT file...~65535~10000~3~~~", framework.c_str()); - lovelace_custom_command->execute(update_msg); } stop_all->execute(); if (display_mode->state > 0) delay_seconds_(1); @@ -907,10 +903,6 @@ script: ESP_LOGD(TAG, update_msg); if (display_mode->state > 0) { display_wrapped_text->execute("confirm.body", update_msg, 18); - } else { - lovelace_custom_command->execute("pageType~popupNotify"); - sprintf(update_msg, "entityUpdateDetail~~Upload TFT - %s~65535~~0~~0~Try #1 at %d bps~65535~10000~3~~~", framework.c_str(), target_upload_baud_rate_); - lovelace_custom_command->execute(update_msg); } delay_seconds_(1); if (upload_tft_(url, target_upload_baud_rate_)) App.safe_reboot(); @@ -922,10 +914,6 @@ script: ESP_LOGD(TAG, update_msg); if (display_mode->state > 0) { display_wrapped_text->execute("confirm.body", update_msg, 18); - } else { - lovelace_custom_command->execute("pageType~popupNotify"); - sprintf(update_msg, "entityUpdateDetail~~Upload TFT - %s~65535~~0~~0~Try #2 at %d bps~65535~10000~3~~~", framework.c_str(), target_upload_baud_rate_); - lovelace_custom_command->execute(update_msg); } delay_seconds_(1); if (upload_tft_(url, target_upload_baud_rate_)) App.safe_reboot(); @@ -937,20 +925,12 @@ script: ESP_LOGD(TAG, update_msg); if (display_mode->state > 0) { display_wrapped_text->execute("confirm.body", update_msg, 18); - } else { - lovelace_custom_command->execute("pageType~popupNotify"); - sprintf(update_msg, "entityUpdateDetail~~Upload TFT - %s~65535~~0~~0~Try #3 at %d bps~65535~10000~3~~~", framework.c_str(), original_baud_rate_); - lovelace_custom_command->execute(update_msg); } delay_seconds_(1); if (upload_tft_(url, original_baud_rate_)) App.safe_reboot(); ESP_LOGW(TAG, "Try #3 failed"); if (display_mode->state > 0) { display_wrapped_text->execute("confirm.body", "Try #3 failed. Restarting display.", 18); - } else { - lovelace_custom_command->execute("pageType~popupNotify"); - sprintf(update_msg, "entityUpdateDetail~~Upload TFT - %s~65535~~0~~0~Power cycle display~65535~10000~3~~~", framework.c_str()); - lovelace_custom_command->execute(update_msg); } delay_seconds_(3); ESP_LOGD(TAG, "Turn off Nextion"); @@ -978,10 +958,6 @@ script: disp1->hide_component("bt_accept"); disp1->hide_component("bt_clear"); disp1->hide_component("bt_close"); - } else { - lovelace_custom_command->execute("pageType~popupNotify"); - sprintf(update_msg, "entityUpdateDetail~~Upload TFT - %s~65535~~0~~0~Try #4 at %d bps~65535~10000~3~~~", framework.c_str(), original_baud_rate_); - lovelace_custom_command->execute(update_msg); } delay_seconds_(1); if (upload_tft_(url, original_baud_rate_)) App.safe_reboot(); @@ -1003,10 +979,6 @@ script: disp1->hide_component("bt_accept"); disp1->hide_component("bt_clear"); disp1->hide_component("bt_close"); - } else { - lovelace_custom_command->execute("pageType~popupNotify"); - sprintf(update_msg, "entityUpdateDetail~~Upload TFT - %s~65535~~0~~0~TFT upload failed.~65535~10000~3~~~", framework.c_str()); - lovelace_custom_command->execute(update_msg); } delay_seconds_(1); if (upload_tft_(url, 115200)) App.safe_reboot(); diff --git a/advanced/esphome/nspanel_esphome_core.yaml b/advanced/esphome/nspanel_esphome_core.yaml index f3b5630..96e1c29 100644 --- a/advanced/esphome/nspanel_esphome_core.yaml +++ b/advanced/esphome/nspanel_esphome_core.yaml @@ -38,8 +38,6 @@ esphome: timeout: 10s - lambda: |- if (!disp1->is_setup()) { - lovelace_custom_command->execute("pageType~popupNotify"); - lovelace_custom_command->execute("entityUpdateDetail~~Unsupported TFT file~65535~~0~~0~Please upload a\r\ncompatible TFT file.~65535~10000~3~~~"); exit_reparse->execute(); } - wait_until: @@ -80,8 +78,6 @@ esphome: static const char *const TAG = "on_boot"; nextion_status->execute(); if (not disp1->is_setup()) { - lovelace_custom_command->execute("pageType~popupNotify"); - lovelace_custom_command->execute("entityUpdateDetail~~Unsupported TFT file~65535~~0~~0~Please upload a\r\ncompatible TFT file.~65535~10000~3~~~"); ESP_LOGE(TAG, "No response from Nextion display"); } ESP_LOGD(TAG, "Finished"); @@ -1879,40 +1875,6 @@ script: } ESP_LOGV(TAG, "Finished"); - - id: lovelace_custom_command - mode: queued - parameters: - command: string - then: - #- lambda: |- - # static const char *const TAG = "script.lovelace_custom_command"; - # ESP_LOGV(TAG, "Sending command: %s", command.c_str()); - - # auto crc16 = [](const uint8_t *data, uint16_t len) -> uint16_t { - # uint16_t crc = 0xFFFF; - # while (len--) { - # crc ^= *data++; - # for (uint8_t i = 0; i < 8; i++) { - # if ((crc & 0x01) != 0) { - # crc >>= 1; - # crc ^= 0xA001; - # } else { - # crc >>= 1; - # } - # } - # } - # return crc; - # }; - - # std::vector data = {0x55, 0xBB}; - # data.push_back(command.length() & 0xFF); - # data.push_back((command.length() >> 8) & 0xFF); - # data.insert(data.end(), command.begin(), command.end()); - # auto crc = crc16(data.data(), data.size()); - # data.push_back(crc & 0xFF); - # data.push_back((crc >> 8) & 0xFF); - # tf_uart->write_array(data.data(), data.size()); - - id: nextion_status mode: restart then: @@ -2636,7 +2598,6 @@ script: global_settings->stop(); ha_button->stop(); ha_call_service->stop(); - lovelace_custom_command->stop(); nextion_status->stop(); notification_clear->stop(); open_entity_settings_page->stop();