Just to confirm I have this straight. The NSPanel just passes an ID back to HA. If I have 50 lights then I need 50 “if” statements to tie the id to an entity. Likewise, if I’m turning a light on with Alexa then I need to send 50 messages back to the panel to put the switch on the display in the right position.
Sorry, one more question. My goal would be to have a screen per room. At the moment, I have one screen with space for 8 widgets. I swipe and get a thermostat (which I don’t want). How do I make it so I can swipe and get another group of 8 widgets?
I’m assuming it’s the .be file but I can’t work out what I need to add
I would also like to revert to the stock ui
Can’t you flash the backup you took before flashing tasmota/esphome? Or does that not contain the original tft file?
I’ve searched and searched but can’t find whether this is even possible. I want one screen’s worth of widgets for each room and to be able to swipe between the screens.
Has anyone done this?
Hi guys, or girls, and so on,
from what i understood so far, sum this up a bit:
the nspanel.be driver file is needed to talk with the nextion firmware which is installed on the nextion lcd
the firmware was decoded by blakkadar, thanks for that.
the widgets can be modiefied in the nspanel.be
atm it is only possbile to interakt with the screens available on the Display itself, with the given nspanel file and translate this back to MQTT comands which can be hence interpreted/repsonded to… by HA for example.
for having diffrent display pages it would be needed to flash the nextion panel with customer tft/hmi file which can be created with the nextion editor… The Nextion Editor Guide - Nextion
while searching and browsing the web i found this intresting project, also whit a nextion display in it.
so my question now is, would it be possible to reuse the allready achived from the HA Switchplate and port it to this NSpanel?
many thanks
for anyone searching i found them on discord: https://cdn.discordapp.com/attachments/538814618106331139/925351768852951050/ns-panel.tft
Nice, thanks a lot! What discord channel is this?
Hi,
After reading this and the github thread throughoutly I started playing a bit with my NSPanel. I managed to get both Tasmota and ESPHome running on the device, but felt slightly limited by the default GUI. I have never worked with GUIs before but gave it a try after viewing the very helpful video on the topic by Masto.
I have so far managed to create a front screen with clock, date and temperatures (actual and feels like). My plan is to add a beautiful weather widget similar to the one in the default GUI to the screen. I have done a simple media player page that is working. All the buttons (previous, play-pause etc. and playlist buttons on the top) are exposed to Home Assistant as buttons. The artist and song info is pulled from a Ikea Sonos-speaker through HA (media_player). My thought with exposing buttons (instead of directly controlling something) is to allow a flexibility to chose what speakers to use (groups) by touching the cast logo (which is a button as well).
My idea is to create additional pages to have one for lights, one for equipment (AC, vacuum robot, lawn mower robot etc.), one for bootup (before the ESP has contact with HA), but also a screen to block the panel when the alarm is turned on. I included drafts of some of them.
Some of the screens are slightly poorly centered. As mentioned earlier in the thread, the screen is slightly larger than the visible area. I tried to estimate the “dead” space but my guess was slightly off.
If there is an interest for any of the code I am happy to share once I have taken it slightly further and polished it somewhat. I am curious if anybody has done something similar or have ideas on how to take it further.
That is fantastic, now I’m starting to think it’s time to get a couple of these for my house. Great work.
That’s great, I think that’s the most customization anyone’s posted so far. It feels like the information is getting more spread out – forum topics are great but get harder to search over time – so I added a public Wiki to my demo files repository in case anyone wants to dump knowledge or sample code there. (Also feel free to open PRs with more files)
If there’s a better central place for this, I can replace the above with a pointer to it.
That looks awesome! Yes, please share the HMI file. It’s a very nice starting point
My custom design for the EU NSPanel is starting to come together nicely
I use the buttons to control my lights and blinds and the info bar at the bottom shows me relevant information, e.g. whether it will rain soon or when music is playing, it shows the artist and song title.
I have been banging my head on an issue with the auto-sleep functionality of the screen. I tried setting it via ESPHome YAML as well as via Nextion Editor (by setting thsp
and thup
in Program.s
), but the screen stays on no matter what. Has someone managed to get auto-sleep working?
ESPHome related YAML:
display:
- platform: nextion
id: disp1
uart_id: tf_uart
tft_url: http://x.x.x.x:8123/local/nspanel/NSPanel.tft
touch_sleep_timeout: 20
auto_wake_on_touch: true
also tried:
display:
- platform: nextion
id: disp1
uart_id: tf_uart
tft_url: http://x.x.x.x:8123/local/nspanel/NSPanel.tft
on_setup:
then:
- lambda: |-
id(disp1).set_auto_wake_on_touch(true);
id(disp1).set_touch_sleep_timeout(20);
And via Program.s
in the Nextion Editor:
//The following code is only run once when power on, and is generally used for global variable definition and power on initialization data
int sys0=0,sys1=0,sys2=0 //At present, the definition of global variable only supports 4-byte signed integer (int), and other types of global quantity declaration are not supported. If you want to use string type, you can use variable control in the page to implement
thsp=20
thup=1
page 0 //Power on start page 0
When I run the debugger in Nextion Editor with the lines above, the emulator goes to sleep after 20sec as expected. However, when I upload the tft to the screen, it just stays on.
Is it possible to share your complete code for the EU panel?
Sure:
# Set some variables for convenience
substitutions:
node_name: nspanel-livingroom
device_name: NSPanel Woonkamer
# Note: this may not be needed if the pull request has been merged.
# Check https://github.com/esphome/esphome/pull/2956 for current status.
external_components:
- source: github://pr#2956
components: [nextion]
refresh: 1h
esphome:
name: $node_name
comment: $device_name
esp32:
board: esp32dev
ota:
password: "xxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
time:
- platform: homeassistant
id: homeassistant_time
# Enable logging
logger:
# 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: upload_tft
then:
- lambda: 'id(disp1)->upload_tft();'
# A reboot button is always useful
button:
- platform: restart
name: Restart $device_name
# Define some inputs
binary_sensor:
- platform: gpio
name: $device_name Left Button
pin:
number: 14
inverted: true
on_click:
- switch.toggle: relay_1
- platform: gpio
name: $device_name Right Button
pin:
number: 27
inverted: true
on_click:
- switch.toggle: relay_2
sensor:
- platform: wifi_signal
name: $device_name WiFi Signal
update_interval: 60s
- platform: ntc
id: temperature
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
name: $device_name Temperature
- platform: resistance
id: resistance_sensor
sensor: ntc_source
configuration: DOWNSTREAM
resistor: 11.2kOhm
- platform: adc
id: ntc_source
pin: 38
update_interval: 10s
attenuation: 11db
# Define some outputs
switch:
# The two relays
- platform: gpio
name: $device_name Relay 1
id: relay_1
pin:
number: 22
- platform: gpio
name: $device_name Relay 2
id: relay_2
pin:
number: 19
# Pin 4 always needs to be on to power up the display
- platform: gpio
id: screen_power
entity_category: config
pin:
number: 4
inverted: true
restore_mode: ALWAYS_ON
# Configure the internal bleeper
output:
- platform: ledc
id: buzzer_out
pin:
number: 21
number:
platform: template
name: $device_name Brightness
id: brightness
entity_category: config
unit_of_measurement: '%'
min_value: 0
max_value: 100
step: 1
initial_value: 30
optimistic: true
set_action:
then:
- lambda: 'id(disp1).set_backlight_brightness(x/100);'
text_sensor:
- platform: homeassistant
id: sonos_media_title
entity_id: sensor.sonos_livingroom_currently_playing
on_value:
# Push it to the display
then:
- lambda: 'id(disp1).set_component_text_printf("infobar", "%s", x.c_str());'
# Enable ringtone music support
rtttl:
id: buzzer
output: buzzer_out
# Configure UART for communicating with the screen
uart:
id: tf_uart
tx_pin: 16
rx_pin: 17
baud_rate: 115200
# Configure the screen itself
display:
- platform: nextion
id: disp1
uart_id: tf_uart
tft_url: http://x.x.x.x:8123/local/nspanel/NSPanel.tft
touch_sleep_timeout: 30
auto_wake_on_touch: true
on_setup:
then:
- lambda: |-
id(disp1).set_backlight_brightness(.3);
id(disp1).set_auto_wake_on_touch(true);
id(disp1).set_touch_sleep_timeout(30);
I did it the hard way: setup a touch cap, that on release sets the screen brightness to 100% and enables a timer, that runs 20s and sets the brightness back to 30% and disables itself.
Would you be so kind to share the code snippets?
That’s my full esphome config: esphome-configs/nspanel_kitchen.yaml at 209ac4e24393b1ef93c85249feb816ac87e6e106 · klaernie/esphome-configs · GitHub
And the .hmi and .tft are under esphome-configs/nextion at main · klaernie/esphome-configs · GitHub
I think seeing the full example makes it easier to understand - I wish someone would build a esphome equivalent for the nextion displays themselves - declare everything in a yaml and compile it to a .tft…
Just noticed that the nspanel can also be used as an ESP32 Bluetooth Low Energy Tracker Hub.
Very interesting!