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

Thank you for the reply. I have sent you little donation as appreciation

1 Like

@jobraun I am trying to use your program with esphome (I already had it installed) My first issue is getting the tft to upload. Following the instructions on GitHub - sairon/esphome-nspanel-lovelace-ui: ESPHome component for NSPanel Lovelace UI
I get an error in the ESp yaml

api:
  - service: upload_tft
    variables:
      url: string
    then:
      - lambda: |-
          id(nspanel).upload_tft(url);

The service line error is “Expected a dictionary”
Also where do I put the

http://nspanel.pky.eu/lui-us-p.tft

url

and how do I trigger the upload.

Your project looks awesome and I appreciate any help you can give me the instructions on uploading are assuming a base knowldge I need to aquire.

Craig

I don’t have the variables section in mine. In total my api section looks as follows:

# Enable Home Assistant API
api:
  services:
    # Service to play a song
    - service: play_rtttl
      variables:
        song_str: string
      then:
        - rtttl.play:
            rtttl: !lambda 'return song_str;'
    # Service to upload the tft file
    - service: upload_tft
      then:
        - lambda: 'id(disp1)->upload_tft();'
    # Send an arbitrary command
    - service: send_command
      variables:
        cmd: string
      then:
         - lambda: 'id(disp1).send_command_printf("%s", cmd.c_str());'

You can then trigger the upload from the Developer Tools > Services section.

Sorry, cannot help you with that on the esphome component.

I wrote an initial POC with esphome before I developed the driver for tasmota, but I never used the esphome component from sairon.
If you are not getting progress with flashing, use tasmota and my driver or ask sairon. (no clue if he is reading here, maybe ask on github)

Great work! :slight_smile:
Would you share the HMI file?

Would love to use the music page.

@jobraun I took your advice and switched to Tasmoto. I have it all working but noticed one issue. This is a us panel in portrait mode.

-When I use regular entities the toggle switch is virtually unusable, it occasionally responds but rarely can I turn off a switch. The cardEntities work great so that is what I use. Thought I would mention it in case someone else has the issue.

Would it be possible to use the physical buttons for something besides triggering the internal relays? I was thinking of using them to adjust the thermostat up and down, or activate a scene. (they don’t seem to send an mqtt message)

Thanks

Craig

I use the left physical switch to open/close the relay and switch off/on a light connected to it. With the right switch, I’ve disabled the relay and instead when it’s pressed for a minimum of 2 seconds it triggers a ZigBee relay in HA which causes my electric gates to open.

Basically you can do more or less what you like with them.

1 Like

Execute FlashNextion http://nspanel.pky.eu/lui-us-p.tft in the tasmota console and check again, looks like a bug, that’s present since the layout change of the entites page in the US-P version.

See #136 for the physical buttons you can use tasmota rules to change their behaviour to anything you want.

Thanks I am away for a couple days and will try your suggestions when I get home. I am sure I will have another question or 2 as I formulate how I am going to use it.

Thanks

Craig

PS: just thought of one…I noticed that when i wake it from sleep it is on the last page that was used, is this expected behavior? Is it possible to have it always go to a particular screen on wake, or use the physical buttons to trigger it to go to a screen like shortcuts (long press, dbl press etc).
Gonna drop you a coffee or so for the work.

1 Like

Yes, you can configure defaultCard within the config of the screensaver. This will always exit the screensaver to this page instead of the last page used.

Tried the .tft update and still have the same issue.
thanks to your example I got the buttons to send an mqtt message, not sure what I will do with it yet but I will come up with something.
How would I use them to increment the temperature?
Can’t seem to figure out how to set a default page
would like to use the thermostat page (1st page)


