mirror of
https://github.com/esphome/esphome.git
synced 2026-09-30 00:10:22 +00:00
[select] Use register_apply_action for the set, set_index and operation actions (#19511)
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
select:
|
||||
- platform: template
|
||||
name: "Test Select"
|
||||
id: select_test_select
|
||||
optimistic: true
|
||||
options:
|
||||
- one
|
||||
- two
|
||||
- three
|
||||
initial_option: two
|
||||
|
||||
button:
|
||||
- platform: template
|
||||
name: "Test Select Actions"
|
||||
on_press:
|
||||
- select.set:
|
||||
id: select_test_select
|
||||
option: three
|
||||
- select.set:
|
||||
id: select_test_select
|
||||
option: !lambda |-
|
||||
std::string option = "one";
|
||||
return option;
|
||||
- select.set_index:
|
||||
id: select_test_select
|
||||
index: 1
|
||||
- select.set_index:
|
||||
id: select_test_select
|
||||
index: !lambda return 2;
|
||||
- select.next: select_test_select
|
||||
- select.previous:
|
||||
id: select_test_select
|
||||
cycle: false
|
||||
- select.first: select_test_select
|
||||
- select.last: select_test_select
|
||||
- select.operation:
|
||||
id: select_test_select
|
||||
operation: next
|
||||
cycle: false
|
||||
- select.operation:
|
||||
id: select_test_select
|
||||
operation: !lambda return SELECT_OP_PREVIOUS;
|
||||
cycle: !lambda return true;
|
||||
@@ -0,0 +1,2 @@
|
||||
packages:
|
||||
common: !include common.yaml
|
||||
@@ -0,0 +1,2 @@
|
||||
packages:
|
||||
common: !include common.yaml
|
||||
Reference in New Issue
Block a user