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

I received the Sonoff iFan04-L that i want to control with the NSPanel using the 2 hardware buttons. I used the Sonoff HACS integration to add the fan control to HA with zero issues. The button for the light was easy, with just an on/off command to the device.

The fan, though, took a little more work. I didn’t want just an on/off with it, i wanted the speed control, as well.

So, i wrote a script that uses a counter with 4 steps, 0-3. Each press of the button increases the counter, which in turn sends a percentage to the fan, while changing a text sensor on the pan to display the speed (off, low, med & high). If the fan is in high speed and the button is pressed it resets to 0, which turns the fan off.

I just noticed that the small indicator bar on the panel screen above the fan button doesn’t light up, but thats not a big deal.

I also wrote a script that will trigger a scene script (all lights on) with a long-press of the hardware buttons, then reset it with a 2nd long-press

Maybe it is a bug, maybe I do something wrong, but since the update to 4.1 the color of my custom button for Spotify does not update on the homescreen of the display. If I enter the submenu, and return to the homescreen, the color is updated…
(Custom button 1 on my " Homepage Custom Buttons" is assigned to Spotify, and the icon is the Spotify icon.)

In addition to my previous post regarding the Spotify icon that is not update, the weather icon (clouds/rain etc) is also not (always) updated…… To update I need to select the weather button and return to the homescreen.

After many different attempts / following different guides to solve my issue with uploading the tft, I hope the community can help me out.

I have a black nspanel and I’m stuck trying to upload the tft file. I’ve placed the tft file on a local webserver as my home assistant instance is force to use https.

Flashing the device is no problem. After pushing the “upload_tft” button it confirms the tft can be found but than the nspanel reboots and I see the below errors in the log.

Any ideas what to try next?
Thanks

[17:20:56][D][script.upload_tft:091]: Try #1
[17:20:56][D][script.upload_tft:092]: Setting Nextion protocol reparse mode to passive
[17:20:56][D][main:2485]: Exit reparse
[17:20:58][D][nextion_upload:145]: Nextion TFT upload requested
[17:20:58][D][nextion_upload:146]: url: http://192.168.1.3/test/nspanel_blank.tft
[17:20:58][D][nextion_upload:185]: Connected
[17:20:58][D][nextion_upload:191]: Requesting URL: http://192.168.1.3/test/nspanel_blank.tft
WARNING nspanel: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for nspanel
WARNING Disconnected from API
INFO Successfully connected to nspanel in 0.005s
INFO Successful handshake with nspanel in 0.045s
[17:21:31][D][api:102]: Accepted 192.168.20.3
[17:21:31][D][api.connection:1089]: Home Assistant 2023.11.2 (192.168.20.3): Connected successfully
[17:21:31][D][time:045]: Synchronized time: 2023-11-21 17:21:31
[17:21:31][D][main:068]: System clock synchronized
[17:21:50][D][main:2485]: Exit reparse
[17:21:54][D][sensor:094]: ‘ntc_source’: Sending state 1.77100 V with 2 decimals of accuracy
[17:21:54][D][resistance:039]: ‘resistance_sensor’ - Resistance 12972.7Ω
[17:21:54][D][sensor:094]: ‘resistance_sensor’: Sending state 12972.66309 Ω with 1 decimals of accuracy
[17:21:54][D][ntc:026]: ‘nspanel Temperature’ - Temperature: 19.3°C
[17:21:54][D][sensor:094]: ‘nspanel Temperature’: Sending state 19.25579 °C with 1 decimals of accuracy
[17:22:10][E][on_boot:040]: No response from Nextion display
[17:22:10][D][on_boot:041]: Turn off Nextion
[17:22:10][D][switch:016]: ‘nspanel Screen Power’ Turning OFF.
[17:22:10][D][switch:055]: ‘nspanel Screen Power’: Sending state OFF
[17:22:12][D][on_boot:044]: Turn on Nextion
[17:22:12][D][switch:012]: ‘nspanel Screen Power’ Turning ON.
[17:22:12][D][switch:055]: ‘nspanel Screen Power’: Sending state ON
[17:22:12][W][component:214]: Component esphome.coroutine took a long time for an operation (1.53 s).
[17:22:12][W][component:215]: Components should block for at most 20-30ms.
[17:22:12][W][nextion:719]: Received unknown event from nextion: 0x55
[17:22:12][D][nextion:563]: system successful start up 0
[17:22:12][W][nextion:331]: Nextion reported invalid instruction!
[17:22:12][E][nextion:274]: Nextion queue is empty!
[17:22:12][D][nextion:563]: system successful start up 0
[17:22:32][E][on_boot:054]: No response from Nextion display
[17:22:32][D][on_boot:056]: Finished

