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

Everything work now thank for your Help everyone

1 Like

Would like to share a little update on my project :slight_smile:

It got to a point where it has the following features:

  • Entities Page with support for cover, switch, input_boolean, sensor, button, input_button and light
  • Detail Pages for Lights (Brightness, Temperature and Color of the Light) and for Covers (Position)
  • Thermostat Page
  • Media Player Card
  • Screensaver Page with Time, Date and Weather Information

Everything is configured with yaml looking like this, manged by an AppDamon Script, available in HACS.

    pages:
      - type: cardEntities
        heading: Example Page 1
        items:
          - cover.example_cover
          - switch.example_switch
          - light.light_example
          - sensor.example_sensor
      - type: cardThermo
        heading: Exmaple Thermostat
        item: climate.example_climate
      - type: cardMedia
        heading: Exampe Media
        item: media_player.spotify_user

And here are some screenā€™s from the design of the display firmware:

14 Likes

Salvation ! I took a good look at your configuration and I took over the multi_click used on some of your buttons. however, I have a problem using it. if I keep pressing for example to change page on a long press, binary sensor remains in ā€œpressā€ position as long as I donā€™t put it back.

I canā€™t manage to deactivate it automatically after a page change or a timer. I tried several functions of nextion like ā€œclick 4.0ā€ but without effects after 2 days of trying and relentlessly

I have this code for setting an input boolean on a button click. maybe you could do similar?

on_click:
      - homeassistant.service:
          service: homeassistant.turn_on
          data:
            entity_id: input_boolean.play_smoothfm
      - delay: 0.2s
      - homeassistant.service:
          service: homeassistant.turn_off
          data:
            entity_id: input_boolean.play_smoothfm

edit: sorry i now realize what you are stuck with :man_facepalming:. do you have on_release checkbox ticked in the nextion editor?

yes, the button works fine on the page itself. but when the hold is performed for a page change, then HA continues to receive a press input. and this until an action is performed on the button. (I also tried on several types of button, touch, txt, but itā€™s the same thing for everything)

  - platform: nextion
    name: "$friendly_name touch_zone_spot_led"
    id: touche_zone_spot_led
    component_name: m0
    page_id: 2
    component_id: 6
    on_release:
        then:
          - homeassistant.service:
              service: switch.toggle
              data:
                entity_id: switch.spots_led
    on_multi_click:
      - timing:
          - ON for at least 0.2s
        then:
          - lambda: 'id(disp1).send_command_printf("page 5");'

Image 2

Alright well I finally found a ā€œloopholeā€. To play with timers (itā€™s your code that inspired me) here is my configuration :

  - platform: nextion
    name: "$friendly_name touch_zone_spot_led"
    id: touche_zone_spot_led
    component_name: m0
    page_id: 2
    component_id: 6
    on_multi_click:
      - timing:
          - ON for at most 1s
          - OFF for at least 0.5s
        then:
          - logger.log: "Single Short Clicked"
          - homeassistant.service:
              service: switch.toggle
              data:
                entity_id: switch.spots_led
      - timing:
          - ON for at most 1s
          - OFF for at most 1s
          - ON for at most 1s
          - OFF for at least 0.2s
        then:
          - logger.log: "Double Clicked"
          - lambda: 'id(disp1).send_command_printf("page 5");'
1 Like

hmmmm i have it in my code working fine. i have a on_click for single press and a on_multiclick with 1s set for long press.

thatā€™s what I had. But during the multi click, if there is no ā€œdeclickā€ before changing the page, home assistant continues to see the sensor as ā€œpressedā€ and when returning to this menu, you must first press the button , so that home assistant sees it as ā€œreleasedā€ so it makes a ghost key


my next project, Iā€™m going down the circular slider rabbit hole :rofl:

1 Like

I have started to make my own configuration with NSPanel, ESPHome and my own UI in Nextion.

I have a question, Iā€™m planing to have one button on the display to toggle on/off to turn on/off light, and Iā€™m planing to have button above to bright or dim a light (see the arrows above and below the icon for the lamp).

What would you say would be the easiest way to make the arrow buttons dim or bright?

page - home

The way to use buttons for increasing and decreasing have been shown in earlier posts, especially for increasing/decreasing thermostat temperatures. I donā€™t know how you plan to make them work but some things Iā€™d probably consider:

  • You probably donā€™t want them activated by accident when someone taps the on/off but misses and taps on the increase/decrease button. So Iā€™d do something like only activate them when someone holds their finger on them longer than a certain time.
  • Then, while someone holds their finger on the button, increase the brightness in fixed steps (say 5%) every half a second (or whatever works out best) and stops when the finger is removed.

Good luck

Iā€™ll be interested to see how that works out! :+1:

OK, will have a look,

So I make some changes in ESPHome yaml file and some automation in HA?

Sorry Iā€™m a noob when it comes to this :slight_smile:

A good place to start is here. There are various links in his comments that provide further useful background. Try and understand his yaml file then look at the yaml files the likes of myselff, @lovejoy777 etc have posted above which include elements of what you want to do, but probably not the whole thing.

You can probably do everything in the yaml file, you shouldnā€™t need automations in HA.

All examples I have seen so far is that it increase or decrease 1 or what ever you set for one click on the button. Iā€™m looking for some how that it should increase or decrease while I hold the button pressed. Not only x numbers and I need to press again. I havenā€™t seen anything like that. I have also seen sliders, but not what Iā€™m looking for :slight_smile:

you will need a loop in your on_multiclick. look here, he is using a loop in esphome. although heā€™s using it to set brightness in steps with time, i presume you can alter the code to achieve what you want.

1 Like

This is my dimmer yaml that cycles through Dim ā†’ Bright ā†’ dim with a single hold. release and hold again and the cycle reverses. Single click is on/off toggle.

2 Likes

do you mind sharing the hmi file (Nextion file) or havenā€™t you changed to custom UI?

here is the start of my new thermostat page :slight_smile:

2 Likes

I use the default HMI and the nspanel component to send/receive JSON to control the widgets.