Sonoff NSPanel by ITead - Smart Scene Wall Switch based on ESP32 and custom Nextion Touch Screen Panel Display (non-Pro variant)

quite impossible with the default theme

It’s not video screen in it, Itead display uses some layouts for fixed design and you can’t integrate video play into it :frowning:

1 Like

This maybe a silly question, and I’msorry if it is.

Isn’t this just a Nextion display in there? Is there no way you can use the Nextion editor to create custom screen and then access those? Obviously way outside the scope of Tasmota, but if Tasmota can give you the frame work to intetact with the panel and you may be able to change the screens it opens up way more scope to play with it.

It should be possible. In esphome there is even a method to flash a new firmware on a nextion display. The problem at the moment is, that esphome will not connect to nextion displays that are in reparse mode.

I have not got my hands on a NSPanel yet, but I definitely plan to customize the display firmware and use it with esphome as soon as it arrives.

I will update here when I get it working.

Itead = Nextion :wink: You are supposed to be able to use Nextion Editor to design your layout and then upload in screen (is possible with Tasmosta, not yet possible as far as I know with ESPhome) and then ESPHome interacts with panel to refresh display, switch pages, etc… Have to play a little with NSPanel I have in hand to confirm you !

1 Like

FYI @jesserockz (who funded ESPHome) got his hands on a Sonoff NSPlanel and is posting process:

https://twitter.com/Jesserockz/status/1457415401743126530

Jesse also submitted a draft for initial experimental ESPHome support to control ITead’s default UI:

https://github.com/esphome/esphome/pull/2702

Awesome stuff! Will be keeping an eye on his progress on both Twitter and that PR for sure!

1 Like

Hi,

This Sonoff NS Panel seems awesome, although there seems to be some issues, especially with the feeling/feedback and size of the buttons.
I would have done it differently even though I understand that Sonoff wanted it to be squared 86x86mm (EU version) as regular switches.
I would have made those modifications like on this picture I have modified on paint :grinning:

A. I would have chosen bigger buttons (40x32mm at least) and without borders, only to make them more easily accessible. The original buttons look like buttons of a laptop’s touch pad, they are too tiny.
Quality switches with real feedback would be nice.

B. I would have used a cheap LED to indicate the state of the relay instead of using precious surface on the screen. The behavior of the LEDs should be adjustable over software of course.

And as said in some reviews, a distance or even a gesture sensor would be nice too.
I hope there will be an improved version in a year from Sonoff.

I would have made a 3D print of N°3 and used the screen and electronics of the original NS Panel, but I can’t spend money right now.

1 Like

Who got one and installed ESPhome? I mean this code: Create initial NSPanel component by jesserockz · Pull Request #2702 · esphome/esphome · GitHub