nspanel-1:
  module: nspanel-lovelace-ui
  class: NsPanelLovelaceUIManager
  config:
    panelRecvTopic: "tele/nspanel/RESULT"
    panelSendTopic: "cmnd/nspanel/CustomSend"
    updateMode: "auto-notify"
    sleepTimeout: 20
    #sleepBrightness: 10
    sleepBrightness:
      - time: "7:00:00"
        value: 10
      - time: "23:00:00"
        value: 0
    locale: "en_CA" # used for translations in translations.py and for localized date if babel python package is installed
    model: "us-p"
    screensaver:
      entity: weather.nanaimo
      defaultCard: cardThermo
    cards:
      - type: cardThermo
        entity: climate.my_ecobee
      - type: cardGrid
        entities:
          - entity: light.entry_lights
          - entity: switch.hallway_light
            icon: lightbulb
          - entity: light.living_room_lights
          - entity: light.dining_room_light
          - entity: light.kitchen_lights
          - entity: light.master_bedroom_light
        title: Lights
      - type: cardEntities
        entities:
          - entity: switch.hallway_light
            name: Hallway
            icon: lightbulb
          - entity: light.example_item
          - entity: cover.example_item
          - entity: input_boolean.example_item
          - entity: switch.hallway_light
        title: Example Entities 1
      - type: cardEntities
        entities:
          - entity: switch.example_item
          - entity: delete
          - entity: cover.example_item
          - entity: input_boolean.example_item
        title: Example Entities 2
      - type: cardEntities
        entities:
          - entity: binary_sensor.example_item
          - entity: sensor.example_item
          - entity: button.example_item
          - entity: number.example_item
        title: Example Entities 3
 
      # - type: cardMedia
      #  entity: media_player.example_item
      #- type: cardAlarm
      #  entity: alarm_control_panel.alarmo

Okay I figured out how to do the default card. For any one trying to do this I will leave an example.

    screensaver:
      entity: weather.nanaimo
      defaultCard: navigate.cardThermo_thermostat
    cards:
      - type: cardThermo
        entity: climate.my_ecobee
        key: thermostat
      - type: cardGrid

For the card you want to use add the key line.
Under screensaver use the navigate option as I have.
For most people this may have been obvious but for the rest of us I hope this helps.
*as suggested I tried not using the navigate function and it worked

1 Like

try this

    screensaver:
      entity: weather.nanaimo
      defaultCard: cardThermo_test
    cards:
      - type: cardThermo
        key: test
        entity: climate.my_ecobee

can you do a video with the corresponding appdaemon log for the issue you have with the switches?

