mcu-nspanel-*: migrate to native nspanel_lovelace component
CI / ESPHome config validation (push) Failing after 14s
CI / YAML lint (push) Failing after 32s

Switch all NSPanels from the MQTT + AppDaemon based
esphome-nspanel-lovelace-ui to the native component
(randybb/esphome-nspanel-lovelace-native, ref: devices).
Cards and screensaver are now configured directly in ESPHome,
removing the dependency on MQTT and AppDaemon.
This commit is contained in:
randy committed 2026-09-26 19:31:16 +02:00
1 parent 6a40e65a4b
commit 6348e6bbb6
6 files changed
+607 -733

No files matched your search

+79 -157
View File
@@ -4,10 +4,6 @@ substitutions:
name: Office J NSPanel
area: Office J
comment: NSPanel
panel_recv_topic: "tele/${device}/RESULT"
panel_send_topic: "cmnd/${device}/CustomSend"
tft_url: !secret tft_url
esphome:
name: mcu-${device}
@@ -19,6 +15,8 @@ esphome:
- switch.turn_off: screen_power
- delay: 1s
- switch.turn_on: screen_power
- delay: 2s
- lambda: 'id(nspanel_id).set_display_dim(5, 80);'
esp32:
variant: esp32
@@ -32,20 +30,17 @@ esp32:
external_components:
- source:
type: git
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
ref: dev
url: https://github.com/randybb/esphome-nspanel-lovelace-native
ref: devices
refresh: 0s
components: [nspanel_lovelace]
packages:
common: !include common/common.yaml
api:
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
#
# stupnovane:d=4,o=6,b=180:c,e,g
# help:d=4,o=6,b=100:f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f
# gate_opening:d=16,o=5,b=160:a, 8p, a
# fireplace_attention:d=16,o=5,b=160:a, 8p, g, 16p, c
homeassistant_services: true
homeassistant_states: true
actions:
- action: play_rtttl
variables:
@@ -60,110 +55,20 @@ api:
message: string
song: string
then:
- lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);'
- lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);'
- rtttl.play:
rtttl: !lambda 'return song;'
- delay: 10s
- lambda: 'id(nspanel_id).send_custom_command("notify~~");'
- action: update_tft
then:
- lambda: |-
id(nspanel_id).upload_tft("${tft_url}");
- action: upload_tft
variables:
url: string
then:
- lambda: |-
id(nspanel_id).upload_tft(url);
# Service to send a command directly to the display. Useful for testing
- action: send_command
variables:
cmd: string
then:
- lambda: "id(nspanel_id).send_custom_command(cmd.c_str());"
# Service to pusblish to mqtt used for refreshin the panel
- action: publish_to_recv_topic
variables:
cmd: string
then:
- mqtt.publish:
topic: $panel_recv_topic
payload: !lambda "return cmd;"
# Service to send a command wake the screen
- action: wake
then:
- lambda: 'id(nspanel_id).send_custom_command("wake");'
# Service to send a command to show screensaver (some of the values are hardcoded)
- action: show_screensaver
then:
- mqtt.publish:
topic: $panel_recv_topic
payload: '{"CustomRecv":"event,sleepReached,cardGrid"}'
# Service to navigate to screen
- action: navigate_to_page
variables:
page: string
then:
- mqtt.publish_json:
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate." + page + ",button";
# Service to send a command disable screensaver
- action: disable_screensaver
then:
- lambda: 'id(nspanel_id).send_custom_command("timeout~0");'
# Service to send a command enabled screensaver
- action: enable_screensaver
then:
- lambda: 'id(nspanel_id).send_custom_command("timeout~20");'
# Service to send a command wake the screen
- action: dim_0_to_100
variables:
intensity: string
then:
- lambda: 'id(nspanel_id).send_custom_command("dimmode~"+intensity+"~100");'
# Service to send a command To show the screen of a specific like
- action: show_entity
variables:
entity: string
title: string
then:
- lambda: 'id(nspanel_id).send_custom_command("pageType~popupLight~" + title + "~" + entity);'
# Service to send a command To show the screen of a specific like
- action: notify_on_screensaver
variables:
line1: string
line2: string
then:
- lambda: 'id(nspanel_id).send_custom_command("notify~" + line1 + "~" + line2);'
- rtttl.play: "short:d=4,o=5,b=100:16e6"
# Service to send a command To show the screen of a specific like
# interaction of the buttons are on implemented yet
- action: notify_fullscreen
variables:
title: string
description: string
button1: string
button2: string
time_secs: string
timeout: int
icon: string
then:
# show notification screen
- lambda: 'id(nspanel_id).send_custom_command("pageType~popupNotify");'
# set values on notification screen
# color defined as number created in binary and converted to decimal (rrrrggggbbbbaaaa)
- lambda: 'id(nspanel_id).send_custom_command("entityUpdateDetail~id~"+ title + "~65535~" + button1 +"~3840~" + button2 + "~61440~" + description + "~65535~" + time_secs);'
- lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);'
- rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b"
uart:
@@ -172,19 +77,62 @@ uart:
rx_pin: 17
baud_rate: 115200
mqtt:
id: mqtt_client
broker: !secret mqtt_ip
username: !secret mqtt_username
password: !secret mqtt_password
discovery: false
idf_send_async: true
reboot_timeout: 0s
nspanel_lovelace:
id: nspanel_id
mqtt_recv_topic: $panel_recv_topic
mqtt_send_topic: $panel_send_topic
sleep_timeout: 10
experimental_vertical_ui: true
locale:
language: sk
temperature_unit: celcius
screensaver:
time_id: ha_time
time_format: '%H:%M'
date_format: '%A, %d. %b. %Y'
weather:
entity_id: sensor.weather_forecast_daily
icon_color: [255, 255, 255]
entities:
- entity_id: sensor.zigbee_office_j_temperature
icon:
value: home-thermometer-outline
color: [255, 255, 255]
precision: 1
cards:
- type: cardGrid
title: Janko
entities:
- name: Svetlo
entity_id: light.mcu_nspanel_office_j_light
icon: wall-sconce-flat
- name: Nočná lampa
entity_id: light.bedside_left
icon: lamp
- type: cardGrid
title: Brána
entities:
- name: Otvoriť
entity_id: button.mcu_gate_open
icon: gate-open
- name: Zatvoriť
entity_id: button.mcu_gate_close
icon: gate
- name: Automatizácia
entity_id: navigate.card_gate_automation
- type: cardThermo
title: Kúrenie
thermo_entity_id: climate.bt_trv_office_j
- type: cardEntities
title: Automatizácia
id: card_gate_automation
hidden: true
entities:
- name: Auto-otváranie
entity_id: switch.gate_auto_open
- name: Auto-zatváranie
entity_id: switch.gate_auto_close
time:
- platform: homeassistant
@@ -192,26 +140,6 @@ time:
timezone: Europe/Bratislava
binary_sensor:
# - platform: gpio
# name: Left Button
# pin:
# number: 14
# inverted: true
# on_click:
# - switch.toggle: relay_1
# - platform: gpio
# name: Right Button
# pin:
# number: 27
# inverted: true
# # on_click:
# # - switch.toggle: relay_2
# on_click:
# - homeassistant.service:
# service: light.toggle
# data:
# entity_id: light.office_r_desk_strip
- platform: gpio
name: Left Button
pin:
@@ -219,10 +147,7 @@ binary_sensor:
inverted: true
on_click:
- light.toggle: light_1
- mqtt.publish_json:
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
- lambda: 'id(nspanel_id).render_default_page();'
- platform: gpio
name: Right Button
@@ -234,16 +159,14 @@ binary_sensor:
action: light.toggle
data:
entity_id: light.bedside_left
- mqtt.publish_json:
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
- lambda: 'id(nspanel_id).render_default_page();'
output:
- platform: ledc
id: buzzer_out
pin:
number: 21
- id: relay_1
platform: gpio
pin:
@@ -283,28 +206,27 @@ sensor:
pin: 38
update_interval: 5min
attenuation: 12db
- platform: resistance
id: resistance_sensor
sensor: ntc_source
configuration: DOWNSTREAM
resistor: 11.2kOhm
- platform: ntc
name: Temperature
id: temperature
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 22°C
reference_resistance: 10kOhm
name: Temperature
- platform: template
id: room_temperature_id
# esp32_ble_tracker:
# text_sensor:
# - platform: ble_scanner
# name: BLE Scanner
# esp32_ble_beacon:
# type: iBeacon
# uuid: '6d68252f-2e6f-b5b9-965f-43c0a3713880'
text_sensor:
- platform: homeassistant
id: name_day
entity_id: sensor.nameday_sk
on_value:
- lambda: |-
id(nspanel_id).set_time_format("%H:%M~" + x);
id(nspanel_id).update_time();