Screen working
Need mqtt connection still
This commit is contained in:
@@ -1,55 +1,115 @@
|
||||
substitutions:
|
||||
device_id: !include device_id.txt
|
||||
|
||||
esphome:
|
||||
name: epaper-display-node
|
||||
name: epaper-node
|
||||
friendly_name: "Microwave Thread Display Node"
|
||||
on_boot:
|
||||
priority: -100.0
|
||||
then:
|
||||
- component.update: my_display
|
||||
|
||||
esp32:
|
||||
board: esp32-h2-devkitm-1
|
||||
variant: esp32h2
|
||||
framework:
|
||||
type: esp-idf
|
||||
advanced:
|
||||
loop_task_stack_size: 32768
|
||||
sdkconfig_options:
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE: "16384"
|
||||
CONFIG_OPENTHREAD_TASK_STACK_SIZE: "8192"
|
||||
CONFIG_ESP_WIFI_ENABLED: "n"
|
||||
CONFIG_OPENTHREAD_ENABLED: "y"
|
||||
CONFIG_MBEDTLS_DYNAMIC_BUFFER: "y"
|
||||
CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA: "y"
|
||||
|
||||
# OpenThread configuration joining the Pi's Thread network
|
||||
logger:
|
||||
level: INFO
|
||||
hardware_uart: UART0
|
||||
|
||||
network:
|
||||
enable_ipv6: true
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# OpenThread Network Settings
|
||||
# -------------------------------------------------------------------
|
||||
openthread:
|
||||
network:
|
||||
enable_ipv6: true
|
||||
network_name: "OpenThread-Pi" # Must match OTBR
|
||||
pan_id: 0x1234 # Must match OTBR
|
||||
channel: 15 # Must match OTBR
|
||||
network_key: "00112233445566778899aabbccddeeff" # Must match OTBR
|
||||
network_name: "OpenThread-7f41"
|
||||
pan_id: 0x7f41
|
||||
channel: 24
|
||||
network_key: "0x3f543281275a135e38982974aa71e987"
|
||||
force_dataset: true
|
||||
|
||||
# MQTT Client connecting over Thread (IPv6)
|
||||
# -------------------------------------------------------------------
|
||||
# MQTT Connection over Thread IPv6
|
||||
# -------------------------------------------------------------------
|
||||
mqtt:
|
||||
broker: "fdde:ad00:beef:0::1" # RPi OTBR wpan0 IPv6 address
|
||||
port: 1883
|
||||
broker: "fd1a:dbbe:7435:e954:4455:28c5:b6cf:e990"
|
||||
port: 8884
|
||||
skip_cert_cn_check: true
|
||||
topic_prefix: microwave/display
|
||||
keepalive: 60s
|
||||
on_connect:
|
||||
- mqtt.publish:
|
||||
topic: smartwave/hello
|
||||
payload: !lambda |-
|
||||
return std::string("{\"id_microwave\":\"") + "${device_id}" + "\",\"type\":\"externalDisplay\"}";
|
||||
on_message:
|
||||
- topic: microwave/display/status
|
||||
then:
|
||||
- text_sensor.template.publish:
|
||||
id: status_message
|
||||
state: !lambda 'return x;'
|
||||
- component.update: my_display
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Template Text Sensor
|
||||
# -------------------------------------------------------------------
|
||||
text_sensor:
|
||||
- platform: template
|
||||
name: "Display Status Message"
|
||||
id: status_message
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Hardware SPI Pin Mapping (ESP32-H2)
|
||||
# -------------------------------------------------------------------
|
||||
spi:
|
||||
clk_pin: GPIO10
|
||||
mosi_pin: GPIO11
|
||||
|
||||
display:
|
||||
- platform: waveshare_epaper
|
||||
cs_pin: GPIO8
|
||||
dc_pin: GPIO12
|
||||
reset_pin: GPIO13
|
||||
busy_pin: GPIO14
|
||||
model: 2.13in-d
|
||||
update_interval: never # Updated explicitly via text sensor
|
||||
id: my_epaper
|
||||
pages:
|
||||
- id: status_page
|
||||
lambda: |-
|
||||
it.printf(0, 0, id(font_small), "Status: %s", id(display_text).state.c_str());
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Fonts
|
||||
# -------------------------------------------------------------------
|
||||
font:
|
||||
- file: "gfonts://Roboto"
|
||||
id: font_small
|
||||
size: 16
|
||||
id: font_header
|
||||
size: 18
|
||||
- file: "gfonts://Roboto"
|
||||
id: font_body
|
||||
size: 12
|
||||
|
||||
text_sensor:
|
||||
- platform: mqtt
|
||||
name: "Display Text Input"
|
||||
id: display_text
|
||||
state_topic: "microwave/display/text"
|
||||
on_value:
|
||||
then:
|
||||
- component.update: my_epaper
|
||||
# -------------------------------------------------------------------
|
||||
# Waveshare 2.13-inch e-Paper Display (V4 panel = 2.13inv3 in ESPHome)
|
||||
# -------------------------------------------------------------------
|
||||
display:
|
||||
- platform: waveshare_epaper
|
||||
cs_pin: GPIO4
|
||||
dc_pin: GPIO1
|
||||
reset_pin: GPIO2
|
||||
busy_pin: GPIO3
|
||||
model: 2.13inv3
|
||||
rotation: 90°
|
||||
update_interval: 30s
|
||||
id: my_display
|
||||
lambda: |-
|
||||
if (id(status_message).has_state()) {
|
||||
it.print(5, 3, id(font_header), "MICROWAVE STATUS");
|
||||
it.line(0, 20, it.get_width(), 20);
|
||||
it.print(5, 25, id(font_body), id(status_message).state.c_str());
|
||||
} else {
|
||||
int center_x = it.get_width() / 2;
|
||||
int center_y = it.get_height() / 2;
|
||||
|
||||
it.printf(center_x, center_y, id(font_header), TextAlign::CENTER, "SmartWave");
|
||||
}
|
||||
Reference in New Issue
Block a user