diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index e57a84d6..c317a860 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -82,6 +82,7 @@ body: placeholder: | # Example YAML configuration # ... + # yamllint disable rule:line-length - type: textarea attributes: label: ESPHome Logs @@ -89,28 +90,15 @@ body: description: > Access these logs via the **Logs** button on the ESPHome Dashboard. These logs are crucial for diagnosing issues with your device. - Please follow the guidelines below to ensure the logs are comprehensive: - **Boot Issues**: If the problem occurs during boot, capture the logs from the start of your device to a minute or two after the boot completes. - - - - Look for errors or unusual messages during this period. - - - **TFT File Update Issues**: For problems related to TFT file updates, - - - - include logs from the moment you press the **Update TFT Display** button until a few seconds after the device restarts. - Pay attention to any error messages or warnings during the update process. - + Look for errors or unusual messages during this period. + - **TFT File Update Issues**: For problems related to TFT file updates, include logs from the moment you press the **Update TFT Display** button + until a few seconds after the device restarts. + Pay attention to any error messages or warnings during the update process. - **Other Issues**: For other types of problems, include logs that encompass the issue's onset and continue for a short duration thereafter. - - - - This will help in pinpointing the exact moment and nature of the issue. - + This will help in pinpointing the exact moment and nature of the issue. Remember, the more detailed the logs, the easier it is to identify and resolve the problem. @@ -121,7 +109,6 @@ body: description: > To access Home Assistant logs, navigate to **Settings** > **System** > [**Logs**](https://my.home-assistant.io/redirect/logs/). - When reporting an issue, please focus on providing logs specifically relevant to the problem: - **NSPanel Blueprint Automation**: If your issue is related to automation using the NSPanel blueprint, include only those logs that directly pertain to this process. @@ -130,7 +117,5 @@ body: - **Relevancy is Key**: To expedite troubleshooting, avoid including logs that are not related to the issue at hand. This helps in focusing on the pertinent information. - Your attention to sharing targeted and relevant log data is greatly appreciated and aids in efficient problem resolution. - ... diff --git a/docs/nspanel_blank.md b/docs/nspanel_blank.md new file mode 100644 index 00000000..9b4ff139 --- /dev/null +++ b/docs/nspanel_blank.md @@ -0,0 +1,59 @@ +# NSPanel Blank - First TFT Installation + +The NSPanel consists of an ESP32 board (the panel itself, controlling the relays, buttons, communications, etc.) +with a Nextion display connected to it. + +This Nextion display has an independent controller which also requires a firmware and its settings (the basic layout), +and this is done by a `.tft` file. + +When you get your panel from Sonoff, their `tft` file is installed in the Nextion display using a so-called "Reparse mode", +which makes it a bit challenging to replace the `tft` file when using ESPHome. +We highly recommend selecting **NSPanel Blank** as your first upload (this is the default for new installations), +as it is just a fraction of the size of a regular `tft` file and will make the first replacement much easier. + +Once the NSPanel's original `tft` is replaced, it is much easier to install a new `tft` with ESPHome, +so you can proceed directly to installing the final file +(e.g., **NSPanel EU**, **NSPanel US**, **NSPanel US Landscape**, or one of the **CJK languages** variants). + +For more details on how to install the first `tft` file, especially if your panel is still displaying the original Sonoff screen, +please refer to the [Troubleshooting TFT transfer](tft_upload.md) guide. + +## How to install a different `tft` file? + +Go to your device's page (under **Settings** > **Devices & services** > **ESPHome**), +select your **Upload TFT display - Model** and then press **Upload TFT display**. + +![Upload TFT display - Model selector](pics/ha_device_configuration_tft_upload_model_selector.png) + +## What to do after installing **NSPanel Blank**? + +![Page Blank](pics/page_blank.png) + +Once you have successfully installed any of the `tft` files from this project, +the **NSPanel Blank** model shouldn't be necessary anymore and you should be able to always install the final `tft` file directly. + +Follow the same steps described above, but now select the correct final regional model +(e.g., **NSPanel EU**, **NSPanel US**, **NSPanel US Landscape**, or one of the **CJK languages** variants) +before pressing **Upload TFT display**. +Double-check this selection to avoid flashing the wrong region. + +## Additional Tips and Resources + +We have a useful guide for [troubleshooting TFT transfer issues](tft_upload.md). +Please take a look there first. + +After troubleshooting, if issues persist, consult the [Issues](https://github.com/edwardtfn/NSPanel-Easy/issues) +and feel free to create a new one asking for more personalized assistance. + +Please share as much info as possible, like: + +1. A description (or picture) of what is on your screen. +2. Whether you are updating from a previous version of this same project, + coming from another NSPanel customization (if so, which one?), + or customizing for the first time a panel with original Sonoff settings. +3. The ESPHome logs from when your panel starts to the moment the upload fails. +4. A description of what you have already tried. + +## Important note + +Remember, these steps are a guideline and might vary slightly based on your specific setup and previously installed system. diff --git a/docs/pics/ha_device_configuration_tft_upload_model_selector.png b/docs/pics/ha_device_configuration_tft_upload_model_selector.png new file mode 100644 index 00000000..b95d03b4 Binary files /dev/null and b/docs/pics/ha_device_configuration_tft_upload_model_selector.png differ diff --git a/docs/pics/page_blank.png b/docs/pics/page_blank.png new file mode 100644 index 00000000..4ec365b6 Binary files /dev/null and b/docs/pics/page_blank.png differ diff --git a/esphome/nspanel_esphome_addon_upload_tft.yaml b/esphome/nspanel_esphome_addon_upload_tft.yaml index bafeb10e..9f639fe7 100644 --- a/esphome/nspanel_esphome_addon_upload_tft.yaml +++ b/esphome/nspanel_esphome_addon_upload_tft.yaml @@ -11,7 +11,7 @@ substitutions: ################## Defaults ################## nextion_update_base_url: "https://raw.githubusercontent.com/edwardtfn/NSPanel-Easy/" - nextion_update_url: "${nextion_update_base_url}/main/hmi/nspanel_eu.tft" + nextion_update_url: "${nextion_update_base_url}/main/hmi/nspanel_blank.tft" upload_tft_automatically: true upload_tft_baud_rate: 115200 upload_tft_wait_ms_after_boot: 300000 # 5min @@ -212,8 +212,10 @@ script: if (idx == 0) { resolved_url = "${nextion_update_url}"; - } else if (idx >= 1 && idx <= 6) { - static const char* const FILENAME_PARTS[] = { "eu", "us", "us_land", "CJK_eu", "CJK_us", "CJK_us_land" }; + } else if (idx >= 1 && idx <= 7) { + static const char* const FILENAME_PARTS[] = { + "blank", "eu", "us", "us_land", "CJK_eu", "CJK_us", "CJK_us_land" + }; resolved_url = std::string("${nextion_update_base_url}") + "v${version}/hmi/nspanel_" + @@ -441,13 +443,14 @@ select: platform: template options: - "Use nextion_update_url" + - "NSPanel Blank" - "NSPanel EU" - "NSPanel US" - "NSPanel US Landscape" - "NSPanel EU (CJK languages)" - "NSPanel US (CJK languages)" - "NSPanel US Landscape (CJK languages)" - initial_option: "NSPanel EU" + initial_option: "NSPanel Blank" optimistic: true restore_value: true internal: false diff --git a/hmi/dev/nspanel_CJK_eu_code/boot.txt b/hmi/dev/nspanel_CJK_eu_code/boot.txt index 7ea5a1fd..1f292247 100644 --- a/hmi/dev/nspanel_CJK_eu_code/boot.txt +++ b/hmi/dev/nspanel_CJK_eu_code/boot.txt @@ -149,7 +149,7 @@ Text log_body Opacity : 127 x coordinate : 222 y coordinate : 68 - Width : 228 + Width : 226 Height : 224 Effect : load Effect Priority : 0 diff --git a/hmi/dev/nspanel_CJK_us_land_code/boot.txt b/hmi/dev/nspanel_CJK_us_land_code/boot.txt index a6902ac5..2f34e6df 100644 --- a/hmi/dev/nspanel_CJK_us_land_code/boot.txt +++ b/hmi/dev/nspanel_CJK_us_land_code/boot.txt @@ -149,7 +149,7 @@ Text log_body Opacity : 127 x coordinate : 222 y coordinate : 68 - Width : 228 + Width : 226 Height : 224 Effect : load Effect Priority : 0 diff --git a/hmi/dev/nspanel_blank/Program.s.txt b/hmi/dev/nspanel_blank/Program.s.txt new file mode 100644 index 00000000..651ab865 --- /dev/null +++ b/hmi/dev/nspanel_blank/Program.s.txt @@ -0,0 +1,10 @@ +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 + int display_mode=4 // 1 = EU, 2 = US, 3 = US landscape, 4 = blank + int charset=1 + dim=100//Configure backlight + recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode + bauds=115200 + printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port + page 0 //Power on start page 0 diff --git a/hmi/dev/nspanel_blank/blank.txt b/hmi/dev/nspanel_blank/blank.txt new file mode 100644 index 00000000..8218e18d --- /dev/null +++ b/hmi/dev/nspanel_blank/blank.txt @@ -0,0 +1,363 @@ +Page blank + Attributes + ID : 0 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + Width : 480 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Locked : no + Swide up page ID : disabled + Swide down page ID : disabled + Swide left page ID : disabled + Swide right page ID: disabled + Fill : picture + Back. Picture ID : 0 + + Events + Preinitialize Event + dim=100 + covx baud,baud_rate.txt,0,0 + baud_rate.txt+=" bps" + tft_version.txt="TFT: v"+version.txt + sendme + + Touch Press Event + dim=100 + tm0.en=1 + + Touch Release Event + dim=100 + tm0.en=1 + +Variable (int32) counter + Attributes + ID : 9 + Scope: local + Value: 0 + +Variable (string) aux1 + Attributes + ID : 10 + Scope : local + Text : + Max. Text Size: 10 + +Variable (string) va0 + Attributes + ID : 11 + Scope : local + Text : + Max. Text Size: 10 + +Variable (string) va1 + Attributes + ID : 12 + Scope : local + Text : + Max. Text Size: 10 + +Variable (string) csv + Attributes + ID : 13 + Scope : local + Text : + Max. Text Size: 255 + +Variable (string) version + Attributes + ID : 14 + Scope : local + Text : 2026020 + Max. Text Size: 7 + +Text nspanel_easy + Attributes + ID : 4 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 15 + y coordinate : 15 + Width : 270 + Height : 48 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 1 + Cropped Back. Picture ID: 0 + Horizontal Alignment : left + Vertical Alignment : center + Input Type : character + Text : NSPanel Easy + Max. Text Size : 12 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + dim=100 + tm0.en=1 + + Touch Release Event + dim=100 + tm0.en=1 + +Text baud_rate + Attributes + ID : 5 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 295 + y coordinate : 15 + Width : 125 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 0 + Cropped Back. Picture ID: 0 + Horizontal Alignment : right + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 20 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + dim=100 + tm0.en=1 + + Touch Release Event + dim=100 + tm0.en=1 + +Text tft_version + Attributes + ID : 6 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 220 + y coordinate : 230 + Width : 200 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 0 + Cropped Back. Picture ID: 0 + Horizontal Alignment : left + Vertical Alignment : center + Input Type : character + Text : TFT version + Max. Text Size : 20 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + dim=100 + tm0.en=1 + + Touch Release Event + dim=100 + tm0.en=1 + +Text sys_framework + Attributes + ID : 7 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 295 + y coordinate : 45 + Width : 125 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 0 + Cropped Back. Picture ID: 0 + Horizontal Alignment : right + Vertical Alignment : center + Input Type : character + Text : + Max. Text Size : 20 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + dim=100 + tm0.en=1 + + Touch Release Event + dim=100 + tm0.en=1 + +Text ver_firmware + Attributes + ID : 8 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Opacity : 127 + x coordinate : 220 + y coordinate : 260 + Width : 200 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 0 + Cropped Back. Picture ID: 0 + Horizontal Alignment : right + Vertical Alignment : center + Input Type : character + Text : ESP: Waiting... + Max. Text Size : 20 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + + Events + Touch Press Event + dim=100 + tm0.en=1 + + Touch Release Event + dim=100 + tm0.en=1 + +Text t0 + Attributes + ID : 15 + Scope : local + Dragging : 0 + Send Component ID : disabled + Opacity : 127 + x coordinate : 15 + y coordinate : 290 + Width : 450 + Height : 30 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Fill : crop image + Associated Keyboard : none + Font ID : 0 + Cropped Back. Picture ID: 0 + Horizontal Alignment : left + Vertical Alignment : center + Input Type : character + Text : http://github.com/edwardtfn/NSPanel-Easy + Max. Text Size : 40 + Word wrap : disabled + Horizontal Spacing : 0 + Vertical Spacing : 0 + +QR Code qr0 + Attributes + ID : 1 + Scope : local + Dragging : 0 + Send Component ID: on press and release + Opacity : 127 + x coordinate : 15 + y coordinate : 160 + Width : 125 + Height : 125 + Effect : load + Effect Priority : 0 + Effect Time : 300 + Logo overlay : no + Text : https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/nspanel_blank.md#what-to-do-after-installing-nspanel_blanktft + Max. Text Size : 150 + + Events + Touch Press Event + dim=100 + tm0.en=1 + + Touch Release Event + dim=100 + tm0.en=1 + +Timer tm0 + Attributes + ID : 2 + Scope : local + Period (ms): 65500 + Enabled : yes + + Events + Timer Event + if(dim>50) + { + dim=50 + }else if(dim>25) + { + dim=25 + }else if(dim>10) + { + dim=10 + }else + { + dim=0 + tm0.en=0 + } + +Timer tm_esphome + Attributes + ID : 3 + Scope : local + Period (ms): 30000 + Enabled : yes + + Events + Timer Event + counter.val++ + if(counter.val>60) + { + rest + } + covx display_mode,va0.txt,0,0 + covx charset,va1.txt,0,0 + csv.txt="blank,params,"+va0.txt+","+va1.txt+","+version.txt + printh 92 + prints "localevent",0 + printh 00 + prints csv.txt,0 + printh 00 + printh FF FF FF + covx counter.val,aux1.txt,0,0 + ver_firmware.txt="ESP: Retry #"+aux1.txt + covx baud,baud_rate.txt,0,0 + baud_rate.txt+=" bps" + sendme + diff --git a/hmi/dev/nspanel_eu_code/boot.txt b/hmi/dev/nspanel_eu_code/boot.txt index 7ea5a1fd..1f292247 100644 --- a/hmi/dev/nspanel_eu_code/boot.txt +++ b/hmi/dev/nspanel_eu_code/boot.txt @@ -149,7 +149,7 @@ Text log_body Opacity : 127 x coordinate : 222 y coordinate : 68 - Width : 228 + Width : 226 Height : 224 Effect : load Effect Priority : 0 diff --git a/hmi/dev/nspanel_us_land_code/boot.txt b/hmi/dev/nspanel_us_land_code/boot.txt index a6902ac5..2f34e6df 100644 --- a/hmi/dev/nspanel_us_land_code/boot.txt +++ b/hmi/dev/nspanel_us_land_code/boot.txt @@ -149,7 +149,7 @@ Text log_body Opacity : 127 x coordinate : 222 y coordinate : 68 - Width : 228 + Width : 226 Height : 224 Effect : load Effect Priority : 0 diff --git a/hmi/dev/ui/fonts/3.zi b/hmi/dev/ui/fonts/3.zi new file mode 100644 index 00000000..09e1c802 Binary files /dev/null and b/hmi/dev/ui/fonts/3.zi differ diff --git a/hmi/nspanel_CJK_eu.HMI b/hmi/nspanel_CJK_eu.HMI index e9dbebf3..d40a42b8 100644 Binary files a/hmi/nspanel_CJK_eu.HMI and b/hmi/nspanel_CJK_eu.HMI differ diff --git a/hmi/nspanel_CJK_eu.tft b/hmi/nspanel_CJK_eu.tft index 9bd15841..fc805597 100644 Binary files a/hmi/nspanel_CJK_eu.tft and b/hmi/nspanel_CJK_eu.tft differ diff --git a/hmi/nspanel_CJK_us_land.HMI b/hmi/nspanel_CJK_us_land.HMI index 515f759c..908dbbf5 100644 Binary files a/hmi/nspanel_CJK_us_land.HMI and b/hmi/nspanel_CJK_us_land.HMI differ diff --git a/hmi/nspanel_CJK_us_land.tft b/hmi/nspanel_CJK_us_land.tft index bc9a4822..6756a0f4 100644 Binary files a/hmi/nspanel_CJK_us_land.tft and b/hmi/nspanel_CJK_us_land.tft differ diff --git a/hmi/nspanel_blank.HMI b/hmi/nspanel_blank.HMI new file mode 100644 index 00000000..a49e0759 Binary files /dev/null and b/hmi/nspanel_blank.HMI differ diff --git a/hmi/nspanel_blank.tft b/hmi/nspanel_blank.tft new file mode 100644 index 00000000..c139b1df Binary files /dev/null and b/hmi/nspanel_blank.tft differ diff --git a/hmi/nspanel_eu.HMI b/hmi/nspanel_eu.HMI index 09e4ac3e..5c652ed2 100644 Binary files a/hmi/nspanel_eu.HMI and b/hmi/nspanel_eu.HMI differ diff --git a/hmi/nspanel_eu.tft b/hmi/nspanel_eu.tft index ae4925ba..4adcfb40 100644 Binary files a/hmi/nspanel_eu.tft and b/hmi/nspanel_eu.tft differ diff --git a/hmi/nspanel_us_land.HMI b/hmi/nspanel_us_land.HMI index 5168398e..fb928f14 100644 Binary files a/hmi/nspanel_us_land.HMI and b/hmi/nspanel_us_land.HMI differ diff --git a/hmi/nspanel_us_land.tft b/hmi/nspanel_us_land.tft index 718891e9..d4fc5851 100644 Binary files a/hmi/nspanel_us_land.tft and b/hmi/nspanel_us_land.tft differ