Clean-up buttons

This commit is contained in:
Edward Firmo
2024-12-19 21:11:55 +01:00
parent 818c6067e0
commit 2e15149d3d
4 changed files with 44 additions and 35 deletions

View File

@@ -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:
@@ -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:
@@ -212,12 +236,7 @@ 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
@@ -225,12 +244,7 @@ select:
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
@@ -238,10 +252,5 @@ select:
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
...

View File

@@ -126,7 +126,7 @@ script:
}
select:
- &relay_mode_base
- &relay_select_mode_base
id: sl_relay_1_mode
name: Relay 1 mode
platform: template
@@ -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

View File

@@ -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
@@ -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
@@ -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