Sonoff NSPanel Blueprint - Configure your own custom NSPanel easy via a Blueprint

My hero :slight_smile: That was perfect. Just have to go through the device menu>esphome and NOT ESPHome in the sidebar. Then the permission is available. Thanks so much!

1 Like

I think it helped, yes. Thanks a lot mate!

1 Like

Hi,
I tried suggested change top the code, but now when I try to Validate i got following error:

INFO ESPHome 2023.10.1
INFO Reading configuration /config/esphome/nspkitchen.yaml...
ERROR Error while reading config: Invalid YAML syntax:

while parsing a block collection
  in "/config/esphome/nspkitchen.yaml", line 28, column 5:
        - id: !extend wifi_default
        ^
expected <block end>, but found '?'
  in "/config/esphome/nspkitchen.yaml", line 30, column 5:
        fast_connect: true
        ^

My yaml code look like this:

substitutions:
  ###### CHANGE ME START ######
  device_name: "nspkitchen" 
  wifi_ssid: !secret wifi_ssid
  wifi_password: !secret wifi_password
  nextion_update_url: "http://192.168.15.30:8123/local/nspanel_eu.tft"

  ##### addon-configuration #####
  ## addon_climate ##
  # addon_climate_heater_relay: "1" # possible values: 1/2

  ##### CHANGE ME END #####

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
      # - nspanel_esphome_addon_climate_cool.yaml # activate for local climate (cooling) control
      # - nspanel_esphome_addon_climate_heat.yaml # activate for local climate (heater) control
    refresh: 300s

##### My customization - Start #####
wifi:
  networks:
    - id: !extend wifi_default
      hidden: true
    fast_connect: true

##### My customization - End #####

Please try this:

##### My customization - Start #####
wifi:
  networks:
    - id: !extend wifi_default
      hidden: true
  fast_connect: true

##### My customization - End #####

Just a word of advice for anyone struggling to flash the TFT firmware:

Do not - I repeat DO NOT - download the nspanel_xx.tft file with your browser via “Save as…” from the Github repo. Instead, download the entire repo via Github’s green “Code” button and choose “Download ZIP”. Extract the zip file and copy the included nspanel_xx.tft over to your Home Assistant.

Kudos to the community at the Smarthome Yourself discord, where I stumbled over the fix after a week of struggling to get the NSPanel to run.

1 Like

Why not? I always do this no issues at all.
With Firefox on windows.

1 Like

Downloading via “save as…” seems to work for most people. But for some - including me - it doesn’t. It was driving me bonkers for days and if the advice helps people experiencing the same issue, I’m happy.

1 Like

Like others I had trouble updating my panel with the latest TFT. Ipersisted for a few days trying all the suggestions mentioned in thread (except installing the dev branch which I only just saw).

From looking at the logs, I would see a Connection reset by peer error. This seemed to be caused by my WiFi network.

In the end what worked for me was directly connecting to the TFT serial connection and using the Nextion Editor to upload the TFT file. I followed this video and the upload worked first time taking only 2mins (with the baud rate set to 921600).

2 Likes

v4.1 - Call for beta testers: v4.1 - Call for beta testers · Blackymas/NSPanel_HA_Blueprint · Discussion #1251 · GitHub

v4.1 - Easier TFT transfer

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

v4.1 - Easier TFT transfer · Blackymas/NSPanel_HA_Blueprint · Discussion #1255 (github.com)

4 Likes

New 4.1 is great! The new TFT speed at 921600 makes the worst part of updating, waiting a long for tft to upload, now bearable! I mention how I did I upgraded using the new blank_tft in the discussion.

1 Like

4x nspanel.
Update according to the instructions.
1x panel ended in “error” when updating TFT.
After re -invoking the TFT update, everything OK.
Update 3 others was without a problem.
Thank you for your work.

1 Like

sorry to disappoint, I’m trying to install v 4.1 and it has been a struggle,
I finally managed to install the yaml and then upload tft failed over and over,
here is some logging

20:38:30	[D]	[script.upload_tft:091]	

Try #1

20:38:30	[D]	[script.upload_tft:092]	

Setting Nextion protocol reparse mode to passive

20:38:30	[D]	[main:2449]	

