@@ -14,6 +14,12 @@
|
||||
substitutions:
|
||||
invalid_cooldown: 100ms
|
||||
|
||||
BUTTON_ACTION_NONE_TEXT: "None"
|
||||
BUTTON_1_ACTION_TEXT: "Relay 1 (toggle)"
|
||||
BUTTON_2_ACTION_TEXT: "Relay 2 (toggle)"
|
||||
BUTTON_3_ACTION_TEXT: "Relay 3 (toggle)"
|
||||
BUTTON_4_ACTION_TEXT: "Relay 4 (toggle)"
|
||||
|
||||
binary_sensor:
|
||||
- id: bs_button_1
|
||||
name: Button 1
|
||||
@@ -232,8 +238,9 @@ select:
|
||||
name: Button 1 action
|
||||
platform: template
|
||||
options:
|
||||
- "None"
|
||||
- "Relay 1 (toggle)"
|
||||
- "${BUTTON_ACTION_NONE_TEXT}"
|
||||
- "${BUTTON_1_ACTION_TEXT}"
|
||||
initial_option: "${BUTTON_1_ACTION_TEXT}"
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
internal: true
|
||||
@@ -245,23 +252,26 @@ select:
|
||||
name: Button 2 action
|
||||
platform: template
|
||||
options:
|
||||
- "None"
|
||||
- "Relay 2 (toggle)"
|
||||
- "${BUTTON_ACTION_NONE_TEXT}"
|
||||
- "${BUTTON_2_ACTION_TEXT}"
|
||||
initial_option: "${BUTTON_2_ACTION_TEXT}"
|
||||
<<: *button_select_action_base
|
||||
|
||||
- id: sl_button_3_action
|
||||
name: Button 3 action
|
||||
platform: template
|
||||
options:
|
||||
- "None"
|
||||
- "Relay 3 (toggle)"
|
||||
- "${BUTTON_ACTION_NONE_TEXT}"
|
||||
- "${BUTTON_3_ACTION_TEXT}"
|
||||
initial_option: "${BUTTON_3_ACTION_TEXT}"
|
||||
<<: *button_select_action_base
|
||||
|
||||
- id: sl_button_4_action
|
||||
name: Button 4 action
|
||||
platform: template
|
||||
options:
|
||||
- "None"
|
||||
- "Relay 4 (toggle)"
|
||||
- "${BUTTON_ACTION_NONE_TEXT}"
|
||||
- "${BUTTON_4_ACTION_TEXT}"
|
||||
initial_option: "${BUTTON_4_ACTION_TEXT}"
|
||||
<<: *button_select_action_base
|
||||
...
|
||||
|
||||
@@ -15,50 +15,50 @@ binary_sensor:
|
||||
- id: !extend bs_button_1
|
||||
on_click:
|
||||
then:
|
||||
- lambda: |-
|
||||
if (sl_button_1_action->active_index().has_value() and
|
||||
sl_button_1_action->active_index().value() == 1 and
|
||||
!bs_multi_touch->state and
|
||||
!bs_swipe_left->state and
|
||||
!bs_swipe_down->state and
|
||||
!bs_swipe_right->state)
|
||||
sw_relay_1->toggle();
|
||||
- if:
|
||||
condition:
|
||||
- lambda: return sl_button_1_action->active_index().has_value();
|
||||
- lambda: return sl_button_1_action->active_index().value() == 1;
|
||||
- and: &button_click_no_other_click
|
||||
- lambda: return not bs_multi_touch->state;
|
||||
- lambda: return not bs_swipe_left->state;
|
||||
- lambda: return not bs_swipe_down->state;
|
||||
- lambda: return not bs_swipe_right->state;
|
||||
then:
|
||||
- switch.toggle: sw_relay_1
|
||||
|
||||
- id: !extend bs_button_2
|
||||
on_click:
|
||||
then:
|
||||
- lambda: |-
|
||||
if (sl_button_2_action->active_index().has_value() and
|
||||
sl_button_2_action->active_index().value() == 1 and
|
||||
!bs_multi_touch->state and
|
||||
!bs_swipe_left->state and
|
||||
!bs_swipe_down->state and
|
||||
!bs_swipe_right->state)
|
||||
sw_relay_2->toggle();
|
||||
- if:
|
||||
condition:
|
||||
- lambda: return sl_button_2_action->active_index().has_value();
|
||||
- lambda: return sl_button_2_action->active_index().value() == 1;
|
||||
- and: *button_click_no_other_click
|
||||
then:
|
||||
- switch.toggle: sw_relay_2
|
||||
|
||||
- id: !extend bs_button_3
|
||||
on_click:
|
||||
then:
|
||||
- lambda: |-
|
||||
if (sl_button_3_action->active_index().has_value() and
|
||||
sl_button_3_action->active_index().value() == 1 and
|
||||
!bs_multi_touch->state and
|
||||
!bs_swipe_left->state and
|
||||
!bs_swipe_down->state and
|
||||
!bs_swipe_right->state)
|
||||
sw_relay_3->toggle();
|
||||
- if:
|
||||
condition:
|
||||
- lambda: return sl_button_3_action->active_index().has_value();
|
||||
- lambda: return sl_button_3_action->active_index().value() == 1;
|
||||
- and: *button_click_no_other_click
|
||||
then:
|
||||
- switch.toggle: sw_relay_3
|
||||
|
||||
- id: !extend bs_button_4
|
||||
on_click:
|
||||
then:
|
||||
- lambda: |-
|
||||
if (sl_button_4_action->active_index().has_value() and
|
||||
sl_button_4_action->active_index().value() == 1 and
|
||||
!bs_multi_touch->state and
|
||||
!bs_swipe_left->state and
|
||||
!bs_swipe_down->state and
|
||||
!bs_swipe_right->state)
|
||||
sw_relay_4->toggle();
|
||||
- if:
|
||||
condition:
|
||||
- lambda: return sl_button_4_action->active_index().has_value();
|
||||
- lambda: return sl_button_4_action->active_index().value() == 1;
|
||||
- and: *button_click_no_other_click
|
||||
then:
|
||||
- switch.toggle: sw_relay_4
|
||||
|
||||
globals:
|
||||
- id: boot_initialization_relays
|
||||
|
||||
Reference in New Issue
Block a user