Did you already cleaned the Build files and re-validated and re-installed the software?

Updated ESPHome on my devices today and it killed my panel. Just an empty homescreen now but I get a warning at least. Will this need new a new blueprint?

NSPanel invalid Blueprint version

ESPHome cannot provide a valid Blueprint version.

  • Panel: nspanelbathroom
  • TFT: 4.0.2
  • ESPHome: 4.1.1
  • Blueprint (reported by ESPHome):
  • Blueprint (expected): 4.0.2

4 hours ago

Didn’t try that before. Unfortunately no change, still same behaviour.

Solved my issue with uploading the tft file, offcourse it was something in my own configuration. In this case I had the webserver, where I pulled of the tft files, in a different subnet. Placing the webserver in the same subnet as the nspanel made it all work as designed :slight_smile:

1 Like

Could you please add this as an issue in GitHub?

Looks like your ESP is crashing.
Could you please try adding this to your ESPHome yaml, install it (wirelessly is OK) and try the TFT upload again?

esp32:
  framework:
    type: esp-idf

You shall update your TFT and Blueprint.

Please take a look at this: NSPanel_HA_Blueprint/docs/howto.md at main · Blackymas/NSPanel_HA_Blueprint · GitHub

1 Like

I thought so. Thats perfect! I dont have to lose my settings then. Thanks!

1 Like

Worked like a champ. Thanks Bud. Had to manually copy the tft file over (I’m using the US one) in to the www folder then it updated no issues. Back in business.

1 Like

I finally had the time to install both the NSPanel and the iFan04-L today. I had already configured the panel and fan controller, so the job was just a matter of mounting and wiring changes.

I set the panel buttons to operate the light & fan, with a script to cycle the fan speeds (off, low, med & high). I also wrote a “so-far” script that will trigger an alarm if either physical buttons are long-pressed. Right now, the only thing the alarm does is turn on a single light because im waiting for the parts to install more.

The ONLY issue is the climate page. I use a dual-temp thermostat. When it’s swt to heat_cool, the climate page doesn’t allow you to adjust the set temperatures. Im looking at adding a script that will automatically select the proper heating or cooling mode based on the temperature. Once this is running, I’ll only need to adjust a single temperature.

BTW, even my wife loves the new additions.
SCORE!!!

1 Like

I added this automation to switch between heat & cool modes based on the temperature setting & current room temperature. The way it’s coded, the climate control will switch to cool if the current temperature is 2⁰ above the set temperature and to heat if it’s 2⁰ below.

Now the climate page works perfect even with automatic heat & cool.

alias: BR Climate Auto Mode
description: 
trigger:
  - platform: template
    value_template: >
      {% set mode = states('climate.br_climate') %}
      {% set trg = state_attr('climate.br_climate', 'temperature')|float %}
      {% set cur = states('sensor.br_th_temperature')|float %}
      {{ mode == 'heat' and trg <= cur - 2 or mode == 'cool' and trg >= cur + 2 }}
action:
  - service: climate.set_hvac_mode
    entity_id: climate.br_climate
    data_template:
      hvac_mode: >
        {% set mode = states('climate.br_climate') %}
        {{ 'heat' if mode == 'cool' else 'cool' }}
mode: single

2 Likes

I got the same issue even upload blank.tft made nspanel reboot.
To solve the issue in my case, I need to move the nspanel in an other less restricted vlan (at least not my No Internet vlan). Maybe a DNS issue, no network access. Etc.

1 Like

HI,

From the nspanel I’m trying to display the state of some equipements.

First I use the configuration panel to add a metric for my equipement like this

      - name: "isRunningCumulus"
        state: >
          {% if is_state('sensor.cumulus_power', '0') %}
            false
          {% else %}
            true
          {% endif %}
        availability: "{{ is_number(states('sensor.cumulus_power')) }}"

And from the nspanel automation I bind this value to the chips section.
I realized the value is not in real time but was update after 1 or 2 minutes.
I guess I have forget to use a fire event or something like this…

Second case I m trying to use the chip to change a color depending on the value of the state.
ie a power become grey is connected or red if it s cut or power off.
I m trying to implement an automation script for this, but I don’t know how to create the script properly of find the correct property.

Thanks by advance

You mean your template sensor takes this time to update it’s value or are you saying the template sensor updates it instantaneously, but it takes this time for the panel be updated?

Yes the time to be updated from the nspanel. may be possible to force the refresh ?

My problem with your way is it’s too slow, it comes from the way you do it or it’s completely natural with this display?