2022-05-17 16:26:43.173789 INFO nspanel-1: MQTT callback for: {'topic': 'tele/nspanel/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,screensaver,bExit,1"}'}
2022-05-17 16:26:43.185006 INFO nspanel-1: Received Message from Screen: event,buttonPress2,screensaver,bExit,1
2022-05-17 16:26:43.194069 INFO nspanel-1: Button Press Event; entity_id: screensaver; button_type: bExit; value: 1 
2022-05-17 16:26:43.202377 INFO nspanel-1: Started rendering of page 0 with type cardThermo
2022-05-17 16:26:43.210515 INFO nspanel-1: Sending MQTT Message: pageType~cardThermo
2022-05-17 16:26:43.277783 INFO nspanel-1: Sending MQTT Message: entityUpd~My ecobee~1|1~climate.my_ecobee~221~220~Fan~70~350~5~~~~~~~~~~~~~~~~~~~~~���~64512~0~heat_cool~���~64512~1~heat~���~11487~0~cool~���~35921~0~off
2022-05-17 16:26:48.125549 INFO nspanel-1: MQTT callback for: {'topic': 'tele/nspanel/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,cardThermo,bNext"}'}
2022-05-17 16:26:48.134164 INFO nspanel-1: Received Message from Screen: event,buttonPress2,cardThermo,bNext
2022-05-17 16:26:48.142016 INFO nspanel-1: Button Press Event; entity_id: cardThermo; button_type: bNext; value: None 
2022-05-17 16:26:48.149200 INFO nspanel-1: Started rendering of page 1 with type cardGrid
2022-05-17 16:26:48.156639 INFO nspanel-1: Sending MQTT Message: pageType~cardGrid
2022-05-17 16:26:48.329783 INFO nspanel-1: Sending MQTT Message: entityUpd~Lights~1|1~light~light.entry_lights~���~17299~Entry Lights~0~switch~switch.hallway_light~���~63142~Hallway light~1~light~light.living_room_lights~���~17299~Living Room Lights~0~light~light.dining_room_light~���~17299~Dining Room Light~0~light~light.kitchen_lights~���~17299~Kitchen Lights~0~light~light.master_bedroom_light~���~17299~Master Bedroom Light~0
2022-05-17 16:26:53.241356 INFO nspanel-1: MQTT callback for: {'topic': 'tele/nspanel/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,switch.hallway_light,button"}'}
2022-05-17 16:26:53.251343 INFO nspanel-1: Received Message from Screen: event,buttonPress2,switch.hallway_light,button
2022-05-17 16:26:53.261614 INFO nspanel-1: Button Press Event; entity_id: switch.hallway_light; button_type: button; value: None 
2022-05-17 16:26:53.624010 INFO nspanel-1: Started rendering of page 1 with type cardGrid
2022-05-17 16:26:53.790343 INFO nspanel-1: Sending MQTT Message: entityUpd~Lights~1|1~light~light.entry_lights~���~17299~Entry Lights~0~switch~switch.hallway_light~���~17299~Hallway light~0~light~light.living_room_lights~���~17299~Living Room Lights~0~light~light.dining_room_light~���~17299~Dining Room Light~0~light~light.kitchen_lights~���~17299~Kitchen Lights~0~light~light.master_bedroom_light~���~17299~Master Bedroom Light~0
2022-05-17 16:26:53.890998 INFO nspanel-1: Started rendering of page 1 with type cardGrid
2022-05-17 16:26:54.077193 INFO nspanel-1: Sending MQTT Message: entityUpd~Lights~1|1~light~light.entry_lights~���~17299~Entry Lights~0~switch~switch.hallway_light~���~17299~Hallway light~0~light~light.living_room_lights~���~17299~Living Room Lights~0~light~light.dining_room_light~���~17299~Dining Room Light~0~light~light.kitchen_lights~���~17299~Kitchen Lights~0~light~light.master_bedroom_light~���~17299~Master Bedroom Light~0
2022-05-17 16:26:56.268125 INFO nspanel-1: MQTT callback for: {'topic': 'tele/nspanel/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,switch.hallway_light,button"}'}
2022-05-17 16:26:56.278183 INFO nspanel-1: Received Message from Screen: event,buttonPress2,switch.hallway_light,button
2022-05-17 16:26:56.288598 INFO nspanel-1: Button Press Event; entity_id: switch.hallway_light; button_type: button; value: None 
2022-05-17 16:26:56.665731 INFO nspanel-1: Started rendering of page 1 with type cardGrid
2022-05-17 16:26:56.807832 INFO nspanel-1: Sending MQTT Message: entityUpd~Lights~1|1~light~light.entry_lights~���~17299~Entry Lights~0~switch~switch.hallway_light~���~63142~Hallway light~1~light~light.living_room_lights~���~17299~Living Room Lights~0~light~light.dining_room_light~���~17299~Dining Room Light~0~light~light.kitchen_lights~���~17299~Kitchen Lights~0~light~light.master_bedroom_light~���~17299~Master Bedroom Light~0
2022-05-17 16:26:56.847588 INFO nspanel-1: Started rendering of page 1 with type cardGrid
2022-05-17 16:26:56.918405 INFO nspanel-1: Sending MQTT Message: entityUpd~Lights~1|1~light~light.entry_lights~���~17299~Entry Lights~0~switch~switch.hallway_light~���~63142~Hallway light~1~light~light.living_room_lights~���~17299~Living Room Lights~0~light~light.dining_room_light~���~17299~Dining Room Light~0~light~light.kitchen_lights~���~17299~Kitchen Lights~0~light~light.master_bedroom_light~���~17299~Master Bedroom Light~0
2022-05-17 16:27:01.068340 INFO nspanel-1: Sending MQTT Message: time~16:27
2022-05-17 16:27:01.790028 INFO nspanel-1: MQTT callback for: {'topic': 'tele/nspanel/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,cardGrid,bNext"}'}
2022-05-17 16:27:01.799962 INFO nspanel-1: Received Message from Screen: event,buttonPress2,cardGrid,bNext
2022-05-17 16:27:01.810569 INFO nspanel-1: Button Press Event; entity_id: cardGrid; button_type: bNext; value: None 
2022-05-17 16:27:01.821835 INFO nspanel-1: Started rendering of page 2 with type cardEntities
2022-05-17 16:27:01.832725 INFO nspanel-1: Sending MQTT Message: pageType~cardEntities
2022-05-17 16:27:01.895314 INFO nspanel-1: Sending MQTT Message: entityUpd~Example Entities 1~1|1~switch~switch.hallway_light~���~63142~Hallway light~1

Not sure if I could upload the video but here is a link

