Skip to content

Commit

Permalink
Clean-up buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardtfn committed Dec 19, 2024
1 parent 818c606 commit 2e15149
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 35 deletions.
57 changes: 33 additions & 24 deletions ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,34 @@ script:
- id: buttons_release
mode: restart
then:
- lambda: |-
if (bs_button_1->state) bs_button_1->publish_state(false);
if (bs_button_2->state) bs_button_2->publish_state(false);
if (bs_button_3->state) bs_button_3->publish_state(false);
if (bs_button_4->state) bs_button_4->publish_state(false);
- if:
condition:
binary_sensor.is_on: bs_button_1
then:
- binary_sensor.template.publish:
id: bs_button_1
state: OFF # yamllint disable-line rule:truthy
- if:
condition:
binary_sensor.is_on: bs_button_2
then:
- binary_sensor.template.publish:
id: bs_button_2
state: OFF # yamllint disable-line rule:truthy
- if:
condition:
binary_sensor.is_on: bs_button_3
then:
- binary_sensor.template.publish:
id: bs_button_3
state: OFF # yamllint disable-line rule:truthy
- if:
condition:
binary_sensor.is_on: bs_button_4
then:
- binary_sensor.template.publish:
id: bs_button_4
state: OFF # yamllint disable-line rule:truthy

- id: !extend touch_on_multi_touch_release
then:
Expand Down Expand Up @@ -193,7 +216,8 @@ script:
- script.execute: buttons_release

select:
- id: sl_button_1_action
- &button_select_action_base
id: sl_button_1_action
name: Button 1 action
platform: template
options:
Expand All @@ -212,36 +236,21 @@ select:
options:
- "None"
- "Relay 2 (toggle)"
optimistic: true
restore_value: true
internal: true
entity_category: config
disabled_by_default: false
icon: mdi:dip-switch
<<: *button_select_action_base

- id: sl_button_3_action
name: Button 3 action
platform: template
options:
- "None"
- "Relay 3 (toggle)"
optimistic: true
restore_value: true
internal: true
entity_category: config
disabled_by_default: false
icon: mdi:dip-switch
<<: *button_select_action_base

- id: sl_button_4_action
name: Button 4 action
platform: template
options:
- "None"
- "Relay 4 (toggle)"
optimistic: true
restore_value: true
internal: true
entity_category: config
disabled_by_default: false
icon: mdi:dip-switch
<<: *button_select_action_base
...
8 changes: 4 additions & 4 deletions ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ script:
}
select:
- &relay_mode_base
- &relay_select_mode_base
id: sl_relay_1_mode
name: Relay 1 mode
platform: template
Expand All @@ -143,15 +143,15 @@ select:

- id: sl_relay_2_mode
name: Relay 2 mode
<<: *relay_mode_base
<<: *relay_select_mode_base

- id: sl_relay_3_mode
name: Relay 3 mode
<<: *relay_mode_base
<<: *relay_select_mode_base

- id: sl_relay_4_mode
name: Relay 4 mode
<<: *relay_mode_base
<<: *relay_select_mode_base

switch:
- &relay_switch_base
Expand Down
8 changes: 4 additions & 4 deletions ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ script:
then:
- binary_sensor.template.publish:
id: bs_swipe_left
state: ON
state: ON # yamllint disable-line rule:truthy
- delay: !lambda return nr_touch_duration->state;
- script.execute: touch_swipe_turn_off_binary_sensor

Expand All @@ -139,7 +139,7 @@ script:
then:
- binary_sensor.template.publish:
id: bs_swipe_right
state: ON
state: ON # yamllint disable-line rule:truthy
- delay: !lambda return nr_touch_duration->state;
- script.execute: touch_swipe_turn_off_binary_sensor

Expand All @@ -152,14 +152,14 @@ script:
then:
- binary_sensor.template.publish:
id: bs_swipe_left
state: OFF
state: OFF # yamllint disable-line rule:truthy
- if:
condition:
binary_sensor.is_on: bs_swipe_right
then:
- binary_sensor.template.publish:
id: bs_swipe_right
state: OFF
state: OFF # yamllint disable-line rule:truthy

switch:
- id: sw_touch_panel_power
Expand Down
6 changes: 3 additions & 3 deletions ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ script:
- id: !extend touch_on_multi_touch_release
then:
- script.execute: touch_on_multi_touch_release_vibration

- id: touch_on_multi_touch_release_vibration
mode: restart
then:
Expand All @@ -60,7 +60,7 @@ script:
- id: !extend touch_on_press
then:
- script.execute: touch_on_press_vibration

- id: touch_on_press_vibration
mode: restart
then:
Expand All @@ -71,7 +71,7 @@ script:
- id: !extend touch_on_release
then:
- script.execute: touch_on_release_vibration

- id: touch_on_release_vibration
mode: restart
then:
Expand Down

0 comments on commit 2e15149

Please sign in to comment.