Exit reparse

20:38:32	[D]	[nextion_upload:145]	

Nextion TFT upload requested

20:38:32	[D]	[nextion_upload:146]	

url: http://192.168.180.149/nspanel_eu.tft

20:38:32	[D]	[nextion_upload:185]	

Connected

20:38:32	[D]	[nextion_upload:191]	

Requesting URL: http://192.168.180.149/nspanel_eu.tft

20:38:32	[D]	[nextion_upload:225]	

Updating Nextion NX4832F035_011C...

20:38:32	[D]	[nextion_upload:251]	

Waiting for upgrade response

20:38:32	[D]	[nextion_upload:257]	

Upgrade response is [05] - 1 bytes

20:38:32	[D]	[nextion_upload:260]	

Available 0 : 0x05

20:38:32	[D]	[nextion_upload:264]	

preparation for tft update done

20:38:32	[D]	[nextion_upload:264]	

preparation for tft update done

20:38:32	[D]	[nextion_upload:292]	

Allocating buffer size 65536, Heap size is 135348

20:38:32	[D]	[nextion_upload:309]	

Updating tft from "http://192.168.180.149/nspanel_eu.tft" with a file size of 7248068 using 65536 chunksize, Heap Size 67012

20:38:33	[D]	[nextion_upload:113]	

Uploaded 0.06 %, remaining 7243972 bytes

20:38:38	[D]	[nextion_upload:123]	

recv_string [08.00.00.00.00 (5)]

20:38:38	[D]	[nextion_upload:113]	

Uploaded 0.11 %, remaining 7239876 bytes

20:38:38	[D]	[nextion_upload:113]	

Uploaded 0.17 %, remaining 7235780 bytes

20:38:39	[D]	[nextion_upload:113]	

Uploaded 0.23 %, remaining 7231684 bytes

20:38:39	[D]	[nextion_upload:320]	

Heap Size 46992, Bytes left 7231684

20:38:39	[D]	[nextion_upload:049]	

Requesting range: bytes=16384-81919

20:38:39	[D]	[nextion_upload:049]	

Requesting range: bytes=16384-81919

in one scenario I was able to upload almost 5%. but not more.

now I’m trying to revert to the old tft upload process, hope that works.

This is interesting. I wouldn’t expect buffer bigger than 32768 bytes in this case. I will have to investigate.
Anyways, thanks for sharing even the bad experience… Those are the ones which will push us forward. :wink:

Some things I would suggest:

  1. Try the new nspanel_blank.tft. That is way smaller and will enable the 921600bps transfer for the big file, which is 3 times faster. (But requires additional configuration)
  2. Change your framework to esp-idf temporarily for this transfer. That framework have a better memory management (which is probably the issue in your case).

Could you please share the ESPHome yaml used for this? I wanna duplicate this case here.
Please remove any sensitive info before sharing.

Here you find how to switch to esp-idf: (EN) Customization · Blackymas/NSPanel_HA_Blueprint Wiki · GitHub

Although it suggests to flash via serial, it’s probably fine if you flash it wirelessly, transfer the file, then remove those lines and flash it back (with the default Arduino framework).

thnx,
using the old upload I was able to upload the _blank file, but still probaly I messed something up because I still couldn’t uploade the _eu file.

then I tried the new upload and _blank got stuck at 46%

my config is a bit of a mess,

but the main file is this:

substitutions:
  device_name: "lamp-kamer-voor" 
  nextion_update_url: "http://192.168.180.149/nspanel_eu.tft"

packages:
  base: !include .base.yaml
  device: !include .nspanel.yaml
  remote_package:
    url: https://github.com/Blackymas/NSPanel_HA_Blueprint
    ref: main
    files:
      - nspanel_esphome_addon_upload_tft.yaml # Core package
    refresh: 300s

external_components:
    - source: github://cossid/tasmotadevicegroupsforesphome@main
      components: [ device_groups ]
      refresh: 10 min

device_groups:
  - group_name: "bulbkamerachter"     # Tasmota device group name
    switches:
      - relay_1
  - group_name: "bulbkamervoor"     # Tasmota device group name
    switches:
      - relay_2

