Closed Chreece closed 3 weeks ago
I'd like to get the project as close as I can to the upstream nspanel project (though some features are not possible with esphome right now). If nspanel-lovelace-ui supports it then I should be able to add support in this project too 👍
It looks like input_text is available on the entities card but read-only.. Adding a full multi-lingual keyboard probably wont work for the nspanel though. You'd have to file a feature request on the upstream repo for that 😃
The entities I mentioned except the input_text
, are already supported by nspanel-lovelace-ui.
The reason I asked for the support is because I'm using them in my current setup and wanted to switch to yours....
This should provide support for the entities you mentioned. It took a lot longer than I expected because I ran in to memory consumption issues which surfaced after I added the new entity types. A lot has changed so hopefully it still works!
p.s. input_text
is read-only the same as the upstream repo.
Wanted to try it by updating via OTA (was already using esphome with the https://github.com/sairon/esphome-nspanel-lovelace-ui backend). There seems to be no communication with homeassistant. Before investigating further, is it necessary to flash your version only via Serial for the first time?
In theory it should just work.. but it sounds like the upload failed or your settings were different? Is the device name
and the api -> encryption -> key
the same as your old config? If you added ota
to the config and it was crashing, then after 10 attempts esphome will put it in safe-mode so you can do ota again.
The name is the same, also tried to remove the old esphome device and reinstall it with your config. I haven't any encryption key used. There seems that it gets the time and some entity names but can't control anything and the states are uknown - wrong. The entity names aren't all in english, could that be a problem?
You are probably correct that it isn't connected to HomeAssistant. The time will be sent from your PC when you connect to it to view the logs (so it must have a wifi connection). The entity names might be taken from your config when you set it up - especially if they are not in English.. but this shouldn't cause any issues.
Are you able to get the logs from the device so I can understand the problem more? It would be better to connect to the panel directly as some logs (including any crash logs) are missed when connecting remotely over wifi.
I'm surely missing something... How does it communicate with HA? Do i still need the Appdaemon Backend? I don't see any line that directs to HA in the yaml configuration
*I'm running HA and ESPHome in docker (no supervisor, addons etc)
No problem, I can explain... You don't need AppDaemon (I started the project because I didn't want to have AppDaemon running too).
This project uses esphome to communicate directly with HA using an 'add-on' called 'esphome' (see here: https://esphome.io/guides/getting_started_hassio). Once you have added the 'esphome' add-on to HA your nspanel should be automatically discovered by HA (you should get a notification of a new device found). If HA doesn't find the nspanel then you may need to add it manually, but the wizard should guide you through configuration anyway. Just make sure the panel and HA can communicate with each other (they are on the same LAN subnet and the firewall on the HA machine is configured correctly etc).
Edit: I've just seen your comment about not having add-ons which might make things more tricky for you. It is still possible, but you have to manually add the add-on plugin using docker run/compose.. My docker instance has this container which is probably what you need homeassistant/amd64-addon-configurator:latest
(if you are running on an x86-64 processor otherwise that will need adjusting). You might not get the automatic discovery of devices either because you don't have the DNS container (I'm not sure about that though) ghcr.io/home-assistant/amd64-hassio-dns
?
So it really needs the addon, the esphome integration isn't enough?
I don't use the esphome dashboard (I upload from my PC manually)... Having read the esphome dashboard and esphome HA add-on docs it sounds like both do similar things so I am not sure. I may have to test it and come back to you. This article mentions 4 different ways of using esphome!
My understanding was that the esphome dashboard/integration is only for uploading firmware and managing the device (logs etc.) but doesn't communicate with HA at all. I might be wrong though. The HA add-on provides a link between HA and all the esphome devices.
You might get a better understanding of how esphome works by asking on the esphome discord maybe?
Thank you very much for your time! I'm getting seeing this message on the logs (wireless through esphome Dashboard):
[18:15:35][D][api.connection:1389]: Home Assistant 2024.9.1 (192.168.178.57): Connected successfully
So it should communicate with esphome since I added it in esphome integration. Also the switch entities are shown but trying to control them, makes them unavailable for a second and then stay again on.
After a while it just stops communicating with the dashboard and the HA and doesn't change pages when i touch it (stays on screensaver)
Sorry if I'm getting you in trouble
HI @Chreece. The ESPHome dashboard is just a tool to build and upload your configurations, it has nothing to do with esphome's communication with HA, in fact, you can perfectly use esphome with HA without the esphome dashboard installed. ESPHome uses HA's api to connect and communicate. At boot, esphome will 'announce' itself in the network, HA will pick that up and show it to you in the Integrations page as a newly discovered device, if you have autodiscovery enabled (which is HA's default). If it doesn't show up as discovered, then you can manually add it using the device's IP address. Now, if you are having communication issues between HA and ESPHome (maybe you see some reconnection attempts in the device's logs?) then you may wanna take a look at your network configuration, you may have some issues there. Again, the dashboard has nothing to do with how ESPHome communicates with HA's API which is what this project uses to communicate with HA
@santibur06 Thanks for the detailed explanation, I wasn't able to comment on the dashboard as I have never used it!
After a while it just stops communicating with the dashboard and the HA and doesn't change pages when I touch it (stays on screensaver)
@Chreece Unfortunately this sounds like a bug that is making the device crash... can I see the section of your config where you are using this switch including the page type? Hopefully I can reproduce it, but logs would help a lot too!
Do the other entities work okay though? I don't have access to test all sensors and switches on HA so it makes testing difficult 🤦
@santibur06 thank you very much! My thoughts was also that Dashboard isn't in fact needed.
@olicooper here is my configuration:
I don't see any switch entities in your config (under nspanel_lovelace > cards
).. Can you explain what you mean when your say 'switch entities'? Are you pressing the physical buttons below the screen? Does the panel still freeze even if you don't interact with it or do you have to visit a specific page for it to freeze? Everything in your config looks okay to me.
I wonder if it is running out of memory? To test, you will need to upload a version with 1-2 cards and see if it is stable.
To see if it is a specific card causing the issue, try uploading with 1-2 cards at a time until you've tried all the cards. If the panel freezes at any point then you can narrow it down to a few cards.
If you are able to debug with a USB TTL, you will see exactly what the problem is if the panel is crashing.
The Panel exposes the 2 physical Buttons as switches in HA. I will try to read the serial logs when I have time
Ah okay.. So this part of the config is actually maintained by esphome (only the stuff under the napanel_lovelace
section is part of this project). It is still possible that my code is causing an issue but we need to consider issues with esphome and memory exhaustion too...
esphome:
name: nspanel-wohnzimmer
name_add_mac_suffix: true
comment: "NSPanel Test 1"
build_path: ./.build/nspanel-test1
esp32:
board: esp32dev
framework:
type: esp-idf
sdkconfig_options:
## These are required to allow access to the PSRAM
## NOTE: This is temporary and will be removed in a
## future release when the build script is improved
CONFIG_D0WD_PSRAM_CLK_IO: '5'
CONFIG_D0WD_PSRAM_CS_IO: '18'
external_components:
- source:
type: git
url: https://github.com/olicooper/esphome-nspanel-lovelace-native
ref: dev
refresh: 3h
components: [nspanel_lovelace]
nspanel_lovelace:
id: nspanel
sleep_timeout: 30
screensaver:
time_id: homeassistant_time
weather:
entity_id: sensor.weather_forecast_daily
cards:
- type: cardEntities
title: Φωτισμός-Ρολά
sleep_timeout: 10
entities:
- entity_id: navigate.lights
icon: lightbulb-group
- entity_id: cover.wohnzimmer_cover_links_cover_3
- entity_id: cover.wohnzimmer_cover_rechts_cover_6
- type: cardGrid
id: lights
title: Φωτισμός
sleep_timeout: 5
hidden: true
entities:
- entity_id: light.wohnzimmer_licht_1
- entity_id: light.wohnzimmer_licht_2
- entity_id: light.wohnzimmer_licht_3
- entity_id: light.wohnzimmer_licht_4
- entity_id: light.wohnzimmer_licht_5
- entity_id: light.wohnzimmer_licht_6
logger:
# If the baud rate is set too slow then logs will take longer to print and
# the system will slow down. 115200 is a good speed to use here.
baud_rate: 115200
level: DEBUG
logs:
adc: WARN
api: DEBUG
app: INFO
uart: WARN
time: WARN
switch: DEBUG
sensor: WARN
button: WARN
text_sensor: WARN
resistance: WARN
mdns: WARN
ntc: WARN
ota: INFO
nspanel_lovelace_upload: DEBUG
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
use_address: 192.168.178.88
api:
# Ideally an encryption key should be used too...
# encryption:
# key: !secret api_key
services:
## Service to update the TFT firmware using a URL that is accessible to the nspanel
- service: upload_tft
variables:
url: string
then:
- lambda: 'id(nspanel).upload_tft(url);'
ota:
platform: esphome
password: !secret ota_update
## UART for the Nextion display
uart:
id: uart_nextion
tx_pin: 16
rx_pin: 17
baud_rate: 115200
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/London
on_time:
## At midnight
- seconds: 0
minutes: 0
hours: 0
then:
- lambda: 'id(nspanel).set_display_dim(1, 50);'
## At 8:00 PM
- seconds: 0
minutes: 0
hours: 20
then:
- lambda: 'id(nspanel).set_display_dim(20, 80);'
## At 7:00 AM
- seconds: 0
minutes: 0
hours: 7
then:
- lambda: 'id(nspanel).set_display_dim(50, 100);'
switch:
## Physical relay 1
- platform: gpio
name: Relay 1
id: relay_1
pin:
number: 19
restore_mode: ALWAYS_ON
## Physical relay 2
- platform: gpio
name: Relay 2
id: relay_2
pin:
number: 22
restore_mode: ALWAYS_ON
## Turn screen power on/off
- platform: gpio
name: Screen Power
id: screen_power
entity_category: config
pin:
number: 4
inverted: true
restore_mode: ALWAYS_ON
binary_sensor:
## Left button below the display
- platform: gpio
name: Left Button
pin:
number: GPIO14
inverted: true
id: left_button
internal: true
on_click:
- switch.toggle: relay_1
## Right button below the display
- platform: gpio
name: Right Button
pin:
number: GPIO27
inverted: true
id: right_button
internal: true
on_click:
- switch.toggle: relay_2
Thank you very much for your time, I will try to find some time and test it tomorrow
So we are getting better with 1 card...
Finally can control entities from the nspanel. The names aren't shown maybe because they aren't in English (they are in Greek though)
When Adding all the cards the NSPanel seems to be losing connection with HA:
[13:52:40][I][app:100]: ESPHome version 2024.8.1 compiled on Sep 14 2024, 13:52:17
[13:52:40][C][wifi:600]: WiFi:
[13:52:40][C][wifi:428]: Local MAC: C4:DD:57:E7:D4:7C
[13:52:40][C][wifi:433]: SSID: [redacted]
[13:52:40][C][wifi:436]: IP Address: 192.168.178.88
[13:52:40][C][wifi:440]: BSSID: [redacted]
[13:52:40][C][wifi:441]: Hostname: 'nspanel-wohnzimmer-e7d47c'
[13:52:40][C][wifi:443]: Signal strength: -54 dB ▂▄▆█
[13:52:40][C][wifi:447]: Channel: 1
[13:52:40][C][wifi:448]: Subnet: 255.255.255.0
[13:52:40][C][wifi:449]: Gateway: 192.168.178.1
[13:52:40][C][wifi:450]: DNS1: 192.168.178.57
[13:52:40][C][wifi:451]: DNS2: 0.0.0.0
[13:52:40][C][logger:185]: Logger:
[13:52:40][C][logger:186]: Level: DEBUG
[13:52:40][C][logger:188]: Log Baud Rate: 115200
[13:52:40][C][logger:189]: Hardware UART: UART0
[13:52:40][C][logger:193]: Level for 'adc': WARN
[13:52:40][C][logger:193]: Level for 'api': DEBUG
[13:52:40][C][logger:193]: Level for 'app': INFO
[13:52:40][C][logger:193]: Level for 'uart': WARN
[13:52:40][C][logger:193]: Level for 'time': WARN
[13:52:40][C][logger:193]: Level for 'switch': DEBUG
[13:52:40][C][logger:193]: Level for 'sensor': WARN
[13:52:40][C][logger:193]: Level for 'button': WARN
[13:52:40][C][logger:193]: Level for 'text_sensor': WARN
[13:52:40][C][logger:193]: Level for 'resistance': WARN
[13:52:40][C][logger:193]: Level for 'mdns': WARN
[13:52:40][C][logger:193]: Level for 'ntc': WARN
[13:52:40][C][logger:193]: Level for 'ota': INFO
[13:52:40][C][logger:193]: Level for 'nspanel_lovelace_upload': DEBUG
[13:52:40][D][nspanel_lovelace:1290]: TFT CMD OUT: time~13:52
[13:52:40][C][uart.idf:159]: UART Bus 1:
[13:52:40][C][uart.idf:160]: TX Pin: GPIO16
[13:52:40][C][uart.idf:161]: RX Pin: GPIO17
[13:52:40][C][uart.idf:163]: RX Buffer Size: 256
[13:52:40][C][uart.idf:165]: Baud Rate: 115200 baud
[13:52:40][C][uart.idf:166]: Data Bits: 8
[13:52:40][C][uart.idf:167]: Parity: NONE
[13:52:40][C][uart.idf:168]: Stop bits: 1
[13:52:40][C][switch.gpio:068]: GPIO Switch 'Relay 1'
[13:52:40][C][switch.gpio:091]: Restore Mode: always ON
[13:52:40][C][switch.gpio:031]: Pin: GPIO19
[13:52:40][C][switch.gpio:068]: GPIO Switch 'Relay 2'
[13:52:40][C][switch.gpio:091]: Restore Mode: always ON
[13:52:40][C][switch.gpio:031]: Pin: GPIO22
[13:52:40][C][switch.gpio:068]: GPIO Switch 'Screen Power'
[13:52:40][C][switch.gpio:091]: Restore Mode: always ON
[13:52:40][C][switch.gpio:031]: Pin: GPIO4
[13:52:40][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Left Button'
[13:52:40][C][gpio.binary_sensor:016]: Pin: GPIO14
[13:52:40][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Right Button'
[13:52:40][C][gpio.binary_sensor:016]: Pin: GPIO27
[13:52:40][C][nspanel_lovelace:1250]: NSPanelLovelace:
[13:52:40][C][nspanel_lovelace:1251]: Version: 0.1.0 (beta)
[13:52:40][C][nspanel_lovelace:1255]: RAM: psram_used:2532 int_free:118564 int_free_blk:90112
[13:52:40][C][nspanel_lovelace:1259]: State: pages:10,stateful_items:21,entities:23
[13:52:40][C][homeassistant.time:010]: Home Assistant Time:
[13:52:40][C][homeassistant.time:011]: Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[13:52:40][C][psram:020]: PSRAM:
[13:52:40][C][psram:021]: Available: YES
[13:52:40][C][psram:024]: Size: 2047 KB
[13:52:40][C][esphome.ota:073]: Over-The-Air updates:
[13:52:40][C][esphome.ota:074]: Address: 192.168.178.88:3232
[13:52:40][C][esphome.ota:075]: Version: 2
[13:52:40][C][esphome.ota:078]: Password configured
[13:52:40][C][safe_mode:018]: Safe Mode:
[13:52:40][C][safe_mode:020]: Boot considered successful after 60 seconds
[13:52:40][C][safe_mode:021]: Invoke after 10 boot attempts
[13:52:40][C][safe_mode:023]: Remain in safe mode for 300 seconds
[13:52:40][C][api:139]: API Server:
[13:52:40][C][api:140]: Address: 192.168.178.88:6053
[13:52:40][C][api:144]: Using noise encryption: NO
[13:52:52][D][api:102]: Accepted 192.168.178.57
[13:52:52][D][api.connection:1389]: Home Assistant 2024.9.1 (192.168.178.57): Connected successfully
[13:52:52][D][nspanel_lovelace:1290]: TFT CMD OUT: date~Saturday, 14. September 2024
[13:52:53][D][nspanel_lovelace:1290]: TFT CMD OUT: time~13:52
[13:52:53][D][nspanel_lovelace:1290]: TFT CMD OUT: weatherUpdate~~~~63878~~0.0°C~~~~63878~~0.0°C~~~~63878~~0.0°C~~~~63878~~0.0°C~~~~63878~~0.0°C
WARNING nspanel-wohnzimmer-e7d47c @ 192.168.178.88: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for nspanel-wohnzimmer-e7d47c @ 192.168.178.88
WARNING Disconnected from API
INFO Successfully connected to nspanel-wohnzimmer-e7d47c @ 192.168.178.88 in 0.005s
INFO Successful handshake with nspanel-wohnzimmer-e7d47c @ 192.168.178.88 in 0.018s
[13:53:20][D][nspanel_lovelace:1290]: TFT CMD OUT: time~13:53
[13:53:21][D][nspanel_lovelace:538]: TFT CMD IN: event,buttonPress2,uuid.17,button
[13:53:21][D][nspanel_lovelace:1290]: TFT CMD OUT: pageType~cardGrid
[13:53:21][D][nspanel_lovelace:538]: TFT CMD IN: event,renderCurrentPage
[13:53:21][D][nspanel_lovelace:1290]: TFT CMD OUT: timeout~5
[13:53:21][D][nspanel_lovelace:1290]: TFT CMD OUT: entityUpd~Φωτισμός~button~navigate.uuid.1~~65535~~~delete~~~~~~light~uuid.21~~38066~~~light~uuid.22~~38066~~~light~uuid.23~~38066~~~light~uuid.24~~38066~~~light~uuid.25~~38066~~~light~uuid.26~~38066~~
[13:53:22][D][nspanel_lovelace:538]: TFT CMD IN: event,buttonPress2,uuid.21,button
[13:53:22][D][nspanel_lovelace:2084]: Call HA: light.toggle
[13:53:25][D][nspanel_lovelace:538]: TFT CMD IN: event,buttonPress2,uuid.21,button
[13:53:25][D][nspanel_lovelace:1554]: Button press delayed: uuid.21,button,
[13:53:25][D][nspanel_lovelace:2084]: Call HA: light.toggle
[13:53:26][D][nspanel_lovelace:538]: TFT CMD IN: event,buttonPress2,uuid.21,button
[13:53:26][D][nspanel_lovelace:2084]: Call HA: light.toggle
[13:53:30][D][nspanel_lovelace:538]: TFT CMD IN: event,sleepReached,cardGrid
[13:53:30][D][nspanel_lovelace:1290]: TFT CMD OUT: pageType~screensaver
[13:53:30][D][nspanel_lovelace:538]: TFT CMD IN: event,renderCurrentPage
[13:53:30][D][nspanel_lovelace:1290]: TFT CMD OUT: timeout~20
[13:53:30][D][nspanel_lovelace:1290]: TFT CMD OUT: weatherUpdate~~~~63878~~0.0°C~~~~63878~~0.0°C~~~~63878~~0.0°C~~~~63878~~0.0°C~~~~63878~~0.0°C
[13:53:32][D][api:102]: Accepted 192.168.178.57
[13:53:33][D][api.connection:1389]: Home Assistant 2024.9.1 (192.168.178.57): Connected successfully
[13:53:33][D][nspanel_lovelace:1290]: TFT CMD OUT: date~Saturday, 14. September 2024
[13:53:33][D][nspanel_lovelace:1290]: TFT CMD OUT: time~13:53
[13:53:33][D][nspanel_lovelace:1290]: TFT CMD OUT: weatherUpdate~~~~63878~~0.0°C~~~~63878~~0.0°C~~~~63878~~0.0°C~~~~63878~~0.0°C~~~~63878~~0.0°C
WARNING nspanel-wohnzimmer-e7d47c @ 192.168.178.88: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for nspanel-wohnzimmer-e7d47c @ 192.168.178.88
WARNING Disconnected from API
INFO Successfully connected to nspanel-wohnzimmer-e7d47c @ 192.168.178.88 in 0.005s
INFO Successful handshake with nspanel-wohnzimmer-e7d47c @ 192.168.178.88 in 0.016s
[13:54:14][D][nspanel_lovelace:1290]: TFT CMD OUT: time~13:54
[13:54:43][D][api:102]: Accepted 192.168.178.57
[13:54:43][D][api.connection:1389]: Home Assistant 2024.9.1 (192.168.178.57): Connected successfully
[13:54:43][D][nspanel_lovelace:1290]: TFT CMD OUT: date~Saturday, 14. September 2024
[13:54:43][D][nspanel_lovelace:1290]: TFT CMD OUT: time~13:54
WARNING nspanel-wohnzimmer-e7d47c @ 192.168.178.88: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for nspanel-wohnzimmer-e7d47c @ 192.168.178.88
WARNING Disconnected from API
INFO Successfully connected to nspanel-wohnzimmer-e7d47c @ 192.168.178.88 in 0.004s
INFO Successful handshake with nspanel-wohnzimmer-e7d47c @ 192.168.178.88 in 0.019s
[13:55:14][D][nspanel_lovelace:1290]: TFT CMD OUT: time~13:55
Firstly I just want to thank you for this one-man wonderlful project. Do you plan supporting more entities like:
number
,input_number
,button
,lock
and eventually something tricky likeinput_text
?