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
+606 -732

No files matched your search

+98 -123
View File
@@ -5,10 +5,6 @@ substitutions:
name_short: Bedroom name_short: Bedroom
area: Bedroom area: Bedroom
comment: NSPanel comment: NSPanel
panel_recv_topic: "tele/${device}/RESULT"
panel_send_topic: "cmnd/${device}/CustomSend"
tft_url: !secret tft_url
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -20,6 +16,8 @@ esphome:
- switch.turn_off: screen_power - switch.turn_off: screen_power
- delay: 1s - delay: 1s
- switch.turn_on: screen_power - switch.turn_on: screen_power
- delay: 2s
- lambda: 'id(nspanel_id).set_display_dim(5, 80);'
esp32: esp32:
variant: esp32 variant: esp32
@@ -33,15 +31,27 @@ esp32:
external_components: external_components:
- source: - source:
type: git type: git
url: https://github.com/sairon/esphome-nspanel-lovelace-ui url: https://github.com/randybb/esphome-nspanel-lovelace-native
ref: dev ref: devices
refresh: 0s
components: [nspanel_lovelace] components: [nspanel_lovelace]
packages: packages:
common: !include common/common.yaml common: !include common/common.yaml
script:
- id: apply_sleep_dim
then:
- lambda: |-
uint8_t dim;
if (id(bedroom_lights).state) dim = 5; // sleepOverride
else if (id(sun_id).is_above_horizon(-6)) dim = 5; // day
else dim = 0; // night
id(nspanel_id).set_display_inactive_dim(dim);
api: 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: actions:
- action: play_rtttl - action: play_rtttl
variables: variables:
@@ -56,110 +66,20 @@ api:
message: string message: string
song: string song: string
then: then:
- lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);'
- rtttl.play: - rtttl.play:
rtttl: !lambda 'return song;' 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 - action: notify_fullscreen
variables: variables:
title: string title: string
description: string description: string
button1: string button1: string
button2: string button2: string
time_secs: string timeout: int
icon: string
then: then:
# show notification screen - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);'
- 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);'
- rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b"
uart: uart:
@@ -168,24 +88,59 @@ uart:
rx_pin: 17 rx_pin: 17
baud_rate: 115200 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: nspanel_lovelace:
id: nspanel_id id: nspanel_id
mqtt_recv_topic: $panel_recv_topic sleep_timeout: 10
mqtt_send_topic: $panel_send_topic 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_bedroom_temperature
icon:
value: home-thermometer-outline
color: [255, 255, 255]
precision: 1
cards:
- type: cardGrid
title: Spálňa
entities:
- name: TV
entity_id: switch.mcu_socket_01_relay
icon: television-classic
- name: Raid
entity_id: switch.mcu_socket_02_relay
icon: emoticon-dead
- name: ""
entity_id: switch.mcu_socket_03_relay
icon: power-socket-fr
- name: Svetlo
entity_id: light.mcu_nspanel_bedroom_light
icon: wall-sconce-flat
- name: Nočná lampa J
entity_id: light.mcu_bedroom_lamp_right_light
icon: lamp
- name: Nočná lampa R
entity_id: light.mcu_bedroom_lamp_left_light
icon: lamp
- type: cardThermo
title: Kúrenie
thermo_entity_id: climate.bt_trv_bedroom
time: time:
- platform: homeassistant - platform: homeassistant
id: ha_time id: ha_time
timezone: Europe/Bratislava timezone: Europe/Bratislava
on_time_sync:
- script.execute: apply_sleep_dim
binary_sensor: binary_sensor:
- platform: gpio - platform: gpio
@@ -195,10 +150,7 @@ binary_sensor:
inverted: true inverted: true
on_click: on_click:
- light.toggle: light_1 - light.toggle: light_1
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
- platform: gpio - platform: gpio
name: Right Button name: Right Button
@@ -212,10 +164,13 @@ binary_sensor:
action: light.toggle action: light.toggle
data: data:
entity_id: light.bedroom_lamps entity_id: light.bedroom_lamps
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic
payload: |- - platform: homeassistant # sleepOverride
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; id: bedroom_lights
entity_id: light.bedroom_lights
on_state:
- script.execute: apply_sleep_dim
light: light:
- platform: binary - platform: binary
@@ -237,6 +192,20 @@ output:
# pin: # pin:
# number: 19 # number: 19
sun:
id: sun_id
time_id: ha_time
latitude: 48.15°
longitude: 17.11°
on_sunrise:
- elevation: -6°
then:
- script.execute: apply_sleep_dim
on_sunset:
- elevation: -6°
then:
- script.execute: apply_sleep_dim
switch: switch:
- platform: gpio - platform: gpio
name: Screen Power name: Screen Power
@@ -265,13 +234,19 @@ sensor:
resistor: 11.2kOhm resistor: 11.2kOhm
- platform: ntc - platform: ntc
name: Temperature
id: temperature id: temperature
sensor: resistance_sensor sensor: resistance_sensor
calibration: calibration:
b_constant: 3950 b_constant: 3950
reference_temperature: 25°C reference_temperature: 25°C
reference_resistance: 10kOhm reference_resistance: 10kOhm
name: Temperature
- platform: template text_sensor:
id: room_temperature_id - 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();
+53 -30
View File
@@ -39,8 +39,6 @@ esp32:
advanced: advanced:
minimum_chip_revision: 3.0 minimum_chip_revision: 3.0
sram1_as_iram: true sram1_as_iram: true
include_builtin_idf_components:
- esp_http_client
external_components: external_components:
# - source: # - source:
@@ -51,8 +49,10 @@ external_components:
# components: [nspanel_lovelace] # components: [nspanel_lovelace]
- source: - source:
type: git type: git
url: https://github.com/olicooper/esphome-nspanel-lovelace-native # url: https://github.com/olicooper/esphome-nspanel-lovelace-native
ref: dev # ref: dev
url: https://github.com/randybb/esphome-nspanel-lovelace-native
ref: devices
refresh: 0s refresh: 0s
components: [nspanel_lovelace] components: [nspanel_lovelace]
# - source: components # - source: components
@@ -84,7 +84,6 @@ api:
song: string song: string
then: then:
- lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);' - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);'
# - lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);'
- rtttl.play: - rtttl.play:
rtttl: !lambda 'return song;' rtttl: !lambda 'return song;'
# - delay: 10s # - delay: 10s
@@ -203,15 +202,37 @@ uart:
nspanel_lovelace: nspanel_lovelace:
id: nspanel_id id: nspanel_id
sleep_timeout: 10 sleep_timeout: 10
experimental_vertical_ui: true
locale: locale:
language: sk language: sk
temperature_unit: celcius temperature_unit: celcius
screensaver: screensaver:
time_id: ha_time time_id: ha_time
time_format: '%H:%M~$name_day' time_format: '%H:%M'
date_format: '%A, %d. %b. %Y' date_format: '%A, %d. %b. %Y'
weather: weather:
entity_id: sensor.weather_forecast_daily entity_id: sensor.weather_forecast_daily
# entity_id: weather.openweathermap
# forecast_method: service
icon_color: [255, 255, 255]
entities:
- entity_id: sensor.zigbee_office_r_temperature
icon:
value: home-thermometer-outline
color: [255, 255, 255]
precision: 1
# type: screensaver2
## Custom entities, filled into the layout slots in order after the weather items.
## Use 'entity_id: delete' to leave a slot empty.
## screensaver: weather main + 4 forecast items, 1 extra entity switches to the alternative layout (max 6 items)
## screensaver2: weather main only, then 3 left + 6 bottom + 5 indicator icons (max 15 items)
# entities:
# - entity_id: sensor.outside_humidity
# name: Humidity
# icon: water-percent
# - entity_id: delete
# - entity_id: binary_sensor.front_door
# type: screensaver2 # type: screensaver2
# statusIcon1: # statusIcon1:
# entity: switch.office_r_light # entity: switch.office_r_light
@@ -281,7 +302,7 @@ nspanel_lovelace:
entity_id: light.living_room entity_id: light.living_room
icon: ceiling-light icon: ceiling-light
- name: TV - name: TV
entity_id: light.tv_light entity_id: light.mcu_tv_light_light
icon: led-strip-variant icon: led-strip-variant
- name: (Stôl) - name: (Stôl)
entity_id: light.dining_table_ambilight entity_id: light.dining_table_ambilight
@@ -293,7 +314,7 @@ nspanel_lovelace:
title: Romanko title: Romanko
entities: entities:
- name: Svetlo - name: Svetlo
entity_id: switch.office_r_light entity_id: light.mcu_nspanel_office_r_light
icon: wall-sconce-flat icon: wall-sconce-flat
- name: LED pásik - name: LED pásik
entity_id: light.office_r_desk_strip entity_id: light.office_r_desk_strip
@@ -305,40 +326,38 @@ nspanel_lovelace:
- name: (Monitor) - name: (Monitor)
entity_id: light.office_r_display_lamp_ambilight entity_id: light.office_r_display_lamp_ambilight
icon: monitor-star icon: monitor-star
- name: Whitebox
entity_id: switch.whitebox
- type: cardGrid - type: cardGrid
title: Von title: Von
entities: entities:
- name: Terasa - name: Terasa
entity_id: light.patio_light entity_id: light.patio_lights
icon: lightbulb-group icon: lightbulb-group
- name: Terasa - name: Terasa
entity_id: switch.patio_relay entity_id: switch.mcu_patio_relay
icon: power-socket-fr icon: power-socket-fr
- name: Vzadu - name: Vzadu
entity_id: switch.outside_light_back entity_id: switch.mcu_nspanel_patio_outside_light_back
icon: light-flood-down icon: light-flood-down
- name: Z. domček - name: Z. domček
entity_id: switch.shed_light entity_id: switch.mcu_shed_light
icon: wall-sconce-flat icon: wall-sconce-flat
# state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}'
- name: Z. domček - name: Z. domček
entity_id: switch.shed_socket entity_id: switch.mcu_shed_socket
icon: power-socket-fr icon: power-socket-fr
# state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}'
- name: Záhrada - name: Záhrada
entity_id: switch.garden_light entity_id: switch.mcu_shed_garden_light
icon: light-flood-down icon: light-flood-down
# state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}'
- type: cardGrid - type: cardGrid
title: Brána title: Brána
entities: entities:
- name: Otvoriť - name: Otvoriť
entity_id: button.gate_open entity_id: button.mcu_gate_open
icon: gate-open icon: gate-open
- name: Zatvoriť - name: Zatvoriť
entity_id: button.gate_close entity_id: button.mcu_gate_close
icon: gate icon: gate
- name: Automatizácia - name: Automatizácia
entity_id: navigate.card_gate_automation entity_id: navigate.card_gate_automation
@@ -346,19 +365,19 @@ nspanel_lovelace:
title: Závlaha title: Závlaha
entities: entities:
- name: A1 - name: A1
entity_id: switch.irrigation_valve_a1 entity_id: switch.mcu_well_irrigation_valve_a1
icon: valve icon: valve
- name: A2 - name: A2
entity_id: switch.irrigation_valve_a2 entity_id: switch.mcu_well_irrigation_valve_a2
icon: valve icon: valve
- name: A3 - name: A3
entity_id: switch.irrigation_valve_a3 entity_id: switch.mcu_well_irrigation_valve_a3
icon: valve icon: valve
- name: A4 - name: A4
entity_id: switch.irrigation_valve_a4 entity_id: switch.mcu_well_irrigation_valve_a4
icon: valve icon: valve
- name: A5 - name: A5
entity_id: switch.irrigation_valve_a5 entity_id: switch.mcu_well_irrigation_valve_a5
icon: valve icon: valve
- name: Automatizácia - name: Automatizácia
entity_id: navigate.card_irrigation_automation entity_id: navigate.card_irrigation_automation
@@ -381,13 +400,13 @@ nspanel_lovelace:
title: Zwift title: Zwift
entities: entities:
- name: Svetlo - name: Svetlo
entity_id: light.basement_light entity_id: light.mcu_basement_light
icon: lightbulb-multiple icon: lightbulb-multiple
- name: LED - name: LED
entity_id: light.exercise_room entity_id: light.exercise_room
icon: led-strip-variant icon: led-strip-variant
- name: Ventilátor - name: Ventilátor
entity_id: light.exercise_room_fan entity_id: light.mcu_dimmer_exercise_room_fan
icon: fan icon: fan
- name: Automatizácia - name: Automatizácia
entity_id: navigate.card_exercise_automation entity_id: navigate.card_exercise_automation
@@ -421,11 +440,6 @@ nspanel_lovelace:
- name: Rast trávy - name: Rast trávy
entity_id: automation.irrigation_grow_grass entity_id: automation.irrigation_grow_grass
time:
- platform: homeassistant
id: ha_time
timezone: Europe/Bratislava
binary_sensor: binary_sensor:
- platform: gpio - platform: gpio
name: Left Button name: Left Button
@@ -526,10 +540,19 @@ sensor:
- platform: template - platform: template
id: room_temperature_id id: room_temperature_id
time:
platform: homeassistant
id: ha_time
timezone: Europe/Bratislava
text_sensor: text_sensor:
- platform: homeassistant - platform: homeassistant
id: name_day id: name_day
entity_id: sensor.nameday_sk entity_id: sensor.nameday_sk
on_value:
- lambda: |-
id(nspanel_id).set_time_format("%H:%M~" + x);
id(nspanel_id).update_time();
# esp32_ble_tracker: # esp32_ble_tracker:
# scan_parameters: # scan_parameters:
+131 -130
View File
@@ -4,9 +4,6 @@ substitutions:
name: Fireplace NSPanel name: Fireplace NSPanel
area: Living Room & Kitchen area: Living Room & Kitchen
comment: NSPanel comment: NSPanel
panel_recv_topic: "tele/${device}/RESULT"
panel_send_topic: "cmnd/${device}/CustomSend"
tft_url: !secret tft_url
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -18,6 +15,8 @@ esphome:
- switch.turn_off: screen_power - switch.turn_off: screen_power
- delay: 1s - delay: 1s
- switch.turn_on: screen_power - switch.turn_on: screen_power
- delay: 2s
- lambda: 'id(nspanel_id).set_display_dim(5, 80);'
esp32: esp32:
variant: esp32 variant: esp32
@@ -31,15 +30,17 @@ esp32:
external_components: external_components:
- source: - source:
type: git type: git
url: https://github.com/sairon/esphome-nspanel-lovelace-ui url: https://github.com/randybb/esphome-nspanel-lovelace-native
ref: dev ref: devices
refresh: 0s
components: [nspanel_lovelace] components: [nspanel_lovelace]
packages: packages:
common: !include common/common.yaml common: !include common/common.yaml
api: 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: actions:
- action: play_rtttl - action: play_rtttl
variables: variables:
@@ -54,110 +55,20 @@ api:
message: string message: string
song: string song: string
then: then:
- lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);'
- rtttl.play: - rtttl.play:
rtttl: !lambda 'return song;' 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 - action: notify_fullscreen
variables: variables:
title: string title: string
description: string description: string
button1: string button1: string
button2: string button2: string
time_secs: string timeout: int
icon: string
then: then:
# show notification screen - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);'
- 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);'
- rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b"
uart: uart:
@@ -166,19 +77,113 @@ uart:
rx_pin: 17 rx_pin: 17
baud_rate: 115200 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: nspanel_lovelace:
id: nspanel_id id: nspanel_id
mqtt_recv_topic: $panel_recv_topic sleep_timeout: 10
mqtt_send_topic: $panel_send_topic 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: 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: cardThermo
title: Kúrenie - Izba
thermo_entity_id: climate.bt_trv_room
- 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: time:
- platform: homeassistant - platform: homeassistant
@@ -200,10 +205,7 @@ binary_sensor:
action: light.toggle action: light.toggle
data: data:
entity_id: light.living_room entity_id: light.living_room
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
- min_length: 500ms - min_length: 500ms
max_length: 2000ms max_length: 2000ms
then: then:
@@ -211,10 +213,8 @@ binary_sensor:
action: light.toggle action: light.toggle
data: data:
entity_id: light.worktop_lights entity_id: light.worktop_lights
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic - lambda: 'id(nspanel_id).render_next_page();'
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_kitchen,button";
- platform: gpio - platform: gpio
name: Right Button name: Right Button
@@ -230,10 +230,7 @@ binary_sensor:
action: light.toggle action: light.toggle
data: data:
entity_id: light.dining_table entity_id: light.dining_table
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
- min_length: 500ms - min_length: 500ms
max_length: 2000ms max_length: 2000ms
then: then:
@@ -241,10 +238,8 @@ binary_sensor:
action: light.toggle action: light.toggle
data: data:
entity_id: light.mcu_kitchen_stove entity_id: light.mcu_kitchen_stove
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic - lambda: 'id(nspanel_id).render_next_page();'
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_kitchen,button";
output: output:
- platform: ledc - platform: ledc
id: buzzer_out id: buzzer_out
@@ -292,13 +287,19 @@ sensor:
resistor: 11.2kOhm resistor: 11.2kOhm
- platform: ntc - platform: ntc
name: "Living Room Temperature"
id: temperature id: temperature
sensor: resistance_sensor sensor: resistance_sensor
calibration: calibration:
b_constant: 3950 b_constant: 3950
reference_temperature: 25°C reference_temperature: 25°C
reference_resistance: 10kOhm reference_resistance: 10kOhm
name: "Living Room Temperature"
- platform: template text_sensor:
id: room_temperature_id - 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();
+79 -157
View File
@@ -4,10 +4,6 @@ substitutions:
name: Office J NSPanel name: Office J NSPanel
area: Office J area: Office J
comment: NSPanel comment: NSPanel
panel_recv_topic: "tele/${device}/RESULT"
panel_send_topic: "cmnd/${device}/CustomSend"
tft_url: !secret tft_url
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -19,6 +15,8 @@ esphome:
- switch.turn_off: screen_power - switch.turn_off: screen_power
- delay: 1s - delay: 1s
- switch.turn_on: screen_power - switch.turn_on: screen_power
- delay: 2s
- lambda: 'id(nspanel_id).set_display_dim(5, 80);'
esp32: esp32:
variant: esp32 variant: esp32
@@ -32,20 +30,17 @@ esp32:
external_components: external_components:
- source: - source:
type: git type: git
url: https://github.com/sairon/esphome-nspanel-lovelace-ui url: https://github.com/randybb/esphome-nspanel-lovelace-native
ref: dev ref: devices
refresh: 0s
components: [nspanel_lovelace] components: [nspanel_lovelace]
packages: packages:
common: !include common/common.yaml common: !include common/common.yaml
api: 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
# 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
actions: actions:
- action: play_rtttl - action: play_rtttl
variables: variables:
@@ -60,110 +55,20 @@ api:
message: string message: string
song: string song: string
then: then:
- lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);'
- rtttl.play: - rtttl.play:
rtttl: !lambda 'return song;' 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 - action: notify_fullscreen
variables: variables:
title: string title: string
description: string description: string
button1: string button1: string
button2: string button2: string
time_secs: string timeout: int
icon: string
then: then:
# show notification screen - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);'
- 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);'
- rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b"
uart: uart:
@@ -172,19 +77,62 @@ uart:
rx_pin: 17 rx_pin: 17
baud_rate: 115200 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: nspanel_lovelace:
id: nspanel_id id: nspanel_id
mqtt_recv_topic: $panel_recv_topic sleep_timeout: 10
mqtt_send_topic: $panel_send_topic 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: time:
- platform: homeassistant - platform: homeassistant
@@ -192,26 +140,6 @@ time:
timezone: Europe/Bratislava timezone: Europe/Bratislava
binary_sensor: 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 - platform: gpio
name: Left Button name: Left Button
pin: pin:
@@ -219,10 +147,7 @@ binary_sensor:
inverted: true inverted: true
on_click: on_click:
- light.toggle: light_1 - light.toggle: light_1
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
- platform: gpio - platform: gpio
name: Right Button name: Right Button
@@ -234,16 +159,14 @@ binary_sensor:
action: light.toggle action: light.toggle
data: data:
entity_id: light.bedside_left entity_id: light.bedside_left
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
output: output:
- platform: ledc - platform: ledc
id: buzzer_out id: buzzer_out
pin: pin:
number: 21 number: 21
- id: relay_1 - id: relay_1
platform: gpio platform: gpio
pin: pin:
@@ -283,28 +206,27 @@ sensor:
pin: 38 pin: 38
update_interval: 5min update_interval: 5min
attenuation: 12db attenuation: 12db
- platform: resistance - platform: resistance
id: resistance_sensor id: resistance_sensor
sensor: ntc_source sensor: ntc_source
configuration: DOWNSTREAM configuration: DOWNSTREAM
resistor: 11.2kOhm resistor: 11.2kOhm
- platform: ntc - platform: ntc
name: Temperature
id: temperature id: temperature
sensor: resistance_sensor sensor: resistance_sensor
calibration: calibration:
b_constant: 3950 b_constant: 3950
reference_temperature: 22°C reference_temperature: 22°C
reference_resistance: 10kOhm reference_resistance: 10kOhm
name: Temperature
- platform: template
id: room_temperature_id
# esp32_ble_tracker: text_sensor:
- platform: homeassistant
# text_sensor: id: name_day
# - platform: ble_scanner entity_id: sensor.nameday_sk
# name: BLE Scanner on_value:
- lambda: |-
# esp32_ble_beacon: id(nspanel_id).set_time_format("%H:%M~" + x);
# type: iBeacon id(nspanel_id).update_time();
# uuid: '6d68252f-2e6f-b5b9-965f-43c0a3713880'
+85 -170
View File
@@ -4,10 +4,6 @@ substitutions:
name: Office R NSPanel name: Office R NSPanel
area: Office R area: Office R
comment: NSPanel comment: NSPanel
panel_recv_topic: "tele/${device}/RESULT"
panel_send_topic: "cmnd/${device}/CustomSend"
tft_url: !secret tft_url
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -19,6 +15,8 @@ esphome:
- switch.turn_off: screen_power - switch.turn_off: screen_power
- delay: 1s - delay: 1s
- switch.turn_on: screen_power - switch.turn_on: screen_power
- delay: 2s
- lambda: 'id(nspanel_id).set_display_dim(5, 80);'
esp32: esp32:
variant: esp32 variant: esp32
@@ -26,15 +24,15 @@ esp32:
framework: framework:
type: esp-idf type: esp-idf
advanced: advanced:
enable_lwip_mdns_queries: true
minimum_chip_revision: 3.0 minimum_chip_revision: 3.0
sram1_as_iram: true sram1_as_iram: true
external_components: external_components:
- source: - source:
type: git type: git
url: https://github.com/sairon/esphome-nspanel-lovelace-ui url: https://github.com/randybb/esphome-nspanel-lovelace-native
ref: dev ref: devices
refresh: 0s
components: [nspanel_lovelace] components: [nspanel_lovelace]
packages: packages:
@@ -58,12 +56,8 @@ script:
- script.execute: geiger_click - script.execute: geiger_click
api: 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
# 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
actions: actions:
- action: play_rtttl - action: play_rtttl
variables: variables:
@@ -78,111 +72,20 @@ api:
message: string message: string
song: string song: string
then: then:
- lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);'
- rtttl.play: - rtttl.play:
rtttl: !lambda 'return song;' rtttl: !lambda 'return song;'
- delay: 10s
- lambda: 'id(nspanel_id).send_custom_command("notify~~");'
- action: update_tft
then:
- logger.log: "tft updating from: ${tft_url}"
- 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 - action: notify_fullscreen
variables: variables:
title: string title: string
description: string description: string
button1: string button1: string
button2: string button2: string
time_secs: string timeout: int
icon: string
then: then:
# show notification screen - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);'
- 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);'
- rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b"
uart: uart:
@@ -191,19 +94,69 @@ uart:
rx_pin: 17 rx_pin: 17
baud_rate: 115200 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: nspanel_lovelace:
id: nspanel_id id: nspanel_id
mqtt_recv_topic: $panel_recv_topic sleep_timeout: 10
mqtt_send_topic: $panel_send_topic 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_r_temperature
icon:
value: home-thermometer-outline
color: [255, 255, 255]
precision: 1
cards:
- type: cardGrid
title: Romanko
entities:
- name: Svetlo
entity_id: light.mcu_nspanel_office_r_light
icon: wall-sconce-flat
- name: LED pásik
entity_id: light.office_r_desk_strip
icon: led-strip-variant
- entity_id: delete
- name: Monitor
entity_id: light.office_r_display_lamp
icon: monitor-star
- name: (Monitor)
entity_id: light.office_r_display_lamp_ambilight
icon: monitor-star
- 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_r
- 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: time:
- platform: homeassistant - platform: homeassistant
@@ -211,26 +164,6 @@ time:
timezone: Europe/Bratislava timezone: Europe/Bratislava
binary_sensor: 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 - platform: gpio
name: Left Button name: Left Button
pin: pin:
@@ -241,11 +174,7 @@ binary_sensor:
action: light.toggle action: light.toggle
data: data:
entity_id: light.office_r_desk_strip entity_id: light.office_r_desk_strip
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress1,navigate.cardGrid_main,button";
# - lambda: 'id(nspanel_id).send_custom_command("event,buttonPress1,navigate.cardGrid_main,button");'
- platform: gpio - platform: gpio
name: Right Button name: Right Button
@@ -254,11 +183,7 @@ binary_sensor:
inverted: true inverted: true
on_click: on_click:
- light.toggle: light_1 - light.toggle: light_1
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic
payload: |-
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
# - lambda: 'id(nspanel_id).send_custom_command("event,buttonPress2,navigate.cardGrid_main,button");'
output: output:
- platform: ledc - platform: ledc
@@ -281,7 +206,6 @@ light:
channel_colors: GRB channel_colors: GRB
pin: 23 pin: 23
num_leds: 3 num_leds: 3
# rmt_channel: 0
chipset: SK6812 chipset: SK6812
effects: effects:
- pulse: - pulse:
@@ -298,16 +222,8 @@ light:
id: light_1 id: light_1
output: relay_1 output: relay_1
restore_mode: RESTORE_DEFAULT_OFF restore_mode: RESTORE_DEFAULT_OFF
# # - platform: binary
# # name: Relay 2
# # output: relay_2
switch: switch:
# - platform: gpio
# name: Light
# id: relay_1
# pin:
# number: 22
- platform: gpio - platform: gpio
# name: Relay 2 # name: Relay 2
id: relay_2 id: relay_2
@@ -339,28 +255,27 @@ sensor:
pin: 38 pin: 38
update_interval: 5min update_interval: 5min
attenuation: 12db attenuation: 12db
- platform: resistance - platform: resistance
id: resistance_sensor id: resistance_sensor
sensor: ntc_source sensor: ntc_source
configuration: DOWNSTREAM configuration: DOWNSTREAM
resistor: 11.2kOhm resistor: 11.2kOhm
- platform: ntc - platform: ntc
name: Temperature
id: temperature id: temperature
sensor: resistance_sensor sensor: resistance_sensor
calibration: calibration:
b_constant: 3950 b_constant: 3950
reference_temperature: 22°C reference_temperature: 22°C
reference_resistance: 10kOhm reference_resistance: 10kOhm
name: Temperature
- platform: template
id: room_temperature_id
# esp32_ble_tracker: text_sensor:
- platform: homeassistant
# text_sensor: id: name_day
# - platform: ble_scanner entity_id: sensor.nameday_sk
# name: BLE Scanner on_value:
- lambda: |-
# esp32_ble_beacon: id(nspanel_id).set_time_format("%H:%M~" + x);
# type: iBeacon id(nspanel_id).update_time();
# uuid: '6d68252f-2e6f-b5b9-965f-43c0a3713880'
+160 -122
View File
@@ -4,9 +4,6 @@ substitutions:
name: Patio NSPanel name: Patio NSPanel
area: Living Room & Kitchen area: Living Room & Kitchen
comment: ${area}, Patio | NSPanel comment: ${area}, Patio | NSPanel
panel_recv_topic: "tele/${device}/RESULT"
panel_send_topic: "cmnd/${device}/CustomSend"
tft_url: !secret tft_url
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -18,6 +15,8 @@ esphome:
- switch.turn_off: screen_power - switch.turn_off: screen_power
- delay: 1s - delay: 1s
- switch.turn_on: screen_power - switch.turn_on: screen_power
- delay: 2s
- lambda: 'id(nspanel_id).set_display_dim(5, 80);'
esp32: esp32:
variant: esp32 variant: esp32
@@ -31,15 +30,17 @@ esp32:
external_components: external_components:
- source: - source:
type: git type: git
url: https://github.com/sairon/esphome-nspanel-lovelace-ui url: https://github.com/randybb/esphome-nspanel-lovelace-native
ref: dev ref: devices
refresh: 0s
components: [nspanel_lovelace] components: [nspanel_lovelace]
packages: packages:
common: !include common/common.yaml common: !include common/common.yaml
api: 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: actions:
- action: play_rtttl - action: play_rtttl
variables: variables:
@@ -54,110 +55,20 @@ api:
message: string message: string
song: string song: string
then: then:
- lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);'
- rtttl.play: - rtttl.play:
rtttl: !lambda 'return song;' 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 - action: notify_fullscreen
variables: variables:
title: string title: string
description: string description: string
button1: string button1: string
button2: string button2: string
time_secs: string timeout: int
icon: string
then: then:
# show notification screen - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);'
- 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);'
- rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b"
uart: uart:
@@ -166,19 +77,142 @@ uart:
rx_pin: 17 rx_pin: 17
baud_rate: 115200 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: nspanel_lovelace:
id: nspanel_id id: nspanel_id
mqtt_recv_topic: $panel_recv_topic sleep_timeout: 10
mqtt_send_topic: $panel_send_topic 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: time:
- platform: homeassistant - platform: homeassistant
@@ -193,10 +227,9 @@ binary_sensor:
inverted: true inverted: true
on_click: on_click:
- switch.toggle: relay_1 - switch.toggle: relay_1
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic - lambda: 'id(nspanel_id).render_next_page();'
payload: |- - lambda: 'id(nspanel_id).render_next_page();'
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
- platform: gpio - platform: gpio
name: Right Button name: Right Button
@@ -212,10 +245,9 @@ binary_sensor:
action: light.toggle action: light.toggle
data: data:
entity_id: light.patio_lights entity_id: light.patio_lights
- mqtt.publish_json: - lambda: 'id(nspanel_id).render_default_page();'
topic: $panel_recv_topic - lambda: 'id(nspanel_id).render_next_page();'
payload: |- - lambda: 'id(nspanel_id).render_next_page();'
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
else: else:
- switch.toggle: relay_2 - switch.toggle: relay_2
@@ -267,13 +299,19 @@ sensor:
resistor: 11.2kOhm resistor: 11.2kOhm
- platform: ntc - platform: ntc
name: Living Room Temperature
id: temperature id: temperature
sensor: resistance_sensor sensor: resistance_sensor
calibration: calibration:
b_constant: 3950 b_constant: 3950
reference_temperature: 25°C reference_temperature: 25°C
reference_resistance: 10kOhm reference_resistance: 10kOhm
name: Living Room Temperature
- platform: template text_sensor:
id: room_temperature_id - 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();