mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-10-14 08:35:12 +02:00
mcu-nspanel-*: migrate to native nspanel_lovelace component
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:
1 parent
6a40e65a4b
commit
6348e6bbb6
6 files changed
+607
-733
No files matched your search
+160
-122
@@ -4,9 +4,6 @@ substitutions:
|
||||
name: Patio NSPanel
|
||||
area: Living Room & Kitchen
|
||||
comment: ${area}, Patio | NSPanel
|
||||
panel_recv_topic: "tele/${device}/RESULT"
|
||||
panel_send_topic: "cmnd/${device}/CustomSend"
|
||||
tft_url: !secret tft_url
|
||||
|
||||
esphome:
|
||||
name: mcu-${device}
|
||||
@@ -18,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
|
||||
@@ -31,15 +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
|
||||
homeassistant_services: true
|
||||
homeassistant_states: true
|
||||
actions:
|
||||
- action: play_rtttl
|
||||
variables:
|
||||
@@ -54,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:
|
||||
@@ -166,19 +77,142 @@ 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_living_room_kitchen_temperature
|
||||
icon:
|
||||
value: home-thermometer-outline
|
||||
color: [255, 255, 255]
|
||||
precision: 1
|
||||
cards:
|
||||
- type: cardGrid
|
||||
title: Kuchyňa / Obývačka
|
||||
entities:
|
||||
- name: Kuchyňa / Obývačka
|
||||
entity_id: light.kitchen
|
||||
icon: ceiling-light
|
||||
- name: Stôl
|
||||
entity_id: light.dining_table
|
||||
icon: ceiling-light
|
||||
- name: Gauč
|
||||
entity_id: light.living_room
|
||||
icon: ceiling-light
|
||||
- name: TV
|
||||
entity_id: light.mcu_tv_light_strip
|
||||
icon: led-strip-variant
|
||||
- name: (Stôl)
|
||||
entity_id: light.dining_table_ambilight
|
||||
icon: ceiling-light-multiple-outline
|
||||
- name: (Gauč)
|
||||
entity_id: light.living_room_ambilight
|
||||
icon: ceiling-light-multiple-outline
|
||||
|
||||
- type: cardGrid
|
||||
title: Kuchyňa
|
||||
entities:
|
||||
- name: Linka
|
||||
entity_id: light.worktop_lights
|
||||
icon: countertop
|
||||
- name: Sporák
|
||||
entity_id: light.mcu_kitchen_stove
|
||||
icon: stove
|
||||
|
||||
- type: cardGrid
|
||||
title: Von
|
||||
entities:
|
||||
- name: Terasa
|
||||
entity_id: light.patio_lights
|
||||
icon: lightbulb-group
|
||||
- name: Terasa
|
||||
entity_id: switch.mcu_patio_relay
|
||||
icon: power-socket-fr
|
||||
- name: Vzadu
|
||||
entity_id: switch.mcu_nspanel_patio_outside_light_back
|
||||
icon: light-flood-down
|
||||
- name: Z. domček
|
||||
entity_id: switch.mcu_shed_light
|
||||
icon: wall-sconce-flat
|
||||
# state_template: '{{ is_state("binary_sensor.shed_status", "off") }}'
|
||||
- name: Z. domček
|
||||
entity_id: switch.mcu_shed_socket
|
||||
icon: power-socket-fr
|
||||
# state_template: '{{ is_state("binary_sensor.shed_status", "off") }}'
|
||||
- name: Záhrada
|
||||
entity_id: switch.mcu_shed_garden_light
|
||||
icon: light-flood-down
|
||||
# state_template: '{{ is_state("binary_sensor.shed_status", "off") }}'
|
||||
|
||||
- type: cardGrid
|
||||
title: Závlaha
|
||||
entities:
|
||||
- name: A1
|
||||
entity_id: switch.mcu_well_irrigation_valve_a1
|
||||
icon: valve
|
||||
- name: A2
|
||||
entity_id: switch.mcu_well_irrigation_valve_a2
|
||||
icon: valve
|
||||
- name: A3
|
||||
entity_id: switch.mcu_well_irrigation_valve_a3
|
||||
icon: valve
|
||||
- name: A4
|
||||
entity_id: switch.mcu_well_irrigation_valve_a4
|
||||
icon: valve
|
||||
- name: A5
|
||||
entity_id: switch.mcu_well_irrigation_valve_a5
|
||||
icon: valve
|
||||
- name: Automatizácia
|
||||
entity_id: navigate.card_irrigation_automation
|
||||
|
||||
- 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_living_room_kitchen
|
||||
|
||||
- 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
|
||||
|
||||
- type: cardEntities
|
||||
title: Automatizácia
|
||||
id: card_irrigation_automation
|
||||
hidden: true
|
||||
entities:
|
||||
- name: Ráno
|
||||
entity_id: automation.irrigation_morning
|
||||
- name: Terasa
|
||||
entity_id: automation.irrigation_patio
|
||||
- name: Rast trávy
|
||||
entity_id: automation.irrigation_grow_grass
|
||||
|
||||
time:
|
||||
- platform: homeassistant
|
||||
@@ -193,10 +227,9 @@ binary_sensor:
|
||||
inverted: true
|
||||
on_click:
|
||||
- switch.toggle: relay_1
|
||||
- mqtt.publish_json:
|
||||
topic: $panel_recv_topic
|
||||
payload: |-
|
||||
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
|
||||
- lambda: 'id(nspanel_id).render_default_page();'
|
||||
- lambda: 'id(nspanel_id).render_next_page();'
|
||||
- lambda: 'id(nspanel_id).render_next_page();'
|
||||
|
||||
- platform: gpio
|
||||
name: Right Button
|
||||
@@ -212,10 +245,9 @@ binary_sensor:
|
||||
action: light.toggle
|
||||
data:
|
||||
entity_id: light.patio_lights
|
||||
- mqtt.publish_json:
|
||||
topic: $panel_recv_topic
|
||||
payload: |-
|
||||
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
|
||||
- lambda: 'id(nspanel_id).render_default_page();'
|
||||
- lambda: 'id(nspanel_id).render_next_page();'
|
||||
- lambda: 'id(nspanel_id).render_next_page();'
|
||||
else:
|
||||
- switch.toggle: relay_2
|
||||
|
||||
@@ -267,13 +299,19 @@ sensor:
|
||||
resistor: 11.2kOhm
|
||||
|
||||
- platform: ntc
|
||||
name: Living Room Temperature
|
||||
id: temperature
|
||||
sensor: resistance_sensor
|
||||
calibration:
|
||||
b_constant: 3950
|
||||
reference_temperature: 25°C
|
||||
reference_resistance: 10kOhm
|
||||
name: Living Room Temperature
|
||||
|
||||
- platform: template
|
||||
id: room_temperature_id
|
||||
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();
|
||||
Reference in new issue
Block a user