Compare commits

...
6 Commits
Author SHA1 Message Date
randy cafa2da954 nspanel: drop the nspanel_lovelace leftovers
CI / ESPHome config validation (push) Successful in 1m7s
CI / YAML lint (push) Successful in 7s
No panel uses common/nspanel.yaml, nspanel_popup.yaml,
nspanel_sleep_dim.yaml or the lui.tft secret any more.
2026-10-30 18:26:15 +01:00
randy 9b5229323f nspanel: all panels on nspanel-terminal with the LVGL UI
The shared UI (home, light detail, status/boot page, notifications, OTA
progress, display hardware) moves from mcu-nspanel-dev.yaml into
common/nspanel_terminal/panel.yaml. office-r, patio, fireplace, office-j
and bedroom move from nspanel_lovelace to it with the pages, tiles and
buttons of their former cards.

thermostat.yaml carries its page and takes an id prefix, so a panel can
have more than one (fireplace). The thermostat returns to the HA target
5 s after sending, in case HA rejects the change. Idle timeout 15 s.
2026-10-30 18:20:45 +01:00
randy 5976d81d1c nspanel-dev: report the NTC temperature to HA again 2026-10-30 17:38:33 +01:00
randy 071637f589 secrets.yaml.default: tft_url_terminal for nspanel-dev 2026-10-30 17:25:52 +01:00
randy 53f0dec88e nspanel-dev: nspanel-terminal from the GitHub fork instead of a local checkout
randybb/nspanel-terminal@upload-and-redraw-fixes carries the fixes of
ptaru/nspanel-terminal#1; switch to upstream once that is merged.
2026-10-30 17:24:29 +01:00
randy 53c427e99c nspanel-dev: LVGL UI on nspanel-terminal instead of nspanel_lovelace
The display runs the ptaru/nspanel-terminal TFT and ESPHome draws the UI
with LVGL (component from a local checkout for now, see PR
ptaru/nspanel-terminal#1).

Pages: home (clock, weather, forecast, temperatures), lights, outside,
irrigation, thermostat, gate, status/boot screen; light detail with
brightness, colour temperature or hue on long press. Grid tiles come
from packages in common/nspanel_terminal/ that add themselves to a page.
Unavailable entities are greyed out, OTA progress shows on the status
page, sleep dim and the notify/show_info actions match the other panels.
2026-10-30 17:20:44 +01:00
27 changed files with 2138 additions and 1224 deletions

No files matched your search

-166
View File
@@ -1,166 +0,0 @@
---
# Sonoff NSPanel with the native Lovelace UI (randybb/esphome-nspanel-lovelace-native).
# The device file adds the cards, buttons and relays:
# packages:
# common: !include common/common.yaml
# nspanel: !include
# file: common/nspanel.yaml
# vars:
# temperature_entity: sensor.zigbee_bedroom_temperature
# nspanel_lovelace:
# cards: [...]
defaults:
temperature_name: Temperature
ntc_reference_temperature: 25°C
esphome:
on_boot:
then:
- 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
toolchain: esp-idf
framework:
type: esp-idf
advanced:
flash_chip: generic
minimum_chip_revision: 3.0
sram1_as_iram: true
packages:
popup: !include nspanel_popup.yaml
external_components:
- source:
type: git
url: https://github.com/randybb/esphome-nspanel-lovelace-native
ref: devices
refresh: 0s
components: [nspanel_lovelace]
api:
homeassistant_services: true
homeassistant_states: true
actions:
- action: play_rtttl
variables:
song: string
then:
- rtttl.play:
rtttl: !lambda 'return song;'
- action: notify
variables:
heading: string
message: string
song: string
then:
- lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);'
- rtttl.play:
rtttl: !lambda 'return song;'
- action: notify_fullscreen
variables:
title: string
description: string
button1: string
button2: string
timeout: int
icon: string
then:
- 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:
id: display_uart
tx_pin: 16
rx_pin: 17
baud_rate: 115200
nspanel_lovelace:
id: nspanel_id
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: ${temperature_entity}
icon:
value: home-thermometer-outline
color: [255, 255, 255]
precision: 1
output:
- platform: ledc
id: buzzer_out
pin:
number: 21
switch:
- platform: gpio
name: Screen Power
id: screen_power
entity_category: config
pin:
number: 4
inverted: true
restore_mode: ALWAYS_ON
rtttl:
id: buzzer
output: buzzer_out
sensor:
- platform: adc
id: ntc_source
pin: 38
update_interval: 5min
attenuation: 12db
- platform: resistance
id: resistance_sensor
sensor: ntc_source
configuration: DOWNSTREAM
resistor: 11.2kOhm
- platform: ntc
name: ${temperature_name}
id: temperature
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: ${ntc_reference_temperature}
reference_resistance: 10kOhm
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();
# HMI protocol version reported by the TFT on startup (52/53 for this UI)
- platform: template
name: TFT Version
entity_category: diagnostic
update_interval: 60s
lambda: |-
using esphome::nspanel_lovelace::Configuration;
const auto ver = Configuration::get_version();
if (ver == 0) return {"unknown"};
return {std::to_string(ver) + " (" + Configuration::get_model_str() + ")"};
-98
View File
@@ -1,98 +0,0 @@
---
# NSPanel popups (popupNotify page), without changes to nspanel_lovelace:
# - OTA progress
# - device info (version, IPs) via the show_info API action
# Needs nspanel_lovelace (id nspanel_id), its uart (id display_uart) and the
# ota id ota_esphome (common/ota_esp32.yaml).
# The component doesn't track these popups; the panel either reboots (OTA)
# or goes back to the default page afterwards.
api:
actions:
- action: show_info
then:
- script.execute: info_popup
script:
- id: info_popup
mode: restart
then:
- lambda: |-
char build[Application::BUILD_TIME_STR_SIZE];
App.get_build_time_string(build);
std::string msg = "ESPHome " ESPHOME_VERSION "\r\n";
msg += build;
// global/ULA first, link-local last
std::vector<std::string> ips;
for (int pass = 0; pass < 2; pass++) {
for (auto &ip : wifi::global_wifi_component->wifi_sta_ip_addresses()) {
if (!ip.is_set()) continue;
char buf[network::IP_ADDRESS_BUFFER_SIZE];
ip.str_to(buf);
bool ll = strncmp(buf, "fe80", 4) == 0;
if (ll == (pass == 1)) ips.emplace_back(buf);
}
}
for (auto &ip : ips) msg += "\r\n" + ip;
id(nspanel_id).send_display_command("pageType~popupNotify");
id(nspanel_id).send_display_command(
"entityUpdateDetail~info~" + App.get_friendly_name() + "~65535~~65535~~65535~" + msg + "~65535~15");
- delay: 15s
- lambda: 'id(nspanel_id).render_default_page();'
# OTA blocks the main loop, and nspanel_lovelace only sends its queued
# commands from loop(), so these frames go straight to the uart in the
# component's format: 55 BB, length (LE), command, CRC16 (LE).
- id: ota_popup
parameters:
message: string
then:
- lambda: |-
auto send = [](const std::string &cmd) {
uint8_t hdr[4] = {0x55, 0xBB, uint8_t(cmd.size() & 0xFF), uint8_t(cmd.size() >> 8)};
uint16_t crc = crc16(hdr, 4);
crc = crc16(reinterpret_cast<const uint8_t *>(cmd.data()), cmd.size(), crc);
uint8_t tail[2] = {uint8_t(crc & 0xFF), uint8_t(crc >> 8)};
id(display_uart).write_array(hdr, 4);
id(display_uart).write_array(reinterpret_cast<const uint8_t *>(cmd.data()), cmd.size());
id(display_uart).write_array(tail, 2);
id(display_uart).flush();
};
send("dimmode~100~100");
send("pageType~popupNotify");
send("entityUpdateDetail~ota~Aktualizácia firmvéru~65535~~65535~~65535~" + message + "~65535~0");
ota:
- id: !extend ota_esphome
on_begin:
- script.execute:
id: ota_popup
message: Nahrávam…
on_progress:
- lambda: |-
static int last = -1;
int pct = (int) x / 10 * 10;
if (pct != last) {
last = pct;
id(ota_popup)->execute("Nahrávam… " + std::to_string(pct) + " %");
}
on_end:
- script.execute:
id: ota_popup
message: Hotovo, reštartujem
on_error:
- script.execute:
id: ota_popup
message: Aktualizácia zlyhala
- delay: 5s
- lambda: |-
id(nspanel_id).set_display_dim(5, 80);
id(nspanel_id).render_default_page();
button:
# put button.<device>_info on a card: the panel presses it through HA
- platform: template
name: Info
id: info_button
entity_category: diagnostic
on_press:
- script.execute: info_popup
-42
View File
@@ -1,42 +0,0 @@
---
# NSPanel screensaver dims to 0 at night (sun below -6°), unless the room lights are on.
# packages:
# sleep_dim: !include
# file: common/nspanel_sleep_dim.yaml
# vars:
# sleep_override_entity: light.bedroom_lights
script:
- id: apply_sleep_dim
then:
- lambda: |-
uint8_t dim;
if (id(sleep_override).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);
time:
- id: !extend ha_time
on_time_sync:
- script.execute: apply_sleep_dim
binary_sensor:
- platform: homeassistant # sleepOverride
id: sleep_override
entity_id: ${sleep_override_entity}
on_state:
- script.execute: apply_sleep_dim
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
+14
View File
@@ -0,0 +1,14 @@
# Package: tile on a grid page that calls a Home Assistant action on an entity (e.g. button.press).
# Its checked/disabled states are up to the owner (e.g. gate.yaml). Tiles fill the page in package order.
# vars: page, id, name, icon (MDI glyph, must be in icon_s), action, entity
lvgl:
pages:
- id: !extend ${page}
widgets:
- button:
<<: !include {file: tile.yaml, vars: {id: "${id}", name: "${name}", icon: "${icon}"}}
on_click:
- homeassistant.action:
action: ${action}
data:
entity_id: ${entity}
+49
View File
@@ -0,0 +1,49 @@
# One forecast row: day, icon, day/night temperature on two lines, all centred vertically.
# Not clickable, so a tap falls through to the home page.
obj:
clickable: false
width: SIZE_CONTENT
height: SIZE_CONTENT
bg_opa: TRANSP
border_width: 0
pad_all: 0
layout:
type: FLEX
flex_flow: ROW
flex_align_cross: CENTER
pad_column: 10
widgets:
- label:
id: forecast_day_${i}
text: ""
text_font: font_s
text_color: 0xB4B4BA
width: 26
text_align: RIGHT
- label:
id: forecast_icon_${i}
text: ""
text_font: icon_s
text_color: 0xFFFFFF
- obj:
clickable: false
width: SIZE_CONTENT
height: SIZE_CONTENT
bg_opa: TRANSP
border_width: 0
pad_all: 0
layout:
type: FLEX
flex_flow: COLUMN
pad_row: 0
widgets:
- label:
id: forecast_high_${i}
text: ""
text_font: font_s
text_color: 0xFFFFFF
- label:
id: forecast_low_${i}
text: ""
text_font: font_s
text_color: 0x8E8E93
+55
View File
@@ -0,0 +1,55 @@
# Package: gate state tile (two slots) on a grid page, and the state of the gate_open/gate_close action tiles
# vars: page, state (select with Open/Closed/Opening/Closing)
lvgl:
pages:
- id: !extend ${page}
widgets:
# highlighted while not closed
- obj:
id: gate_state_tile
clickable: false
width: 272
height: 112
styles: tile_style
checked:
bg_color: 0xF5B342
text_color: 0x000000
disabled:
bg_color: 0x161618
text_color: 0x48484A
widgets:
- label:
id: gate_state_icon
text: ""
text_font: icon_l
align: LEFT_MID
- label:
id: gate_state_label
text: ""
align: LEFT_MID
x: 64
text_sensor:
- platform: homeassistant
id: gate_state
entity_id: ${state}
internal: true
on_value:
- lambda: |-
static const char *const STATES[][3] = {{"Open", "Otvorená", "\U000F116A"},
{"Closed", "Zatvorená", "\U000F0299"},
{"Opening", "Otvára sa", "\U000F1169"},
{"Closing", "Zatvára sa", "\U000F17F7"}};
const char *text = x.c_str(), *icon = "\U000F17F8";
for (auto &s : STATES)
if (x == s[0]) text = s[1], icon = s[2];
lv_label_set_text(id(gate_state_label), text);
lv_label_set_text(id(gate_state_icon), icon);
// highlighted unless closed
lv_obj_set_state(id(gate_state_tile), LV_STATE_CHECKED, x != "Closed");
// the button of the running movement
lv_obj_set_state(id(gate_open), LV_STATE_CHECKED, x == "Opening");
lv_obj_set_state(id(gate_close), LV_STATE_CHECKED, x == "Closing");
// gate controller offline: grey out the whole gate page
for (lv_obj_t *o : {(lv_obj_t *) id(gate_open), (lv_obj_t *) id(gate_close), id(gate_state_tile)})
lv_obj_set_state(o, LV_STATE_DISABLED, ha_unavailable(x));
+17
View File
@@ -0,0 +1,17 @@
# Grid page (list item of lvgl pages): title and arrows; the 2x3 tiles come from the *_tile.yaml packages
# vars: id, title, prev, next (page ids for the arrows), skip (hidden page: out of the page cycle, no next arrow)
id: ${id}
skip: ${skip}
styles: page_style
layout:
type: FLEX
flex_flow: ROW_WRAP
widgets:
- label:
text: "${title}"
text_font: font_s
text_color: 0xB4B4BA
width: 100%
text_align: CENTER
- <<: !include {file: page_arrow.yaml, vars: {icon: "\U000F0141", align: TOP_LEFT, x: -16, to: "${prev}", hidden: false}}
- <<: !include {file: page_arrow.yaml, vars: {icon: "\U000F0142", align: TOP_RIGHT, x: 16, to: "${next}", hidden: "${skip}"}}
+5
View File
@@ -0,0 +1,5 @@
#pragma once
#include <string>
// Home Assistant entity state that means "no usable value": the tile is shown greyed out and disabled
inline bool ha_unavailable(const std::string &s) { return s.empty() || s == "unavailable" || s == "unknown"; }
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
// HA brightness 0..255 -> slider percent; NaN (light off) -> 0
inline int brightness_pct(float b) { return std::isnan(b) ? 0 : int(std::lround(b * 100 / 255)); }
// Hue from the hs_color attribute, "(30.0, 80.0)" or "[30.0, 80.0]"; -1 if missing
inline int parse_hue(const std::string &s) {
size_t p = s.find_first_of("([");
if (p == std::string::npos) return -1;
char *end;
float h = std::strtof(s.c_str() + p + 1, &end);
return end == s.c_str() + p + 1 ? -1 : int(std::lround(h));
}
+63
View File
@@ -0,0 +1,63 @@
# Package: Home Assistant light as a tile on a grid page, with its state. Tap toggles, long press opens page_light.
# Tiles fill the page in package order.
# vars: page, id, name, entity, icon (MDI glyph, must be in icon_s),
# dim (brightness), kmin (lowest colour temperature in K, 0 = none), hs (hue)
lvgl:
pages:
- id: !extend ${page}
widgets:
- button:
<<: !include {file: tile.yaml, vars: {id: "${id}", name: "${name}", icon: "${icon}"}}
# not checkable: the checked state comes only from Home Assistant
on_short_click:
- homeassistant.action:
action: light.toggle
data:
entity_id: ${entity}
on_long_press:
- script.execute:
id: open_light
entity: ${entity}
name: "${name}"
dim: ${dim}
kmin: ${kmin}
hs: ${hs}
is_on: !lambda return id(${id}_state).state == "on";
bri: !lambda return id(${id}_bri).state;
ct: !lambda return id(${id}_ct).state;
hue: !lambda return id(${id}_hs).state;
sensor:
- platform: homeassistant
id: ${id}_bri
entity_id: ${entity}
attribute: brightness
internal: true
on_value:
- lambda: 'if (id(cur_light) == "${entity}") lv_slider_set_value(id(detail_bri), brightness_pct(x), LV_ANIM_OFF);'
- platform: homeassistant
id: ${id}_ct
entity_id: ${entity}
attribute: color_temp_kelvin
internal: true
on_value:
- lambda: 'if (id(cur_light) == "${entity}") lv_slider_set_value(id(detail_ct), x, LV_ANIM_OFF);'
text_sensor:
# text, not binary: a binary sensor drops "unavailable"
- platform: homeassistant
id: ${id}_state
entity_id: ${entity}
internal: true
on_value:
- lambda: |-
lv_obj_set_state(id(${id}), LV_STATE_CHECKED, x == "on");
lv_obj_set_state(id(${id}), LV_STATE_DISABLED, ha_unavailable(x));
if (id(cur_light) == "${entity}") lv_obj_set_state(id(detail_power), LV_STATE_CHECKED, x == "on");
- platform: homeassistant
id: ${id}_hs
entity_id: ${entity}
attribute: hs_color
internal: true
on_value:
- lambda: 'if (id(cur_light) == "${entity}") lv_slider_set_value(id(detail_hue), parse_hue(x), LV_ANIM_OFF);'
+19
View File
@@ -0,0 +1,19 @@
# Package: tile on a grid page that opens another page, a big icon only (e.g. the robot for automations)
# vars: page, to (page id), icon (MDI glyph, must be in icon_l)
lvgl:
pages:
- id: !extend ${page}
widgets:
- button:
width: 130
height: 112
styles: tile_style
pressed:
bg_color: 0x48484A
on_click:
- lvgl.page.show: ${to}
widgets:
- label:
text: "${icon}"
text_font: icon_l
align: CENTER
+21
View File
@@ -0,0 +1,21 @@
# Page switch arrow in a top corner; floats over the page's flex layout
# vars: icon, align, x, to (page id), hidden
obj:
floating: true
hidden: ${hidden}
align: ${align}
x: ${x}
y: -16
width: 72
height: 52
bg_opa: TRANSP
border_width: 0
pad_all: 0
on_click:
- lvgl.page.show: ${to}
widgets:
- label:
text: "${icon}"
text_font: icon_s
text_color: 0xB4B4BA
align: CENTER
File diff suppressed because it is too large. Load diff
+44
View File
@@ -0,0 +1,44 @@
---
# NSPanel sleep dim: the idle (dimmed) brightness drops to 0 at night
# (sun below -6°), unless the room light is on. Sets the idle_brightness global of panel.yaml (${dim_brightness} or 0).
# packages:
# sleep_dim: !include
# file: common/nspanel_terminal/sleep_dim.yaml
# vars:
# sleep_override_entity: light.bedroom_lights
script:
- id: apply_sleep_dim
then:
- lambda: |-
bool day = id(sun_id).is_above_horizon(-6);
id(idle_brightness) = id(sleep_override).state == "on" || day ? ${dim_brightness} : 0;
if (id(dimmed))
id(panel).request_brightness(id(idle_brightness));
time:
- id: !extend ha_time
on_time_sync:
- script.execute: apply_sleep_dim
text_sensor:
# sleepOverride; text, not binary: a binary sensor drops "unavailable"
- platform: homeassistant
id: sleep_override
entity_id: ${sleep_override_entity}
internal: true
on_value:
- script.execute: apply_sleep_dim
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
+12
View File
@@ -0,0 +1,12 @@
# Package: empty slot on a grid page (e.g. to start the next row)
# vars: page
lvgl:
pages:
- id: !extend ${page}
widgets:
- obj:
clickable: false
width: 130
height: 112
bg_opa: TRANSP
border_width: 0
+25
View File
@@ -0,0 +1,25 @@
# Package: on/off Home Assistant entity (switch, automation, ...) as a tile on a grid page, with its state.
# Tiles fill the page in package order.
# vars: page, id, name, entity, icon (MDI glyph, must be in icon_s), domain (tap calls <domain>.toggle)
lvgl:
pages:
- id: !extend ${page}
widgets:
- button:
<<: !include {file: tile.yaml, vars: {id: "${id}", name: "${name}", icon: "${icon}"}}
on_click:
- homeassistant.action:
action: ${domain}.toggle
data:
entity_id: ${entity}
text_sensor:
# text, not binary: a binary sensor drops "unavailable"
- platform: homeassistant
id: ${id}_state
entity_id: ${entity}
internal: true
on_value:
- lambda: |-
lv_obj_set_state(id(${id}), LV_STATE_CHECKED, x == "on");
lv_obj_set_state(id(${id}), LV_STATE_DISABLED, ha_unavailable(x));
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#include <string>
#include <vector>
// HA list attribute as sent to ESPHome, "['none', 'away']" or '["none", "away"]' -> items
inline std::vector<std::string> parse_list(const std::string &s) {
std::vector<std::string> out;
for (size_t p = 0; (p = s.find_first_of("'\"", p)) != std::string::npos;) {
size_t end = s.find(s[p], p + 1);
if (end == std::string::npos) break;
out.push_back(s.substr(p + 1, end - p - 1));
p = end + 1;
}
return out;
}
// Display name for a climate preset; unknown presets are shown as they come
inline std::string preset_name(const std::string &p) {
static const char *const NAMES[][2] = {{"none", "Žiadny"}, {"home", "Doma"}, {"away", "Preč"},
{"eco", "Eco"}, {"comfort", "Komfort"}, {"sleep", "Spánok"},
{"activity", "Aktivita"}, {"boost", "Boost"}};
for (auto &n : NAMES)
if (p == n[0]) return n[1];
return p;
}
+328
View File
@@ -0,0 +1,328 @@
# Package: thermostat page (arc with target temperature, -/+, heat/off, boiler switch, presets) and its HA state.
# vars: id (prefix of its ids, unique per thermostat page), page, title, prev, next (page ids for the arrows),
# entity (climate with heat/off and presets),
# boiler (switch that lets the boiler fire, the same in every room)
defaults:
boiler: switch.heating_enabled
globals:
# preset_modes of the thermostat, in dropdown order
- id: ${id}_preset_list
type: std::vector<std::string>
lvgl:
pages:
- id: ${page}
styles: page_style
widgets:
- label:
text: "${title}"
text_font: font_s
text_color: 0xB4B4BA
width: 100%
text_align: CENTER
- <<: !include
file: page_arrow.yaml
vars: {icon: "\U000F0141", align: TOP_LEFT, x: -16, to: "${prev}", hidden: false}
- <<: !include
file: page_arrow.yaml
vars: {icon: "\U000F0142", align: TOP_RIGHT, x: 16, to: "${next}", hidden: false}
# target temperature in half degrees, 10..30 °C
- arc:
id: ${id}_arc
disabled:
arc_color: 0x161618
align: BOTTOM_LEFT
y: -20
width: 220
height: 220
min_value: 20
max_value: 60
arc_width: 16
arc_color: 0x2C2C2E
indicator:
arc_width: 16
arc_color: 0x8E8E93
knob:
bg_color: 0xFFFFFF
pad_all: 2
on_value:
- lambda: 'lv_label_set_text_fmt(id(${id}_target_label), "%.1f", x / 2.0f);'
on_release:
- script.execute: ${id}_send_target
widgets:
- obj:
clickable: false
align: CENTER
y: -8
width: SIZE_CONTENT
height: SIZE_CONTENT
bg_opa: TRANSP
border_width: 0
pad_all: 0
text_color: 0xFFFFFF
layout:
type: FLEX
flex_flow: ROW
flex_align_cross: START
pad_column: 2
widgets:
- label:
id: ${id}_target_label
text: "-"
text_font: font_big
text_color: 0xFFFFFF
- label:
text: "°C"
y: 6
text_color: 0xB4B4BA
- label:
id: ${id}_current_label
text: ""
text_font: font_s
text_color: 0xB4B4BA
align: CENTER
y: 34
- label:
id: ${id}_action_label
text: ""
text_font: font_s
text_color: 0x8E8E93
align: CENTER
y: -50
- button:
id: ${id}_minus
align: BOTTOM_LEFT
x: 46
width: 56
height: 44
styles: tile_style
disabled:
bg_color: 0x161618
text_color: 0x48484A
pad_all: 0
on_click:
- lambda: |-
lv_arc_set_value(id(${id}_arc), lv_arc_get_value(id(${id}_arc)) - 1);
lv_label_set_text_fmt(id(${id}_target_label), "%.1f", lv_arc_get_value(id(${id}_arc)) / 2.0f);
- script.execute: ${id}_send_target
widgets:
- label:
text: "\U000F0374"
text_font: icon_s
align: CENTER
- button:
id: ${id}_plus
align: BOTTOM_LEFT
x: 118
width: 56
height: 44
styles: tile_style
disabled:
bg_color: 0x161618
text_color: 0x48484A
pad_all: 0
on_click:
- lambda: |-
lv_arc_set_value(id(${id}_arc), lv_arc_get_value(id(${id}_arc)) + 1);
lv_label_set_text_fmt(id(${id}_target_label), "%.1f", lv_arc_get_value(id(${id}_arc)) / 2.0f);
- script.execute: ${id}_send_target
widgets:
- label:
text: "\U000F0415"
text_font: icon_s
align: CENTER
- button:
id: ${id}_power
align: TOP_RIGHT
x: -90
y: 36
width: 82
height: 44
styles: tile_style
disabled:
bg_color: 0x161618
text_color: 0x48484A
pad_all: 0
checked:
bg_color: 0xF5B342
text_color: 0x000000
on_click:
- homeassistant.action:
action: climate.set_hvac_mode
data:
entity_id: ${entity}
hvac_mode: !lambda 'return id(${id}_mode).state == "heat" ? "off" : "heat";'
widgets:
- label:
text: "\U000F0438"
text_font: icon_s
align: LEFT_MID
x: 6
- label:
text: "Izba"
text_font: font_s
align: RIGHT_MID
x: -8
# the boiler only fires with this switch on
- button:
id: ${id}_boiler_button
align: TOP_RIGHT
x: 0
y: 36
width: 82
height: 44
styles: tile_style
disabled:
bg_color: 0x161618
text_color: 0x48484A
pad_all: 0
checked:
bg_color: 0xF5B342
text_color: 0x000000
on_click:
- homeassistant.action:
action: switch.toggle
data:
entity_id: ${boiler}
widgets:
- label:
text: "\U000F0238"
text_font: icon_s
align: LEFT_MID
x: 6
- label:
text: "Kotol"
text_font: font_s
align: RIGHT_MID
x: -8
# options come from the preset_modes attribute (thermostat.yaml)
- dropdown:
id: ${id}_preset_dropdown
disabled:
text_color: 0x48484A
align: TOP_RIGHT
y: 92
width: 172
options: ["-"]
styles: tile_style
pad_all: 10
symbol: "\U000F0140"
indicator:
text_font: icon_s
dropdown_list:
bg_color: 0x2C2C2E
text_color: 0xFFFFFF
text_font: font_m
border_width: 0
radius: 14
selected:
checked:
bg_color: 0xF5B342
text_color: 0x000000
on_value:
- homeassistant.action:
action: climate.set_preset_mode
data:
entity_id: ${entity}
preset_mode: !lambda 'return x < id(${id}_preset_list).size() ? id(${id}_preset_list)[x] : std::string();'
sensor:
- platform: homeassistant
id: ${id}_target
entity_id: ${entity}
attribute: temperature
internal: true
on_value:
- lambda: |-
if (std::isnan(x)) return;
lv_arc_set_value(id(${id}_arc), std::lround(x * 2));
lv_label_set_text_fmt(id(${id}_target_label), "%.1f", x);
- platform: homeassistant
id: ${id}_current
entity_id: ${entity}
attribute: current_temperature
internal: true
on_value:
- lambda: 'lv_label_set_text_fmt(id(${id}_current_label), "teraz %.1f°C", x);'
text_sensor:
# text, not binary: a binary sensor drops "unavailable"
- platform: homeassistant
id: ${id}_boiler
entity_id: ${boiler}
internal: true
on_value:
- lambda: |-
lv_obj_set_state(id(${id}_boiler_button), LV_STATE_CHECKED, x == "on");
lv_obj_set_state(id(${id}_boiler_button), LV_STATE_DISABLED, ha_unavailable(x));
- platform: homeassistant
id: ${id}_mode
entity_id: ${entity}
internal: true
on_value:
- lambda: |-
lv_obj_set_state(id(${id}_power), LV_STATE_CHECKED, x == "heat");
// thermostat unavailable: grey out its controls
for (lv_obj_t *o : {(lv_obj_t *) id(${id}_power), (lv_obj_t *) id(${id}_arc), id(${id}_minus), id(${id}_plus),
id(${id}_preset_dropdown)->obj})
lv_obj_set_state(o, LV_STATE_DISABLED, ha_unavailable(x));
- script.execute: ${id}_update_action
- platform: homeassistant
id: ${id}_action
entity_id: ${entity}
attribute: hvac_action
internal: true
on_value:
- script.execute: ${id}_update_action
- platform: homeassistant
id: ${id}_presets
entity_id: ${entity}
attribute: preset_modes
internal: true
on_value:
- lambda: |-
id(${id}_preset_list) = parse_list(x);
std::string options;
for (auto &p : id(${id}_preset_list)) options += (options.empty() ? "" : "\n") + preset_name(p);
lv_dropdown_set_options(id(${id}_preset_dropdown)->obj, options.c_str());
- script.execute: ${id}_select_preset
- platform: homeassistant
id: ${id}_preset
entity_id: ${entity}
attribute: preset_mode
internal: true
on_value:
- script.execute: ${id}_select_preset
script:
# Arc and -/+ change the target locally; send once the user stops for a moment
- id: ${id}_send_target
mode: restart
then:
- delay: 800ms
- homeassistant.action:
action: climate.set_temperature
data:
entity_id: ${entity}
temperature: !lambda return lv_arc_get_value(id(${id}_arc)) / 2.0f;
# back to what HA has, in case it did not take the change (e.g. actions not allowed for this device)
- delay: 5s
- lambda: |-
float target = id(${id}_target).state;
if (std::isnan(target)) return;
lv_arc_set_value(id(${id}_arc), std::lround(target * 2));
lv_label_set_text_fmt(id(${id}_target_label), "%.1f", target);
- id: ${id}_update_action
then:
- lambda: |-
bool off = id(${id}_mode).state == "off";
bool heating = id(${id}_action).state == "heating";
lv_label_set_text(id(${id}_action_label), off ? "vypnuté" : heating ? "kúri" : "nekúri");
lv_obj_set_style_arc_color(id(${id}_arc), lv_color_hex(heating ? 0xF5B342 : 0x8E8E93), LV_PART_INDICATOR);
- id: ${id}_select_preset
then:
- lambda: |-
auto &list = id(${id}_preset_list);
auto it = std::find(list.begin(), list.end(), id(${id}_preset).state);
if (it != list.end()) lv_dropdown_set_selected(id(${id}_preset_dropdown)->obj, it - list.begin());
+25
View File
@@ -0,0 +1,25 @@
# Look of a 2x3 grid tile (button body): icon top left, name bottom left; merge it into a button with <<:
# checked = on (orange), disabled = entity unavailable (grey), pressed = touch feedback
# vars: id, name, icon (MDI glyph, must be in icon_s)
id: ${id}
width: 130
height: 112
styles: tile_style
pressed:
bg_color: 0x48484A
checked:
bg_color: 0xF5B342
text_color: 0x000000
disabled:
bg_color: 0x161618
text_color: 0x48484A
widgets:
- label:
text: "${icon}"
text_font: icon_s
align: TOP_LEFT
- label:
text: "${name}"
align: BOTTOM_LEFT
long_mode: WRAP
width: 100%
+57
View File
@@ -0,0 +1,57 @@
#pragma once
#include <cstdlib>
#include <cstring>
#include <string>
// Home Assistant weather condition -> MDI icon (glyphs listed in the font: config)
inline const char *weather_icon(const std::string &c) {
static const char *const MAP[][2] = {
{"clear-night", "\U000F0594"}, {"sunny", "\U000F0599"}, {"partlycloudy", "\U000F0595"},
{"cloudy", "\U000F0590"}, {"fog", "\U000F0591"}, {"rainy", "\U000F0597"},
{"pouring", "\U000F0596"}, {"snowy", "\U000F0598"}, {"snowy-rainy", "\U000F067F"},
{"hail", "\U000F0592"}, {"lightning", "\U000F0593"}, {"lightning-rainy", "\U000F067E"},
{"windy", "\U000F059D"}, {"windy-variant", "\U000F059E"}, {"exceptional", "\U000F05D6"}};
for (auto &m : MAP)
if (c == m[0]) return m[1];
return "";
}
// One day of the HA `forecast` attribute as sent to ESPHome (Python repr or JSON of a list of dicts).
struct ForecastDay {
std::string condition;
float high, low;
};
// Value after `key` in s, starting at pos; works for 'key': and "key":
static inline const char *forecast_value_(const std::string &s, size_t pos, const char *key, size_t end) {
size_t k = s.find(key, pos);
if (k == std::string::npos || k >= end) return nullptr;
k = s.find(':', k + std::strlen(key));
if (k == std::string::npos || k >= end) return nullptr;
while (++k < end && (s[k] == ' ' || s[k] == '\'' || s[k] == '"')) {
}
return s.c_str() + k;
}
// Fills up to n days starting at index `first`; returns how many were parsed.
inline int parse_forecast(const std::string &s, int first, ForecastDay *out, int n) {
int index = 0, got = 0;
size_t pos = 0;
while (got < n && (pos = s.find('{', pos)) != std::string::npos) {
size_t end = s.find('}', pos);
if (end == std::string::npos) break;
if (index++ >= first) {
const char *cond = forecast_value_(s, pos, "condition", end);
const char *high = forecast_value_(s, pos, "temperature", end);
const char *low = forecast_value_(s, pos, "templow", end);
if (cond && high && low) {
out[got].condition.assign(cond, std::strcspn(cond, "'\","));
out[got].high = std::strtof(high, nullptr);
out[got].low = std::strtof(low, nullptr);
++got;
}
}
pos = end;
}
return got;
}
+28 -40
View File
@@ -18,7 +18,10 @@ substitutions:
name: Bedroom NSPanel
name_short: Bedroom
area: Bedroom
comment: NSPanel
comment: NSPanel (nspanel-terminal)
brightness: "80"
# backlight after 15 s idle
dim_brightness: "20"
esphome:
name: mcu-${device}
@@ -29,51 +32,34 @@ esphome:
packages:
common: !include common/common.yaml
ipv6_only: !include common/ipv6_only.yaml
nspanel: !include
file: common/nspanel.yaml
panel: !include
file: common/nspanel_terminal/panel.yaml
vars:
temperature_entity: sensor.zigbee_bedroom_temperature
first_page: page_bedroom
last_page: page_thermostat
sleep_dim: !include
file: common/nspanel_sleep_dim.yaml
file: common/nspanel_terminal/sleep_dim.yaml
vars:
sleep_override_entity: light.bedroom_lights
# Grid page tiles: each package adds its tile to the page and fills it in this order
# Spálňa
s_tv: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_bedroom, id: s_tv, name: "TV", entity: switch.mcu_socket_01_relay, icon: "\U000F07F4", domain: switch}}
s_raid: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_bedroom, id: s_raid, name: "Raid", entity: switch.mcu_socket_02_relay, icon: "\U000F0C6E", domain: switch}}
s_socket_3: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_bedroom, id: s_socket_3, name: "", entity: switch.mcu_socket_03_relay, icon: "\U000F1108", domain: switch}}
l_bedroom: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_bedroom, id: l_bedroom, name: "Svetlo", entity: light.mcu_nspanel_bedroom_light, icon: "\U000F091D", dim: false, kmin: 0, hs: false}}
l_lamp_right: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_bedroom, id: l_lamp_right, name: "Nočná lampa J", entity: light.mcu_bedroom_lamp_right_light, icon: "\U000F06B5", dim: true, kmin: 1701, hs: true}}
l_lamp_left: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_bedroom, id: l_lamp_left, name: "Nočná lampa R", entity: light.mcu_bedroom_lamp_left_light, icon: "\U000F06B5", dim: true, kmin: 1701, hs: true}}
# Kúrenie
thermo: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Spálňa", prev: page_bedroom, next: page_status, entity: climate.bt_trv_bedroom}}
nspanel_lovelace:
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
- type: cardEntities
title: Info
entities:
- name: Zariadenie
entity_id: button.bedroom_nspanel_info
icon: information-outline
# the grid pages; home, status and light detail come from panel.yaml, thermostat pages from thermostat.yaml
lvgl:
pages:
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_bedroom, title: "Spálňa", prev: page_home, next: page_thermostat, skip: false}}
binary_sensor:
# both buttons show the Spálňa page, where the change is visible
- platform: gpio
name: Left Button
pin:
@@ -81,7 +67,8 @@ binary_sensor:
inverted: true
on_click:
- light.toggle: light_1
- lambda: 'id(nspanel_id).render_default_page();'
- lvgl.page.show: page_bedroom
- script.execute: wake_screen
- platform: gpio
name: Right Button
@@ -95,7 +82,8 @@ binary_sensor:
action: light.toggle
data:
entity_id: light.bedroom_lamps
- lambda: 'id(nspanel_id).render_default_page();'
- lvgl.page.show: page_bedroom
- script.execute: wake_screen
light:
- platform: binary
+73 -518
View File
@@ -17,452 +17,82 @@ substitutions:
device: nspanel-dev
name: NSPanel DEV
area: DEV
comment: NSPanel
panel_recv_topic: "tele/${device}/RESULT"
panel_send_topic: "cmnd/${device}/CustomSend"
tft_url: !secret tft_url
comment: NSPanel (nspanel-terminal)
brightness: "80"
# backlight after 15 s idle, tune to taste
dim_brightness: "20"
esphome:
name: mcu-${device}
friendly_name: ${name}
area: ${area}
comment: ${comment}
on_boot:
then:
- switch.turn_off: screen_power
- delay: 1s
- switch.turn_on: screen_power
- delay: 2s
- lambda: 'id(nspanel_id).set_display_dim(5, 80);'
# priority: -100
# then:
# - wait_until:
# api.connected
# - delay: 10s
# - homeassistant.service:
# service: automation.trigger
# data:
# entity_id: automation.nspanel_send_weather_to_nspanel
esp32:
variant: esp32
toolchain: esp-idf
framework:
type: esp-idf
advanced:
flash_chip: generic
minimum_chip_revision: 3.0
sram1_as_iram: true
external_components:
# - source:
# type: git
# url: https://github.com/sairon/esphome-nspanel-lovelace-ui
# ref: dev
# refresh: 0s
# components: [nspanel_lovelace]
- source:
type: git
# url: https://github.com/olicooper/esphome-nspanel-lovelace-native
# ref: dev
url: https://github.com/randybb/esphome-nspanel-lovelace-native
ref: devices
refresh: 0s
components: [nspanel_lovelace]
# - source: components
packages:
common: !include common/common.yaml
ipv6_only: !include common/ipv6_only.yaml
nspanel_popup: !include common/nspanel_popup.yaml
# common: !include common/common_dev.yaml
panel: !include
file: common/nspanel_terminal/panel.yaml
vars:
temperature_entity: sensor.zigbee_office_r_temperature
first_page: page_kitchen
last_page: page_gate
sleep_dim: !include
file: common/nspanel_terminal/sleep_dim.yaml
vars:
sleep_override_entity: light.mcu_nspanel_office_r_light
# Grid page tiles: each package adds its tile to the page and fills it in this order
# Kuchyňa / Obývačka
l_kitchen: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_kitchen, name: "Kuchyňa", entity: light.kitchen, icon: "\U000F0769", dim: true, kmin: 2700, hs: false}}
l_dining: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_dining, name: "Stôl", entity: light.dining_table, icon: "\U000F1793", dim: true, kmin: 2700, hs: false}}
l_living: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_living, name: "Gauč", entity: light.living_room, icon: "\U000F04B9", dim: true, kmin: 2700, hs: false}}
l_tv: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_tv, name: "TV", entity: light.mcu_tv_light_light, icon: "\U000F0502", dim: false, kmin: 0, hs: false}}
l_dining_amb: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_dining_amb, name: "(Stôl)", entity: light.dining_table_ambilight, icon: "\U000F1051", dim: true, kmin: 1700, hs: true}}
l_living_amb: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_living_amb, name: "(Gauč)", entity: light.living_room_ambilight, icon: "\U000F1051", dim: true, kmin: 1700, hs: true}}
# Romanko
l_office: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_office, name: "Svetlo", entity: light.mcu_nspanel_office_r_light, icon: "\U000F0769", dim: false, kmin: 0, hs: false}}
l_strip: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_strip, name: "LED pásik", entity: light.office_r_desk_strip, icon: "\U000F1051", dim: true, kmin: 1700, hs: true}}
office_spacer: !include {file: common/nspanel_terminal/spacer_tile.yaml, vars: {page: page_office}}
l_monitor: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_monitor, name: "Monitor", entity: light.office_r_display_lamp, icon: "\U000F0379", dim: true, kmin: 2700, hs: false}}
l_monitor_amb: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_monitor_amb, name: "(Monitor)", entity: light.office_r_display_lamp_ambilight, icon: "\U000F1051", dim: true, kmin: 1700, hs: true}}
# Von (card_outside of the patio panel)
l_patio: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_outside, id: l_patio, name: "Terasa", entity: light.patio_lights, icon: "\U000F1253", dim: true, kmin: 2000, hs: false}}
s_patio_socket: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_patio_socket, name: "Terasa", entity: switch.mcu_patio_relay, icon: "\U000F1108", domain: switch}}
s_patio_back: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_patio_back, name: "Vzadu", entity: switch.mcu_nspanel_patio_outside_light_back, icon: "\U000F1987", domain: switch}}
s_shed_light: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_shed_light, name: "Z. domček", entity: switch.mcu_shed_light, icon: "\U000F091D", domain: switch}}
s_shed_socket: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_shed_socket, name: "Z. domček", entity: switch.mcu_shed_socket, icon: "\U000F1108", domain: switch}}
s_garden: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_garden, name: "Záhrada", entity: switch.mcu_shed_garden_light, icon: "\U000F1987", domain: switch}}
# Závlaha, robot -> page_irrigation_auto
v_a1: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a1, name: "A1", entity: switch.mcu_well_irrigation_valve_a1, icon: "\U000F1066", domain: switch}}
v_a2: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a2, name: "A2", entity: switch.mcu_well_irrigation_valve_a2, icon: "\U000F1066", domain: switch}}
v_a3: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a3, name: "A3", entity: switch.mcu_well_irrigation_valve_a3, icon: "\U000F1066", domain: switch}}
v_a4: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a4, name: "A4", entity: switch.mcu_well_irrigation_valve_a4, icon: "\U000F1066", domain: switch}}
v_a5: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a5, name: "A5", entity: switch.mcu_well_irrigation_valve_a5, icon: "\U000F1066", domain: switch}}
irrigation_auto: !include {file: common/nspanel_terminal/nav_tile.yaml, vars: {page: page_irrigation, to: page_irrigation_auto, icon: "\U000F06A9"}}
ir_morning: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation_auto, id: ir_morning, name: "Ráno", entity: automation.irrigation_morning, icon: "\U000F059C", domain: automation}}
ir_patio: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation_auto, id: ir_patio, name: "Terasa", entity: automation.irrigation_patio, icon: "\U000F024A", domain: automation}}
ir_grass: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation_auto, id: ir_grass, name: "Rast trávy", entity: automation.irrigation_grow_grass, icon: "\U000F1510", domain: automation}}
# Brána, robot -> page_gate_auto
gate_open: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_open, name: "Otvoriť", icon: "\U000F116A", action: button.press, entity: button.mcu_gate_open}}
gate_close: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_close, name: "Zatvoriť", icon: "\U000F0299", action: button.press, entity: button.mcu_gate_close}}
gate_spacer: !include {file: common/nspanel_terminal/spacer_tile.yaml, vars: {page: page_gate}}
gate: !include {file: common/nspanel_terminal/gate.yaml, vars: {page: page_gate, state: select.mcu_gate_state}}
gate_auto: !include {file: common/nspanel_terminal/nav_tile.yaml, vars: {page: page_gate, to: page_gate_auto, icon: "\U000F06A9"}}
gate_auto_open: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_open, name: "Auto-otváranie", entity: switch.mcu_gate_auto_open, icon: "\U000F1169", domain: switch}}
gate_auto_close: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_close, name: "Auto-zatváranie", entity: switch.mcu_gate_auto_close, icon: "\U000F17F7", domain: switch}}
# Kúrenie
thermostat: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Romanko", prev: page_irrigation, next: page_gate, entity: climate.bt_trv_office_r}}
# web_server:
# port: 80
# local: true
api:
homeassistant_services: true
homeassistant_states: true
actions:
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
- action: play_rtttl
variables:
song: string
then:
- rtttl.play:
rtttl: !lambda 'return song;'
- action: notify
variables:
heading: string
message: string
song: string
then:
- 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~~");'
# DISABLED until https://github.com/olicooper/esphome-nspanel-lovelace-native/issues/20 is fixed
# - service: update_tft
# then:
# - lambda: |-
# id(nspanel_id).upload_tft("${tft_url}");
# - service: 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
# - service: 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
# - service: 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
# - service: wake
# then:
# - lambda: 'id(nspanel_id).send_custom_command("wake");'
# # Service to send a command to show screensaver (some of the values are hardcoded)
# - service: show_screensaver
# then:
# - mqtt.publish:
# topic: $panel_recv_topic
# payload: '{"CustomRecv":"event,sleepReached,cardGrid"}'
# # Service to navigate to screen
# - service: 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
# - service: disable_screensaver
# then:
# - lambda: 'id(nspanel_id).send_custom_command("timeout~0");'
# # Service to send a command enabled screensaver
# - service: enable_screensaver
# then:
# - lambda: 'id(nspanel_id).send_custom_command("timeout~20");'
# # Service to send a command wake the screen
# - service: 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
# - service: 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
# - service: 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
timeout: int
icon: string
then:
- lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);'
# 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~" + timeout + "~3~" + icon + "~65535~");'
- rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b"
uart:
id: display_uart
tx_pin: 16
rx_pin: 17
baud_rate: 115200
nspanel_lovelace:
id: nspanel_id
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
# 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
# statusIcon1:
# entity: switch.office_r_light
# icon:
# "on": mdi:sofa
# "off": mdi:sofa
# color:
# "on": [255, 255, 255]
# "off": [255, 255, 255]
# statusIcon2:
# entity: light.office_r_desk_strip
# icon:
# "on": mdi:table-furniture
# "off": mdi:table-furniture
# color:
# "on": [255, 255, 255]
# "off": [255, 255, 255]
# entities:
# - entity: sensor.weather_forecast_daily
# color: [255, 255, 255]
# - entity: delete
# - entity: delete
# - entity: delete
# - entity: sensor.weather_forecast_daily
# color: [255, 255, 255]
# type: 0
# - entity: sensor.weather_forecast_daily
# color: [255, 255, 255]
# type: 1
# - entity: sensor.weather_forecast_daily
# color: [255, 255, 255]
# type: 2
# - entity: sensor.weather_forecast_daily
# color: [255, 255, 255]
# type: 3
# - entity: delete
# - entity: sensor.zigbee_office_r_temperature
# color: [255, 255, 255]
# name: ""
# icon: mdi:home-thermometer
# - entity: switch.heating_relay_3
# icon:
# "on": mdi:radiator
# "off": "text:"
# color:
# "on": [255, 255, 255]
# - entity: binary_sensor.heating_fireplace_fire
# icon:
# "on": mdi:fireplace
# "off": "text:"
# color:
# "on": [255, 255, 255]
# - entity: delete
# - entity: delete
# - entity: delete
cards:
- type: cardGrid
title: Kuchyňa / Obývačka
entities:
- name: Kuchyňa
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_light
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: 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: 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: 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: cardThermo
title: Kúrenie
thermo_entity_id: climate.bt_trv_office_r
# - type: cardQR
# title: Guest Wifi
# qr_text: "WIFI:T:WPA;S:LAB;P:slniecko;;"
# # qrCode: "URL:https://www.johndoe.com/"
# # entities:
# # - entity_id: delete
# # - entity_id: iText.LAB
# # name: Name
# # icon: wifi
# # - entity_id: iText.slniecko
# # name: Password
# # icon: key
- type: cardEntities
title: Zwift
entities:
- name: Svetlo
entity_id: light.mcu_basement_light
icon: lightbulb-multiple
- name: LED
entity_id: light.exercise_room
icon: led-strip-variant
- name: Ventilátor
entity_id: light.mcu_dimmer_exercise_room_fan
icon: fan
- name: Automatizácia
entity_id: navigate.card_exercise_automation
- type: cardEntities
title: Automatizácia
id: card_exercise_automation
hidden: true
entities:
- name: Start
entity_id: automation.zwift_enable_fan
- name: End
entity_id: automation.zwift_disable_fan
- 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
- type: cardEntities
title: Info
entities:
- name: Zariadenie
entity_id: button.nspanel_dev_info
icon: information-outline
# the grid pages; home, status and light detail come from panel.yaml, the thermostat page from thermostat.yaml
lvgl:
pages:
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_kitchen, title: "Kuchyňa / Obývačka", prev: page_home, next: page_office, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_office, title: "Romanko", prev: page_kitchen, next: page_outside, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_outside, title: "Von", prev: page_office, next: page_irrigation, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_irrigation, title: "Závlaha", prev: page_outside, next: page_thermostat, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_irrigation_auto, title: "Automatizácia závlahy", prev: page_irrigation, next: page_irrigation, skip: true}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate, title: "Brána", prev: page_thermostat, next: page_status, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate_auto, title: "Automatizácia brány", prev: page_gate, next: page_gate, skip: true}}
binary_sensor:
- platform: gpio
@@ -470,12 +100,14 @@ binary_sensor:
pin:
number: 14
inverted: true
on_press:
- switch.toggle: relay_1
# - homeassistant.service:
# service: switch.toggle
# data:
# entity_id: switch.gate_open
# like the other panels: toggle the office light and show the page with its tile
on_click:
- homeassistant.action:
action: light.toggle
data:
entity_id: light.mcu_nspanel_office_r_light
- lvgl.page.show: page_office
- script.execute: wake_screen
- platform: gpio
name: Right Button
@@ -489,92 +121,15 @@ binary_sensor:
# data:
# entity_id: switch.gate_close
output:
- platform: ledc
id: buzzer_out
pin:
number: 21
switch:
- platform: gpio
name: Relay 1
id: relay_1
pin:
number: 22
on_turn_on:
# show a light on the panel when we swich on the light
# - lambda: 'id(nspanel).send_custom_command("pageType~popupLight~[TITLE TO SHOW ON SCREEN]~[ENTITY NAME]");'
- lambda: 'id(nspanel_id).send_display_command("pageType~popupLight~Light 1~light.bed_light");'
# on_turn_off:
# # send to screensaver when switch off the light
# - mqtt.publish:
# topic: $panel_recv_topic
# payload: '{"CustomRecv":"event,sleepReached,cardGrid"}'
- platform: gpio
name: Relay 2
id: relay_2
pin:
number: 19
on_turn_on:
# show a light on the panel when we swich on the light
- lambda: 'id(nspanel_id).send_display_command("pageType~popupLight~Light 2~light.bed_light2");'
# on_turn_off:
# # send to screensaver when switch off the light
# - mqtt.publish:
# topic: $panel_recv_topic
# payload: '{"CustomRecv":"event,sleepReached,cardGrid"}'
# Turn screen power on/off. Easy way to configure the screen power control, but this should not be used from HA, as all components must be re-initialized afterwards. For lights, names of lights etc. this practically means that the state must change once to happen.
- platform: gpio
name: Screen Power
id: screen_power
entity_category: config
pin:
number: 4
inverted: true
restore_mode: ALWAYS_ON
rtttl:
id: buzzer
output: buzzer_out
sensor:
- platform: adc
id: ntc_source
pin: 38
update_interval: 5min
attenuation: 12db
- platform: resistance
id: resistance_sensor
sensor: ntc_source
configuration: DOWNSTREAM
resistor: 11.2kOhm
- platform: ntc
id: temperature
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
name: Living Room Temperature Entry
- 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();
# esp32_ble_tracker:
# scan_parameters:
# duration: 1min
# bluetooth_proxy:
+54 -104
View File
@@ -17,7 +17,10 @@ substitutions:
device: nspanel-fireplace
name: Fireplace NSPanel
area: Living Room & Kitchen
comment: NSPanel
comment: NSPanel (nspanel-terminal)
brightness: "80"
# backlight after 15 s idle
dim_brightness: "20"
esphome:
name: mcu-${device}
@@ -28,109 +31,54 @@ esphome:
packages:
common: !include common/common.yaml
ipv6_only: !include common/ipv6_only.yaml
nspanel: !include
file: common/nspanel.yaml
panel: !include
file: common/nspanel_terminal/panel.yaml
vars:
temperature_entity: sensor.zigbee_living_room_kitchen_temperature
temperature_name: Living Room Temperature
first_page: page_kitchen_living
last_page: page_thermostat_room
# Grid page tiles: each package adds its tile to the page and fills it in this order
# Kuchyňa / Obývačka
l_kitchen: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_kitchen, name: "Kuchyňa", entity: light.kitchen, icon: "\U000F0769", dim: true, kmin: 2700, hs: false}}
l_dining: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_dining, name: "Stôl", entity: light.dining_table, icon: "\U000F0769", dim: true, kmin: 2700, hs: false}}
l_living: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_living, name: "Gauč", entity: light.living_room, icon: "\U000F0769", dim: true, kmin: 2700, hs: false}}
l_tv: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_tv, name: "TV", entity: light.mcu_tv_light_strip, icon: "\U000F1051", dim: true, kmin: 0, hs: false}}
l_dining_amb: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_dining_amb, name: "(Stôl)", entity: light.dining_table_ambilight, icon: "\U000F18DE", dim: true, kmin: 1700, hs: true}}
l_living_amb: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_living_amb, name: "(Gauč)", entity: light.living_room_ambilight, icon: "\U000F18DE", dim: true, kmin: 1700, hs: true}}
# Kuchyňa
l_worktop: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_worktop, name: "Linka", entity: light.worktop_lights, icon: "\U000F181C", dim: true, kmin: 2000, hs: false}}
l_stove: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_stove, name: "Sporák", entity: light.mcu_kitchen_stove, icon: "\U000F04DE", dim: true, kmin: 2000, hs: false}}
# Von
l_patio: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_outside, id: l_patio, name: "Terasa", entity: light.patio_lights, icon: "\U000F1253", dim: true, kmin: 2000, hs: false}}
s_patio_socket: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_patio_socket, name: "Terasa", entity: switch.mcu_patio_relay, icon: "\U000F1108", domain: switch}}
s_patio_back: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_patio_back, name: "Vzadu", entity: switch.mcu_nspanel_patio_outside_light_back, icon: "\U000F1987", domain: switch}}
s_shed_light: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_shed_light, name: "Z. domček", entity: switch.mcu_shed_light, icon: "\U000F091D", domain: switch}}
s_shed_socket: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_shed_socket, name: "Z. domček", entity: switch.mcu_shed_socket, icon: "\U000F1108", domain: switch}}
s_garden: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_garden, name: "Záhrada", entity: switch.mcu_shed_garden_light, icon: "\U000F1987", domain: switch}}
# Brána, robot -> page_gate_auto
gate_open: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_open, name: "Otvoriť", icon: "\U000F116A", action: button.press, entity: button.mcu_gate_open}}
gate_close: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_close, name: "Zatvoriť", icon: "\U000F0299", action: button.press, entity: button.mcu_gate_close}}
gate_spacer: !include {file: common/nspanel_terminal/spacer_tile.yaml, vars: {page: page_gate}}
gate: !include {file: common/nspanel_terminal/gate.yaml, vars: {page: page_gate, state: select.mcu_gate_state}}
gate_auto: !include {file: common/nspanel_terminal/nav_tile.yaml, vars: {page: page_gate, to: page_gate_auto, icon: "\U000F06A9"}}
gate_auto_open: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_open, name: "Auto-otváranie", entity: switch.mcu_gate_auto_open, icon: "\U000F1169", domain: switch}}
gate_auto_close: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_close, name: "Auto-zatváranie", entity: switch.mcu_gate_auto_close, icon: "\U000F17F7", domain: switch}}
# Kúrenie
thermo: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Obývačka", prev: page_gate, next: page_thermostat_room, entity: climate.bt_trv_living_room_kitchen}}
thermo_room: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo_room, page: page_thermostat_room, title: "Kúrenie - Izba", prev: page_thermostat, next: page_status, entity: climate.bt_trv_room}}
nspanel_lovelace:
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
- type: cardEntities
title: Info
entities:
- name: Zariadenie
entity_id: button.fireplace_nspanel_info
icon: information-outline
# the grid pages; home, status and light detail come from panel.yaml, thermostat pages from thermostat.yaml
lvgl:
pages:
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_kitchen_living, title: "Kuchyňa / Obývačka", prev: page_home, next: page_kitchen, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_kitchen, title: "Kuchyňa", prev: page_kitchen_living, next: page_outside, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_outside, title: "Von", prev: page_kitchen, next: page_gate, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate, title: "Brána", prev: page_outside, next: page_thermostat, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate_auto, title: "Automatizácia brány", prev: page_gate, next: page_gate, skip: true}}
binary_sensor:
# short click: living room / dining table (Kuchyňa / Obývačka page), long click: worktop / stove (Kuchyňa page)
- platform: gpio
name: Left Button
pin:
@@ -145,7 +93,8 @@ binary_sensor:
action: light.toggle
data:
entity_id: light.living_room
- lambda: 'id(nspanel_id).render_default_page();'
- lvgl.page.show: page_kitchen_living
- script.execute: wake_screen
- min_length: 500ms
max_length: 2000ms
then:
@@ -153,8 +102,8 @@ binary_sensor:
action: light.toggle
data:
entity_id: light.worktop_lights
- lambda: 'id(nspanel_id).render_default_page();'
- lambda: 'id(nspanel_id).render_next_page();'
- lvgl.page.show: page_kitchen
- script.execute: wake_screen
- platform: gpio
name: Right Button
@@ -170,7 +119,8 @@ binary_sensor:
action: light.toggle
data:
entity_id: light.dining_table
- lambda: 'id(nspanel_id).render_default_page();'
- lvgl.page.show: page_kitchen_living
- script.execute: wake_screen
- min_length: 500ms
max_length: 2000ms
then:
@@ -178,8 +128,8 @@ binary_sensor:
action: light.toggle
data:
entity_id: light.mcu_kitchen_stove
- lambda: 'id(nspanel_id).render_default_page();'
- lambda: 'id(nspanel_id).render_next_page();'
- lvgl.page.show: page_kitchen
- script.execute: wake_screen
switch:
- platform: gpio
+34 -53
View File
@@ -17,7 +17,10 @@ substitutions:
device: nspanel-office-j
name: Office J NSPanel
area: Office J
comment: NSPanel
comment: NSPanel (nspanel-terminal)
brightness: "80"
# backlight after 15 s idle
dim_brightness: "20"
esphome:
name: mcu-${device}
@@ -28,62 +31,41 @@ esphome:
packages:
common: !include common/common.yaml
ipv6_only: !include common/ipv6_only.yaml
nspanel: !include
file: common/nspanel.yaml
panel: !include
file: common/nspanel_terminal/panel.yaml
vars:
temperature_entity: sensor.zigbee_office_j_temperature
ntc_reference_temperature: 22°C
first_page: page_office
last_page: page_thermostat
sleep_dim: !include
file: common/nspanel_sleep_dim.yaml
file: common/nspanel_terminal/sleep_dim.yaml
vars:
sleep_override_entity: light.office_j_lights
# Grid page tiles: each package adds its tile to the page and fills it in this order
# Janko
l_office: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_office, name: "Svetlo", entity: light.mcu_nspanel_office_j_light, icon: "\U000F091D", dim: false, kmin: 0, hs: false}}
l_bedside: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_bedside, name: "Nočná lampa", entity: light.bedside_left, icon: "\U000F06B5", dim: true, kmin: 1700, hs: true}}
# Brána, robot -> page_gate_auto
gate_open: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_open, name: "Otvoriť", icon: "\U000F116A", action: button.press, entity: button.mcu_gate_open}}
gate_close: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_close, name: "Zatvoriť", icon: "\U000F0299", action: button.press, entity: button.mcu_gate_close}}
gate_spacer: !include {file: common/nspanel_terminal/spacer_tile.yaml, vars: {page: page_gate}}
gate: !include {file: common/nspanel_terminal/gate.yaml, vars: {page: page_gate, state: select.mcu_gate_state}}
gate_auto: !include {file: common/nspanel_terminal/nav_tile.yaml, vars: {page: page_gate, to: page_gate_auto, icon: "\U000F06A9"}}
gate_auto_open: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_open, name: "Auto-otváranie", entity: switch.mcu_gate_auto_open, icon: "\U000F1169", domain: switch}}
gate_auto_close: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_close, name: "Auto-zatváranie", entity: switch.mcu_gate_auto_close, icon: "\U000F17F7", domain: switch}}
# Kúrenie
thermo: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Janko", prev: page_gate, next: page_status, entity: climate.bt_trv_office_j}}
nspanel_lovelace:
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
- type: cardEntities
title: Info
entities:
- name: Zariadenie
entity_id: button.office_j_nspanel_info
icon: information-outline
# the grid pages; home, status and light detail come from panel.yaml, thermostat pages from thermostat.yaml
lvgl:
pages:
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_office, title: "Janko", prev: page_home, next: page_gate, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate, title: "Brána", prev: page_office, next: page_thermostat, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate_auto, title: "Automatizácia brány", prev: page_gate, next: page_gate, skip: true}}
binary_sensor:
# both buttons show the Janko page, where the change is visible
- platform: gpio
name: Left Button
pin:
@@ -91,7 +73,8 @@ binary_sensor:
inverted: true
on_click:
- light.toggle: light_1
- lambda: 'id(nspanel_id).render_default_page();'
- lvgl.page.show: page_office
- script.execute: wake_screen
- platform: gpio
name: Right Button
@@ -103,7 +86,8 @@ binary_sensor:
action: light.toggle
data:
entity_id: light.bedside_left
- lambda: 'id(nspanel_id).render_default_page();'
- lvgl.page.show: page_office
- script.execute: wake_screen
output:
- id: relay_1
@@ -121,6 +105,3 @@ light:
id: light_1
output: relay_1
restore_mode: RESTORE_DEFAULT_OFF
# # - platform: binary
# # name: Relay 2
# # output: relay_2
+37 -61
View File
@@ -17,7 +17,10 @@ substitutions:
device: nspanel-office-r
name: Office R NSPanel
area: Office R
comment: NSPanel
comment: NSPanel (nspanel-terminal)
brightness: "80"
# backlight after 15 s idle
dim_brightness: "20"
esphome:
name: mcu-${device}
@@ -28,11 +31,37 @@ esphome:
packages:
common: !include common/common.yaml
ipv6_only: !include common/ipv6_only.yaml
nspanel: !include
file: common/nspanel.yaml
panel: !include
file: common/nspanel_terminal/panel.yaml
vars:
temperature_entity: sensor.zigbee_office_r_temperature
ntc_reference_temperature: 22°C
first_page: page_office
last_page: page_thermostat
# Grid page tiles: each package adds its tile to the page and fills it in this order
# Romanko
l_office: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_office, name: "Svetlo", entity: light.mcu_nspanel_office_r_light, icon: "\U000F0769", dim: false, kmin: 0, hs: false}}
l_strip: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_strip, name: "LED pásik", entity: light.office_r_desk_strip, icon: "\U000F1051", dim: true, kmin: 1700, hs: true}}
office_spacer: !include {file: common/nspanel_terminal/spacer_tile.yaml, vars: {page: page_office}}
l_monitor: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_monitor, name: "Monitor", entity: light.office_r_display_lamp, icon: "\U000F0379", dim: true, kmin: 2700, hs: false}}
l_monitor_amb: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_office, id: l_monitor_amb, name: "(Monitor)", entity: light.office_r_display_lamp_ambilight, icon: "\U000F1051", dim: true, kmin: 1700, hs: true}}
# Brána, robot -> page_gate_auto
gate_open: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_open, name: "Otvoriť", icon: "\U000F116A", action: button.press, entity: button.mcu_gate_open}}
gate_close: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_close, name: "Zatvoriť", icon: "\U000F0299", action: button.press, entity: button.mcu_gate_close}}
gate_spacer: !include {file: common/nspanel_terminal/spacer_tile.yaml, vars: {page: page_gate}}
gate: !include {file: common/nspanel_terminal/gate.yaml, vars: {page: page_gate, state: select.mcu_gate_state}}
gate_auto: !include {file: common/nspanel_terminal/nav_tile.yaml, vars: {page: page_gate, to: page_gate_auto, icon: "\U000F06A9"}}
gate_auto_open: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_open, name: "Auto-otváranie", entity: switch.mcu_gate_auto_open, icon: "\U000F1169", domain: switch}}
gate_auto_close: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_close, name: "Auto-zatváranie", entity: switch.mcu_gate_auto_close, icon: "\U000F17F7", domain: switch}}
# Kúrenie
thermostat: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Romanko", prev: page_gate, next: page_status, entity: climate.bt_trv_office_r}}
# the grid pages; home, status and light detail come from panel.yaml, the thermostat page from thermostat.yaml
lvgl:
pages:
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_office, title: "Romanko", prev: page_home, next: page_gate, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate, title: "Brána", prev: page_office, next: page_thermostat, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate_auto, title: "Automatizácia brány", prev: page_gate, next: page_gate, skip: true}}
script:
- id: geiger_click
@@ -51,59 +80,8 @@ script:
return esphome::random_uint32() % 450 + 50;
- script.execute: geiger_click
nspanel_lovelace:
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
- type: cardEntities
title: Info
entities:
- name: Zariadenie
entity_id: button.office_r_nspanel_info
icon: information-outline
binary_sensor:
# both buttons show the Romanko page, where the change is visible
- platform: gpio
name: Left Button
pin:
@@ -114,7 +92,8 @@ binary_sensor:
action: light.toggle
data:
entity_id: light.office_r_desk_strip
- lambda: 'id(nspanel_id).render_default_page();'
- lvgl.page.show: page_office
- script.execute: wake_screen
- platform: gpio
name: Right Button
@@ -123,17 +102,14 @@ binary_sensor:
inverted: true
on_click:
- light.toggle: light_1
- lambda: 'id(nspanel_id).render_default_page();'
- lvgl.page.show: page_office
- script.execute: wake_screen
output:
- id: relay_1
platform: gpio
pin:
number: 22
# - id: relay_2
# platform: gpio
# pin:
# number: 19
light:
- platform: esp32_rmt_led_strip
+61 -141
View File
@@ -17,7 +17,10 @@ substitutions:
device: nspanel-patio
name: Patio NSPanel
area: Living Room & Kitchen
comment: ${area}, Patio | NSPanel
comment: ${area}, Patio | NSPanel (nspanel-terminal)
brightness: "80"
# backlight after 15 s idle
dim_brightness: "20"
esphome:
name: mcu-${device}
@@ -28,140 +31,65 @@ esphome:
packages:
common: !include common/common.yaml
ipv6_only: !include common/ipv6_only.yaml
nspanel: !include
file: common/nspanel.yaml
panel: !include
file: common/nspanel_terminal/panel.yaml
vars:
temperature_entity: sensor.zigbee_living_room_kitchen_temperature
temperature_name: Living Room Temperature
first_page: page_kitchen_living
last_page: page_thermostat
# Grid page tiles: each package adds its tile to the page and fills it in this order
# Kuchyňa / Obývačka
l_kitchen: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_kitchen, name: "Kuchyňa", entity: light.kitchen, icon: "\U000F0769", dim: true, kmin: 2700, hs: false}}
l_dining: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_dining, name: "Stôl", entity: light.dining_table, icon: "\U000F0769", dim: true, kmin: 2700, hs: false}}
l_living: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_living, name: "Gauč", entity: light.living_room, icon: "\U000F0769", dim: true, kmin: 2700, hs: false}}
l_tv: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_tv, name: "TV", entity: light.mcu_tv_light_strip, icon: "\U000F1051", dim: true, kmin: 0, hs: false}}
l_dining_amb: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_dining_amb, name: "(Stôl)", entity: light.dining_table_ambilight, icon: "\U000F18DE", dim: true, kmin: 1700, hs: true}}
l_living_amb: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen_living, id: l_living_amb, name: "(Gauč)", entity: light.living_room_ambilight, icon: "\U000F18DE", dim: true, kmin: 1700, hs: true}}
# Kuchyňa
l_worktop: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_worktop, name: "Linka", entity: light.worktop_lights, icon: "\U000F181C", dim: true, kmin: 2000, hs: false}}
l_stove: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_kitchen, id: l_stove, name: "Sporák", entity: light.mcu_kitchen_stove, icon: "\U000F04DE", dim: true, kmin: 2000, hs: false}}
# Von
l_patio: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_outside, id: l_patio, name: "Terasa", entity: light.patio_lights, icon: "\U000F1253", dim: true, kmin: 2000, hs: false}}
s_patio_socket: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_patio_socket, name: "Terasa", entity: switch.mcu_patio_relay, icon: "\U000F1108", domain: switch}}
s_patio_back: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_patio_back, name: "Vzadu", entity: switch.mcu_nspanel_patio_outside_light_back, icon: "\U000F1987", domain: switch}}
s_shed_light: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_shed_light, name: "Z. domček", entity: switch.mcu_shed_light, icon: "\U000F091D", domain: switch}}
s_shed_socket: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_shed_socket, name: "Z. domček", entity: switch.mcu_shed_socket, icon: "\U000F1108", domain: switch}}
s_garden: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_outside, id: s_garden, name: "Záhrada", entity: switch.mcu_shed_garden_light, icon: "\U000F1987", domain: switch}}
# Závlaha, robot -> page_irrigation_auto
v_a1: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a1, name: "A1", entity: switch.mcu_well_irrigation_valve_a1, icon: "\U000F1066", domain: switch}}
v_a2: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a2, name: "A2", entity: switch.mcu_well_irrigation_valve_a2, icon: "\U000F1066", domain: switch}}
v_a3: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a3, name: "A3", entity: switch.mcu_well_irrigation_valve_a3, icon: "\U000F1066", domain: switch}}
v_a4: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a4, name: "A4", entity: switch.mcu_well_irrigation_valve_a4, icon: "\U000F1066", domain: switch}}
v_a5: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation, id: v_a5, name: "A5", entity: switch.mcu_well_irrigation_valve_a5, icon: "\U000F1066", domain: switch}}
irrigation_auto: !include {file: common/nspanel_terminal/nav_tile.yaml, vars: {page: page_irrigation, to: page_irrigation_auto, icon: "\U000F06A9"}}
ir_morning: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation_auto, id: ir_morning, name: "Ráno", entity: automation.irrigation_morning, icon: "\U000F059C", domain: automation}}
ir_patio: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation_auto, id: ir_patio, name: "Terasa", entity: automation.irrigation_patio, icon: "\U000F024A", domain: automation}}
ir_grass: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_irrigation_auto, id: ir_grass, name: "Rast trávy", entity: automation.irrigation_grow_grass, icon: "\U000F1510", domain: automation}}
# Brána, robot -> page_gate_auto
gate_open: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_open, name: "Otvoriť", icon: "\U000F116A", action: button.press, entity: button.mcu_gate_open}}
gate_close: !include {file: common/nspanel_terminal/action_tile.yaml, vars: {page: page_gate, id: gate_close, name: "Zatvoriť", icon: "\U000F0299", action: button.press, entity: button.mcu_gate_close}}
gate_spacer: !include {file: common/nspanel_terminal/spacer_tile.yaml, vars: {page: page_gate}}
gate: !include {file: common/nspanel_terminal/gate.yaml, vars: {page: page_gate, state: select.mcu_gate_state}}
gate_auto: !include {file: common/nspanel_terminal/nav_tile.yaml, vars: {page: page_gate, to: page_gate_auto, icon: "\U000F06A9"}}
gate_auto_open: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_open, name: "Auto-otváranie", entity: switch.mcu_gate_auto_open, icon: "\U000F1169", domain: switch}}
gate_auto_close: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_close, name: "Auto-zatváranie", entity: switch.mcu_gate_auto_close, icon: "\U000F17F7", domain: switch}}
# Kúrenie
thermo: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Obývačka", prev: page_gate, next: page_status, entity: climate.bt_trv_living_room_kitchen}}
nspanel_lovelace:
cards:
- type: cardGrid
title: Kuchyňa / Obývačka
id: card_home
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
id: card_outside
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
- type: cardEntities
title: Info
entities:
- name: Zariadenie
entity_id: button.patio_nspanel_info
icon: information-outline
# the grid pages; home, status and light detail come from panel.yaml, thermostat pages from thermostat.yaml
lvgl:
pages:
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_kitchen_living, title: "Kuchyňa / Obývačka", prev: page_home, next: page_kitchen, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_kitchen, title: "Kuchyňa", prev: page_kitchen_living, next: page_outside, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_outside, title: "Von", prev: page_kitchen, next: page_irrigation, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_irrigation, title: "Závlaha", prev: page_outside, next: page_gate, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_irrigation_auto, title: "Automatizácia závlahy", prev: page_irrigation, next: page_irrigation, skip: true}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate, title: "Brána", prev: page_irrigation, next: page_thermostat, skip: false}}
- <<: !include {file: common/nspanel_terminal/grid_page.yaml, vars: {id: page_gate_auto, title: "Automatizácia brány", prev: page_gate, next: page_gate, skip: true}}
binary_sensor:
# both buttons show the Von page, where the change is visible
- platform: gpio
name: Left Button
pin:
@@ -169,7 +97,8 @@ binary_sensor:
inverted: true
on_click:
- switch.toggle: relay_1
- script.execute: show_outside_card
- lvgl.page.show: page_outside
- script.execute: wake_screen
- platform: gpio
name: Right Button
@@ -188,7 +117,8 @@ binary_sensor:
action: light.toggle
data:
entity_id: light.patio_lights
- script.execute: show_outside_card
- lvgl.page.show: page_outside
- script.execute: wake_screen
else:
- switch.toggle: relay_2
@@ -210,13 +140,3 @@ switch:
entity_category: config
pin:
number: 19
script:
# jump straight to the "Von" card (one render instead of home + next + next):
# make it the default page for a moment, render it, restore the home card
- id: show_outside_card
then:
- lambda: |-
id(nspanel_id).set_default_page("card_outside");
id(nspanel_id).render_default_page();
id(nspanel_id).set_default_page("card_home");
+1 -1
View File
@@ -10,7 +10,7 @@ api_key: "oSsCFxRUqIJLpT98cQwSwNxYoC7zbUh0YBHczAWRyBI="
ota_password: "password"
ha_url: http://ha.local:8123/
tft_url: http://ha.local:8123/local/tft/lui.tft
tft_url_terminal: http://ha.local/local/tft/terminal-eu.tft
mqtt_ip: ha.local
mqtt_ext: ha.example.com