Bit of a weird one. My NSPanel was working fine with jobrauns method, now today it boots up but only to the screensaver and I cant get past it. Looks like the whole touch screen is not responsive. Have changed MQTT settings, model which prompted me to confirm/dismiss but I can’t press those buttons either.

Looks to have lost all touch capabilities of the screen

This doesn’t look like the latest development firmware for US-P, the layout of the page should be changed in the dev firmware

FlashNextion http://nspanel.pky.eu/lui-us-p.tft

The panel is only sending a message to the backend on touching the screensaver, it doesn’t know how to exit the screensaver, so it’s possible that you get this behavior on an error in the backend. please check your AppDeamon log

Very strange. I’ve check Configs on mqtt, appdaemon, reinstalled it all etc. Same thing.

I can initiate the button relays from within HA so it’s communicating, just not allowing me to make any touches on the screen

Thought I had done that but I guess not, that took care of the problem.

Thanks

Craig

does the screensaver exit event arrive in the appdaemon log?

2022-05-20 15:14:50.768179 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:50.766158 WARNING nspanel-1: Traceback (most recent call last): File “/usr/local/lib/python3.9/site-packages/appdaemon/threading.py”, line 950, in worker funcref(args[“event”], data, self.AD.events.sanitize_event_kwargs(app, args[“kwargs”])) File “/conf/apps/nspanel-lovelace-ui/luibackend/mqttListener.py”, line 41, in mqtt_event_callback self._controller.startup() File “/conf/apps/nspanel-lovelace-ui/luibackend/controller.py”, line 55, in startup self._pages_gen.update_date("") File “/conf/apps/nspanel-lovelace-ui/luibackend/pages.py”, line 52, in update_date addTemplate = self._config.get(“dateAdditonalTemplate”, “”) TypeError: get() takes 2 positional arguments but 3 were given
2022-05-20 15:14:50.755633 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:50.753329 WARNING nspanel-1: Worker Ags: {‘id’: ‘f8a0968682e04762b64354ead07a0f45’, ‘name’: ‘nspanel-1’, ‘objectid’: ‘bbe6c09c0a854def86374d3d14246532’, ‘type’: ‘event’, ‘event’: ‘MQTT_MESSAGE’, ‘function’: <bound method LuiMqttListener.mqtt_event_callback of <luibackend.mqttListener.LuiMqttListener object at 0xffffae27db50>>, ‘data’: {‘topic’: ‘tele/nspanel1/RESULT’, ‘wildcard’: None, ‘payload’: ‘{“CustomRecv”:“event,startup,34,eu”}’}, ‘pin_app’: True, ‘pin_thread’: 0, ‘kwargs’: {‘topic’: ‘tele/nspanel1/RESULT’, ‘__thread_id’: ‘thread-0’}}
2022-05-20 15:14:50.746396 WARNING nspanel-1: Unexpected error in worker for App nspanel-1:
2022-05-20 15:14:50.743841 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:45.128893 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:45.125177 WARNING nspanel-1: Traceback (most recent call last): File “/usr/local/lib/python3.9/site-packages/appdaemon/threading.py”, line 950, in worker funcref(args[“event”], data, self.AD.events.sanitize_event_kwargs(app, args[“kwargs”])) File “/conf/apps/nspanel-lovelace-ui/luibackend/mqttListener.py”, line 41, in mqtt_event_callback self._controller.startup() File “/conf/apps/nspanel-lovelace-ui/luibackend/controller.py”, line 55, in startup self._pages_gen.update_date("") File “/conf/apps/nspanel-lovelace-ui/luibackend/pages.py”, line 52, in update_date addTemplate = self._config.get(“dateAdditonalTemplate”, “”) TypeError: get() takes 2 positional arguments but 3 were given
2022-05-20 15:14:45.120132 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:45.117087 WARNING nspanel-1: Worker Ags: {‘id’: ‘f8a0968682e04762b64354ead07a0f45’, ‘name’: ‘nspanel-1’, ‘objectid’: ‘bbe6c09c0a854def86374d3d14246532’, ‘type’: ‘event’, ‘event’: ‘MQTT_MESSAGE’, ‘function’: <bound method LuiMqttListener.mqtt_event_callback of <luibackend.mqttListener.LuiMqttListener object at 0xffffae27db50>>, ‘data’: {‘topic’: ‘tele/nspanel1/RESULT’, ‘wildcard’: None, ‘payload’: ‘{“CustomRecv”:“event,startup,34,eu”}’}, ‘pin_app’: True, ‘pin_thread’: 0, ‘kwargs’: {‘topic’: ‘tele/nspanel1/RESULT’, ‘__thread_id’: ‘thread-0’}}
2022-05-20 15:14:45.114092 WARNING nspanel-1: Unexpected error in worker for App nspanel-1:
2022-05-20 15:14:45.111579 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:38.934336 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:38.932616 WARNING nspanel-1: Traceback (most recent call last): File “/usr/local/lib/python3.9/site-packages/appdaemon/threading.py”, line 950, in worker funcref(args[“event”], data, self.AD.events.sanitize_event_kwargs(app, args[“kwargs”])) File “/conf/apps/nspanel-lovelace-ui/luibackend/mqttListener.py”, line 41, in mqtt_event_callback self._controller.startup() File “/conf/apps/nspanel-lovelace-ui/luibackend/controller.py”, line 55, in startup self._pages_gen.update_date("") File “/conf/apps/nspanel-lovelace-ui/luibackend/pages.py”, line 52, in update_date addTemplate = self._config.get(“dateAdditonalTemplate”, “”) TypeError: get() takes 2 positional arguments but 3 were given
2022-05-20 15:14:38.928548 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:38.917480 WARNING nspanel-1: Worker Ags: {‘id’: ‘f8a0968682e04762b64354ead07a0f45’, ‘name’: ‘nspanel-1’, ‘objectid’: ‘bbe6c09c0a854def86374d3d14246532’, ‘type’: ‘event’, ‘event’: ‘MQTT_MESSAGE’, ‘function’: <bound method LuiMqttListener.mqtt_event_callback of <luibackend.mqttListener.LuiMqttListener object at 0xffffae27db50>>, ‘data’: {‘topic’: ‘tele/nspanel1/RESULT’, ‘wildcard’: None, ‘payload’: ‘{“CustomRecv”:“event,startup,34,eu”}’}, ‘pin_app’: True, ‘pin_thread’: 0, ‘kwargs’: {‘topic’: ‘tele/nspanel1/RESULT’, ‘__thread_id’: ‘thread-0’}}
2022-05-20 15:14:38.914149 WARNING nspanel-1: Unexpected error in worker for App nspanel-1:
2022-05-20 15:14:38.911455 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:33.044706 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:33.040865 WARNING nspanel-1: Traceback (most recent call last): File “/usr/local/lib/python3.9/site-packages/appdaemon/threading.py”, line 950, in worker funcref(args[“event”], data, self.AD.events.sanitize_event_kwargs(app, args[“kwargs”])) File “/conf/apps/nspanel-lovelace-ui/luibackend/mqttListener.py”, line 41, in mqtt_event_callback self._controller.startup() File “/conf/apps/nspanel-lovelace-ui/luibackend/controller.py”, line 55, in startup self._pages_gen.update_date("") File “/conf/apps/nspanel-lovelace-ui/luibackend/pages.py”, line 52, in update_date addTemplate = self._config.get(“dateAdditonalTemplate”, “”) TypeError: get() takes 2 positional arguments but 3 were given
2022-05-20 15:14:33.036137 WARNING nspanel-1: ------------------------------------------------------------
2022-05-20 15:14:33.033802 WARNING nspanel-1: Worker Ags: {‘id’: ‘f8a0968682e04762b64354ead07a0f45’, ‘name’: ‘nspanel-1’, ‘objectid’: ‘bbe6c09c0a854def86374d3d14246532’, ‘type’: ‘event’, ‘event’: ‘MQTT_MESSAGE’, ‘function’: <bound method LuiMqttListener.mqtt_event_callback of <luibackend.mqttListener.LuiMqttListener object at 0xffffae27db50>>, ‘data’: {‘topic’: ‘tele/nspanel1/RESULT’, ‘wildcard’: None, ‘payload’: ‘{“CustomRecv”:“event,startup,34,eu”}’}, ‘pin_app’: True, ‘pin_thread’: 0, ‘kwargs’: {‘topic’: ‘tele/nspanel1/RESULT’, ‘__thread_id’: ‘thread-0’}}

after upgrade to 2.8.3 this porblem is sowing up in appdeamon