Files
esphome-configs/mcu-nspanel-office-r.yaml
T
randy 271a5a5a54 nspanel: popups for OTA progress and device info, Info card on every panel
common/nspanel_popup.yaml shows a popupNotify page during OTA (written straight
to the display uart, since OTA blocks the loop that sends the component's
queued commands) and a device info popup (version, build time, IPs) from the
Info button on the new last card or the show_info API action. The OTA gets
id ota_esphome to extend it. Also documents the NSPanel pinout.
2026-09-29 23:23:14 +02:00

175 lines
4.5 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
esphome:
name: mcu-${device}
friendly_name: ${name}
area: ${area}
comment: ${comment}
packages:
common: !include common/common.yaml
ipv6_only: !include common/ipv6_only.yaml
nspanel: !include
file: common/nspanel.yaml
vars:
temperature_entity: sensor.zigbee_office_r_temperature
ntc_reference_temperature: 22°C
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
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:
- 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
- lambda: 'id(nspanel_id).render_default_page();'
- platform: gpio
name: Right Button
pin:
number: 27
inverted: true
on_click:
- light.toggle: light_1
- lambda: 'id(nspanel_id).render_default_page();'
output:
- id: relay_1
platform: gpio
pin:
number: 22
# - id: relay_2
# platform: gpio
# pin:
# number: 19
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