switch:
  ##### PHYSICAL SWITCH 1 #####
  - name: ${device_name} Relay 1
    platform: template
    id: relay_1
    restore_mode: RESTORE_DEFAULT_OFF
    optimistic: true
    on_turn_on:
      then:
         - lambda: |-
            id(detailed_entity).publish_state("light.bulb_kamer_achter_bulb_kamer_achter");
            id(disp1).goto_page("light");
            id(disp1).set_component_text_printf("page_label", "Kamer achter");
            id(disp1).set_component_text_printf("back_page", "home");
            id(disp1).set_component_text_printf("icon_state", "\uF060"); // mdi:lightbulb - https://htmlpreview.github.io/?https://github.com/jobr99/Generate-HASP-Fonts/blob/e1428f346777be69440f6bb00f1698815cb525d4/cheatsheet.html
        # - script.execute:
        #     id: refresh_relays
    on_turn_off:
      then:
        - script.execute:
            id: refresh_relays
  ##### PHYSICAL SWITCH 2 ######
  - name: ${device_name} Relay 2
    platform: template
    id: relay_2
    optimistic: true
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on:
      then:
         - lambda: |-
            id(detailed_entity).publish_state("light.bulb_kamer_voor_bulb_kamer_voor");
            id(disp1).goto_page("light");
            id(disp1).set_component_text_printf("page_label", "Kamer voor");
            id(disp1).set_component_text_printf("back_page", "home");
            id(disp1).set_component_text_printf("icon_state", "\uE502"); // mdi:lightbulb - https://htmlpreview.github.io/?https://github.com/jobr99/Generate-HASP-Fonts/blob/e1428f346777be69440f6bb00f1698815cb525d4/cheatsheet.html
        # - script.execute:
        #     id: refresh_relays
    on_turn_off:
      then:
        - script.execute:
            id: refresh_relays
  ##### Real Buttons######  
  - name: ${device_name} Real Left
    platform: gpio
    pin:
      number: 22
    restore_mode: ALWAYS_OFF
  - name: ${device_name} Real Right
    platform: gpio
    pin:
      number: 19
    restore_mode: ALWAYS_ON

then .base.yaml

wifi:
  id: wifiId
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # power_save_mode: NONE
  # power_save_mode: HIGH
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${device_name}"
    password: !secret wifi_password

captive_portal:

# Enable logging
logger:
  
api:
  encryption:
    key: !secret api_encryption_key
  reboot_timeout: 0s

ota:
  safe_mode: true
  reboot_timeout: 3min
  num_attempts: 3
  password: !secret ota_password
  # on_error:
  #   then:
  #     - logger.log:
  #         format: "OTA update error %d"
  #         args: ["x"]

web_server:
  port: 80
  js_url: https://mydomain.duckdns.org:8123/local/esphome/v2/www.js
  auth:
    username: admin
    password: !secret web_server_password

button:
  - platform: restart
    name: "${device_name} switch Restart"
    icon: "mdi:restart"

in .nspanel.yaml I copied, core
removed wifi, ota and relay_1 and relay_2
(I’m not allowed to post the full body as this makes the message to big)

I will try esp-idf now,
i know the advantages, but the other component I’m using does not support it

I note in breaking changes “Play rtttl (esphome.xxxxx_play_rtttl)” is deprecated.
While it can be added back for now with the advanced YAML, is there an intention going forward to not support using the piezo speaker in the NSPanel, or is this just a memory saving option for a possibly little used feature?

small update form my side,
using esp-idf
_blank went fine
_eu first attempt ended at 69.94%
then I updated bautrate to 921600
but that didn’t work at all,
reverted to 115200
tried again and secceeded,

now still 2 panels to go

edit: so either disabling the external component or esp-idf fixed the issue

This is just a memory saving with something we believe just a few people is using. I use the buzzer myself and have no plans to drop the support for that.

2 Likes

Every time you change the speed it takes about a minute for ESPHome to identify the proper baud rate to communicate with Nextion. In fact ESPHome is trying to communicate all the time with the new baud rate, while Nextion switches it’s baud rate every 30s (I think) until the communication is established.
So, give it some time and it should work.

By any chance you have the logs related to that try? I’d love to see what caused the issue.