Files
esphome-configs/mcu-nspanel-office-r.yaml
T
randy 203fc5e26d nspanel_terminal: heating icons on the home page
A row of state icons above today's weather, filled by packages (the first
one on the right):
- fireplace_icon.yaml: the fireplace burning or out.
- radiator_icon.yaml: per thermostat; disabled while it does not call for
  heat, off while it does but the off-peak tariff has the boiler hard off and
  the fireplace is out, on while it heats.
Both hide outside the heating season (boiler switch off, fireplace out).
2026-10-31 23:33:27 +01:00

154 lines
6.6 KiB
YAML

---
# Hardware: Sonoff NSPanel (EU)
# Pinout:
# GPIO2 IO2
# GPIO4 Screen power -> Screen Power (switch gpio) (inverted)
# GPIO14 Left button -> Left Button (binary_sensor gpio) (inverted)
# GPIO16 Display UART TX -> display_uart (uart tx_pin)
# GPIO17 Display UART RX -> display_uart (uart rx_pin)
# GPIO19 Relay 2 -> relay_2 (switch gpio)
# GPIO21 Buzzer -> buzzer_out (output ledc)
# GPIO22 Relay 1 -> relay_1 (output gpio)
# GPIO23 Relay 3 (no relay, connector) -> Presence Light (light esp32_rmt_led_strip)
# GPIO27 Right button -> Right Button (binary_sensor gpio) (inverted)
# GPIO37 ALS (light sensor)
# GPIO38 NTC temperature (ADC) -> ntc_source (sensor adc)
substitutions:
device: nspanel-office-r
name: Office R NSPanel
area: Office R
comment: NSPanel (nspanel-terminal)
brightness: "80"
# backlight after 15 s idle
dim_brightness: "20"
esphome:
name: mcu-${device}
friendly_name: ${name}
area: ${area}
comment: ${comment}
packages:
common: !include common/common.yaml
ipv6_only: !include common/ipv6_only.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}}
# home page icons, right to left
i_fire: !include common/nspanel_terminal/fireplace_icon.yaml
i_radiator: !include {file: common/nspanel_terminal/radiator_icon.yaml, vars: {id: i_radiator, 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
mode: restart
then:
- output.turn_on: buzzer_out
- output.ledc.set_frequency:
id: buzzer_out
frequency: 4000Hz
- output.set_level:
id: buzzer_out
level: 50%
- delay: 1ms
- output.turn_off: buzzer_out
- delay: !lambda |-
return esphome::random_uint32() % 450 + 50;
- script.execute: geiger_click
binary_sensor:
# both buttons show the Romanko page, where the change is visible
- platform: gpio
name: Left Button
pin:
number: 14
inverted: true
on_click:
- homeassistant.action:
action: light.toggle
data:
entity_id: light.office_r_desk_strip
- lvgl.page.show: page_office
- script.execute: wake_screen
- platform: gpio
name: Right Button
pin:
number: 27
inverted: true
on_click:
- light.toggle: light_1
- lvgl.page.show: page_office
- script.execute: wake_screen
output:
- id: relay_1
platform: gpio
pin:
number: 22
light:
- platform: esp32_rmt_led_strip
name: Presence Light
id: neo
channel_colors: GRB
pin: 23
num_leds: 3
chipset: SK6812
effects:
- pulse:
- pulse:
name: "Fast Pulse"
transition_length: 1s
update_interval: 1s
- pulse:
name: "Slow Pulse"
transition_length: 2s # defaults to 1s
update_interval: 2s
- platform: binary
name: Light
id: light_1
output: relay_1
restore_mode: RESTORE_DEFAULT_OFF
switch:
- platform: gpio
# name: Relay 2
id: relay_2
pin:
number: 19
- platform: template
name: "Geiger Counter"
optimistic: True
turn_on_action:
- script.execute: geiger_click
turn_off_action:
- script.stop: geiger_click