Screen working
Need mqtt connection still
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
# Gitignore settings for ESPHome
|
||||||
|
# This is an example and may include too much for your use-case.
|
||||||
|
# You can modify this file to suit your needs.
|
||||||
|
/.esphome/
|
||||||
|
/secrets.yaml
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
`esphome run epaper_thread_node.yaml`
|
||||||
|
|
||||||
|
`esphome logs epaper_thread_node.yaml`
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
3
|
||||||
@@ -1,55 +1,115 @@
|
|||||||
|
substitutions:
|
||||||
|
device_id: !include device_id.txt
|
||||||
|
|
||||||
esphome:
|
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:
|
esp32:
|
||||||
board: esp32-h2-devkitm-1
|
board: esp32-h2-devkitm-1
|
||||||
variant: esp32h2
|
variant: esp32h2
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
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"
|
||||||
|
|
||||||
|
logger:
|
||||||
|
level: INFO
|
||||||
|
hardware_uart: UART0
|
||||||
|
|
||||||
# OpenThread configuration joining the Pi's Thread network
|
|
||||||
openthread:
|
|
||||||
network:
|
network:
|
||||||
enable_ipv6: true
|
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
|
|
||||||
|
|
||||||
# MQTT Client connecting over Thread (IPv6)
|
# -------------------------------------------------------------------
|
||||||
|
# OpenThread Network Settings
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
openthread:
|
||||||
|
network_name: "OpenThread-7f41"
|
||||||
|
pan_id: 0x7f41
|
||||||
|
channel: 24
|
||||||
|
network_key: "0x3f543281275a135e38982974aa71e987"
|
||||||
|
force_dataset: true
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
# MQTT Connection over Thread IPv6
|
||||||
|
# -------------------------------------------------------------------
|
||||||
mqtt:
|
mqtt:
|
||||||
broker: "fdde:ad00:beef:0::1" # RPi OTBR wpan0 IPv6 address
|
broker: "fd1a:dbbe:7435:e954:4455:28c5:b6cf:e990"
|
||||||
port: 1883
|
port: 8884
|
||||||
|
skip_cert_cn_check: true
|
||||||
topic_prefix: microwave/display
|
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:
|
spi:
|
||||||
clk_pin: GPIO10
|
clk_pin: GPIO10
|
||||||
mosi_pin: GPIO11
|
mosi_pin: GPIO11
|
||||||
|
|
||||||
display:
|
# -------------------------------------------------------------------
|
||||||
- platform: waveshare_epaper
|
# Fonts
|
||||||
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());
|
|
||||||
|
|
||||||
font:
|
font:
|
||||||
- file: "gfonts://Roboto"
|
- file: "gfonts://Roboto"
|
||||||
id: font_small
|
id: font_header
|
||||||
size: 16
|
size: 18
|
||||||
|
- file: "gfonts://Roboto"
|
||||||
|
id: font_body
|
||||||
|
size: 12
|
||||||
|
|
||||||
text_sensor:
|
# -------------------------------------------------------------------
|
||||||
- platform: mqtt
|
# Waveshare 2.13-inch e-Paper Display (V4 panel = 2.13inv3 in ESPHome)
|
||||||
name: "Display Text Input"
|
# -------------------------------------------------------------------
|
||||||
id: display_text
|
display:
|
||||||
state_topic: "microwave/display/text"
|
- platform: waveshare_epaper
|
||||||
on_value:
|
cs_pin: GPIO4
|
||||||
then:
|
dc_pin: GPIO1
|
||||||
- component.update: my_epaper
|
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");
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
esphome:
|
||||||
|
name: h2-test-node
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: esp32-h2-devkitm-1
|
||||||
|
variant: esp32h2
|
||||||
|
framework:
|
||||||
|
type: esp-idf
|
||||||
|
advanced:
|
||||||
|
loop_task_stack_size: 16384
|
||||||
|
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_ESP_CONSOLE_UART_DEFAULT: "y"
|
||||||
|
|
||||||
|
logger:
|
||||||
|
level: INFO
|
||||||
|
hardware_uart: UART0
|
||||||
|
|
||||||
|
network:
|
||||||
|
enable_ipv6: true
|
||||||
|
|
||||||
|
openthread:
|
||||||
|
network_name: "OpenThread-7f41"
|
||||||
|
pan_id: 0x7f41
|
||||||
|
channel: 24
|
||||||
|
network_key: "0x3f543281275a135e38982974aa71e987"
|
||||||
Reference in New Issue
Block a user