Not tested yet here as it implies to move on ESPHome beta (which in the past made some mess with my other sketches :wink:

No beta anymore! Just use external_components: as described in the PR (see the example code provided). It will download the code and compile the firmware.

1 Like

Just received my NSPanel and flashed it with the custom firmware from @blakadder - super simple process! - but now I’m at a loss how to update the buttons and sensors on it :face_with_hand_over_mouth: - is there a simple guide somewhere that I can use? - I was looking through Blakadder’s Github, but I really don’t know where to start!

Cheers
Leacho

Doesn’t it create automatically some sensors/variables in HA when you link it ?

Thanks @vincen - I’m thinking more about the initial configuration - including setting the button actions etc.

Should be the same :wink: you should get some switch circuits created for that in HA once linked with it, same for the two relays, temperature sensor… After all config has to be done in HA for automations/actions/management of display !

Ah ok, I’ll take a look now - hopefully once I’ve added it in, it will make more sense :slight_smile: :slight_smile:

out of curiosity, are you a backer of kickstarter or did you receive in another way? I cannot wait to get my hands on this beauty :wink:

Just ordered it straight from Sonoff :slight_smile: - delivered last week.

1 Like

So I’ve got it added into Home Assistant - but I can’t see any way to update the screens from Home Assistant itself - I can see from Blakadder’s pages that you can fire commands at it - but they look like JSON rather than MQTT

Leacho. ill share my setup, and a few automations that control my lights.

This is my config.yaml. i use this for various automations and also receiving the raw JSON on raw.

  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_RAW'
    name: 'NSPanel Raw Data'

  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_LivingRoom'
    name: 'NSPanel Living Room'
    value_template: "{{ value_json.NSPanel.params }}"
    json_attributes_topic: "tele/LoungeRoomSwitch/RESULT"
    json_attributes_template: "{{ value_json.NSPanel.params | tojson }}"
    

  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_ID'
    name: 'NS Panel ID'
    value_template: '{{ value_json.NSPanel.id }}'

  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_Switch'
    name: 'NS Panel Switch'
    value_template: '{{ value_json.NSPanel.params.switch }}'  


  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_Ltype'
    name: 'NS Panel Light Type'
    value_template: '{{ value_json.NSPanel.params.ltype }}'
    
  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_Ledtype'
    name: 'NS Panel LED Type'
    value_template: '{{ value_json.NSPanel.params.light_type }}'
    
  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_LED_Red'
    name: 'NS Panel LED Red'
    value_template: '{{ value_json.NSPanel.params.colorR }}'  
    
  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_LED_Green'
    name: 'NS Panel LED Green'
    value_template: '{{ value_json.NSPanel.params.colorG }}'  
    
  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_LED_Blue'
    name: 'NS Panel LED Blue'
    value_template: '{{ value_json.NSPanel.params.colorB }}'   

  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_LED_BR'
    name: 'NS Panel LED Brightness'
    value_template: '{{ value_json.NSPanel.params.bright }}'      

  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_BR'
    name: 'NS Panel White Brightness'
    value_template: '{{ value_json.NSPanel.params.white.br }}'  
    
  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_CT'
    name: 'NS Panel Colour Temp'
    value_template: '{{ value_json.NSPanel.params.white.ct }}'  
    
  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_Red'
    name: 'NS Panel Red'
    value_template: '{{ value_json.NSPanel.params.color.r }}'  
    
  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_Green'
    name: 'NS Panel Green'
    value_template: '{{ value_json.NSPanel.params.color.g }}'  
    
  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_Blue'
    name: 'NS Panel Blue'
    value_template: '{{ value_json.NSPanel.params.color.b }}'      
    
  - platform: mqtt
    state_topic: 'tele/LoungeRoomSwitch/RESULT'
    unique_id: 'NSPPanel_CBR'
    name: 'NS Panel Colour Brightness'
    value_template: '{{ value_json.NSPanel.params.color.br }}'   

When you press a switch on the screen, you need Home assistant to reply with a JSON reply telling the NS PANEL to update the widget on the screen with the change, otherwise every second, tasmota updates the NSPanel with its weather and time, the widget resets.
So you need to respond using the following automation.

alias: nspanel send data back
description: ''
trigger:
  - platform: state
    entity_id: sensor.ns_panel_raw_data
condition: []
action:
  - service: mqtt.publish
    data_template:
      topic: cmnd/LoungeRoomSwitch/NSPSend
      payload: |

        {{'{{"relation":{}}}'.format(trigger.to_state.state)}}
mode: single

I use the following automation that runs when the RAW item is updated, and it grabs information from each of my other items.

I use this automation to update a CCT lightbulb

alias: NSPanel CCT Light ON
description: ''
trigger:
  - platform: state
    entity_id: sensor.ns_panel_raw_data
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: |
        {% if states.sensor.ns_panel_id.state == "1" %}
          light.tall_lamp
        {% elif  states.sensor.ns_panel_id.state == "2" %}
          light.small_lamp
        {% elif  states.sensor.ns_panel_id.state == "5" %}
          light.christmas_lights
        {% endif %}
    data_template:
      brightness_pct: |
        {% if states.sensor.ns_panel_light_type.state == "white" %}
          {% if states.sensor.ns_panel_brightness.state | int >= 0 %}
            {{ states.sensor.ns_panel_brightness.state | int }}
          {% else %}
            100
          {% endif %}
        {% elif  states.sensor.ns_panel_light_type.state == "color" %}
          {% if states.sensor.ns_panel_colour_brightness.state | int >= 0 %}
            {{ states.sensor.ns_panel_colour_brightness.state | int }}
          {% else %}
            100
          {% endif %}
        {% else %}
          100
        {% endif %}
      rgb_color:
        - '{{ states.sensor.ns_panel_red.state | int }}'
        - '{{ states.sensor.ns_panel_green.state | int }}'
        - '{{ states.sensor.ns_panel_blue.state | int }}'
mode: single

This one to update an LED strip

alias: NSPanel LED Light ON
description: ''
trigger:
  - platform: state
    entity_id: sensor.ns_panel_raw_data
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: |
        {% if states.sensor.ns_panel_id.state == "3" %}
          light.tasmota
        {% endif %}
    data_template:
      brightness_pct: |

        {% if states.sensor.ns_panel_led_brightness.state | int >= 0 %}
          {{ states.sensor.ns_panel_led_brightness.state | int }}
        {% else %}
          100
        {% endif %}
      rgb_color:
        - '{{ states.sensor.ns_panel_led_red.state | int }}'
        - '{{ states.sensor.ns_panel_led_green.state | int }}'
        - '{{ states.sensor.ns_panel_led_blue.state | int }}'
mode: single

This one to turn any of my lights off

alias: nspanel Light OFF
description: ''
trigger:
  - platform: state
    entity_id: sensor.ns_panel_raw_data
condition:
  - condition: state
    entity_id: sensor.ns_panel_switch
    state: 'off'
action:
  - service: light.turn_OFF
    target:
      entity_id: |
        {% if states.sensor.ns_panel_id.state == "1" %}
          light.tall_lamp
        {% elif  states.sensor.ns_panel_id.state == "2" %}
          light.small_lamp
        {% elif  states.sensor.ns_panel_id.state == "3" %}
          light.tasmota
        {% elif  states.sensor.ns_panel_id.state == "5" %}
          light.christmas_lights
        {% endif %}
mode: single

and this one to update the switch position on my widgets if i turn a bulb or the LED strip on any other way other than through the panel

alias: NSPanel Update Widget State when device changes
description: ''
trigger:
  - platform: device
    type: turned_on
    device_id: 8d2bd172ff304d1d97502e1ffc9edaee
    entity_id: light.tall_lamp
    domain: light
    id: tall on
  - platform: device
    type: turned_on
    device_id: ec57922dd96ed593581f9c5c978ba5ad
    entity_id: light.small_lamp
    domain: light
    id: small on
  - platform: device
    type: turned_on
    device_id: 63b3caa3d98370f6874b31e82a1cfa4b
    entity_id: light.tasmota
    domain: light
    id: led on
  - platform: device
    type: turned_off
    device_id: 8d2bd172ff304d1d97502e1ffc9edaee
    entity_id: light.tall_lamp
    domain: light
    id: tall off
  - platform: device
    type: turned_off
    device_id: ec57922dd96ed593581f9c5c978ba5ad
    entity_id: light.small_lamp
    domain: light
    id: small off
  - platform: device
    type: turned_off
    device_id: 63b3caa3d98370f6874b31e82a1cfa4b
    entity_id: light.tasmota
    domain: light
    id: led off
  - platform: state
    entity_id: light.christmas_lights
    id: xmasON
    to: 'on'
  - platform: state
    entity_id: light.christmas_lights
    id: xmasOFF
    to: 'off'
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: tall on
        sequence:
          - service: mqtt.publish
            data:
              topic: cmnd/LoungeRoomSwitch/NSPSend
              payload: >-
                {"relation":{"NSPanel":{"ctype":"group","id":"1","params":{"switch":"on"}}}}
      - conditions:
          - condition: trigger
            id: small on
        sequence:
          - service: mqtt.publish
            data:
              topic: cmnd/LoungeRoomSwitch/NSPSend
              payload: >-
                {"relation":{"NSPanel":{"ctype":"group","id":"2","params":{"switch":"on"}}}}
      - conditions:
          - condition: trigger
            id: led on
        sequence:
          - service: mqtt.publish
            data:
              topic: cmnd/LoungeRoomSwitch/NSPSend
              payload: >-
                {"relation":{"NSPanel":{"ctype":"group","id":"3","params":{"switch":"on"}}}}
      - conditions:
          - condition: trigger
            id: tall off
        sequence:
          - service: mqtt.publish
            data:
              topic: cmnd/LoungeRoomSwitch/NSPSend
              payload: >-
                {"relation":{"NSPanel":{"ctype":"group","id":"1","params":{"switch":"off"}}}}
      - conditions:
          - condition: trigger
            id: small off
        sequence:
          - service: mqtt.publish
            data:
              topic: cmnd/LoungeRoomSwitch/NSPSend
              payload: >-
                {"relation":{"NSPanel":{"ctype":"group","id":"2","params":{"switch":"off"}}}}
      - conditions:
          - condition: trigger
            id: led off
        sequence:
          - service: mqtt.publish
            data:
              topic: cmnd/LoungeRoomSwitch/NSPSend
              payload: >-
                {"relation":{"NSPanel":{"ctype":"group","id":"3","params":{"switch":"off"}}}}
      - conditions:
          - condition: trigger
            id: xmasON
        sequence:
          - service: mqtt.publish
            data:
              topic: cmnd/LoungeRoomSwitch/NSPSend
              payload: >-
                {"relation":{"NSPanel":{"ctype":"group","id":"5","params":{"switch":"on"}}}}
      - conditions:
          - condition: trigger
            id: xmasOFF
        sequence:
          - service: mqtt.publish
            data:
              topic: cmnd/LoungeRoomSwitch/NSPSend
              payload: >-
                {"relation":{"NSPanel":{"ctype":"group","id":"5","params":{"switch":"off"}}}}
    default: []
mode: queued
max: 20

I haven’t set up automations yet to update the panel with the colour or temp yet, but im sure you could figure that out with this information.

This is also my autoexec.be file. The beginning section is where you set your widgets

# index "name   ", "ctype", uiid | name max 8 characters, rest will be truncated)
  1: ["TallLmp", "group", 69],
  2: ["SmllLmp", "group", 69],
  3: ["LEDStrip", "group", 33],
  4: ["Blinds", "group", 11],
  5: ["Xmastree", "group", 1],
  6: [],
  7: [],
  8: [],
}

To add, something that blakadder has not documented is a device UIID of 11 is Blinds control.

I also have all of my items as a ‘group’ rather than a ‘device’ so i dont have to update the device with ‘online’.

if any part of this is not clear let me know.
Im loving my panel. and with the current setup of tasmota, and automations you can do anything. Even use the thermostat page to turn on or off air con in your house.

i have also had to tune my ADCPARAM1 with the following to get the temp to actually match what is in my house

18:13:38.052 CMD: adcparam1
18:13:38.074 MQT: stat/LoungeRoomSwitch/RESULT = {"AdcParam1":[2,68000,10000,3450]}

again, im sure i can use attributes of the RAW data entity to send information instead of breaking down each JSON item into its own entity, but this was how i got mine working for now.

6 Likes

Thank you for this detailed post! What does blinds support look like in the interface?