mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 16:08:10 +01:00
121 lines
3.2 KiB
YAML
121 lines
3.2 KiB
YAML
|
i2c:
|
||
|
- id: i2c_graphical_display_menu
|
||
|
scl: 5
|
||
|
sda: 4
|
||
|
|
||
|
display:
|
||
|
- platform: ssd1306_i2c
|
||
|
id: ssd1306_display
|
||
|
model: SSD1306_128X64
|
||
|
reset_pin: 13
|
||
|
pages:
|
||
|
- id: page1
|
||
|
lambda: |-
|
||
|
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||
|
|
||
|
font:
|
||
|
- file: "gfonts://Roboto"
|
||
|
id: roboto
|
||
|
size: 20
|
||
|
|
||
|
number:
|
||
|
- platform: template
|
||
|
id: test_number
|
||
|
min_value: 0
|
||
|
step: 1
|
||
|
max_value: 10
|
||
|
optimistic: true
|
||
|
|
||
|
select:
|
||
|
- platform: template
|
||
|
id: test_select
|
||
|
options:
|
||
|
- one
|
||
|
- two
|
||
|
optimistic: true
|
||
|
|
||
|
switch:
|
||
|
- platform: template
|
||
|
id: test_switch
|
||
|
optimistic: true
|
||
|
|
||
|
graphical_display_menu:
|
||
|
id: test_graphical_display_menu
|
||
|
display: ssd1306_display
|
||
|
font: roboto
|
||
|
active: false
|
||
|
mode: rotary
|
||
|
on_enter:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "root enter");'
|
||
|
on_leave:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "root leave");'
|
||
|
items:
|
||
|
- type: back
|
||
|
text: "Back"
|
||
|
- type: label
|
||
|
- type: menu
|
||
|
text: "Submenu 1"
|
||
|
items:
|
||
|
- type: back
|
||
|
text: "Back"
|
||
|
- type: menu
|
||
|
text: "Submenu 21"
|
||
|
items:
|
||
|
- type: back
|
||
|
text: "Back"
|
||
|
- type: command
|
||
|
text: "Show Main"
|
||
|
on_value:
|
||
|
then:
|
||
|
- display_menu.show_main: test_graphical_display_menu
|
||
|
- type: select
|
||
|
text: "Enum Item"
|
||
|
immediate_edit: true
|
||
|
select: test_select
|
||
|
on_enter:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
|
||
|
on_leave:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
|
||
|
on_value:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
|
||
|
- type: number
|
||
|
text: "Number"
|
||
|
number: test_number
|
||
|
on_enter:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
|
||
|
on_leave:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
|
||
|
on_value:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
|
||
|
- type: command
|
||
|
text: "Hide"
|
||
|
on_value:
|
||
|
then:
|
||
|
- display_menu.hide: test_graphical_display_menu
|
||
|
- type: switch
|
||
|
text: "Switch"
|
||
|
switch: test_switch
|
||
|
on_text: "Bright"
|
||
|
off_text: "Dark"
|
||
|
immediate_edit: false
|
||
|
on_value:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "switch value: %s", it->get_value_text().c_str());'
|
||
|
- type: custom
|
||
|
text: !lambda 'return "Custom";'
|
||
|
value_lambda: 'return "Val";'
|
||
|
on_next:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "custom next: %s", it->get_text().c_str());'
|
||
|
on_prev:
|
||
|
then:
|
||
|
lambda: 'ESP_LOGI("graphical_display_menu", "custom prev: %s", it->get_text().c_str());'
|