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 - id: buttons_release
mode: restart mode: restart
then: then:
- lambda: |- - if:
if (bs_button_1->state) bs_button_1->publish_state(false); condition:
if (bs_button_2->state) bs_button_2->publish_state(false); binary_sensor.is_on: bs_button_1
if (bs_button_3->state) bs_button_3->publish_state(false); then:
if (bs_button_4->state) bs_button_4->publish_state(false); - 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 - id: !extend touch_on_multi_touch_release
then: then:
@@ -193,7 +216,8 @@ script:
- script.execute: buttons_release - script.execute: buttons_release
select: select:
- id: sl_button_1_action - &button_select_action_base
id: sl_button_1_action
name: Button 1 action name: Button 1 action
platform: template platform: template
options: options:
@@ -212,12 +236,7 @@ select:
options: options:
- "None" - "None"
- "Relay 2 (toggle)" - "Relay 2 (toggle)"
optimistic: true <<: *button_select_action_base
restore_value: true
internal: true
entity_category: config
disabled_by_default: false
icon: mdi:dip-switch
- id: sl_button_3_action - id: sl_button_3_action
name: Button 3 action name: Button 3 action
@@ -225,12 +244,7 @@ select:
options: options:
- "None" - "None"
- "Relay 3 (toggle)" - "Relay 3 (toggle)"
optimistic: true <<: *button_select_action_base
restore_value: true
internal: true
entity_category: config
disabled_by_default: false
icon: mdi:dip-switch
- id: sl_button_4_action - id: sl_button_4_action
name: Button 4 action name: Button 4 action
@@ -238,10 +252,5 @@ select:
options: options:
- "None" - "None"
- "Relay 4 (toggle)" - "Relay 4 (toggle)"
optimistic: true <<: *button_select_action_base
restore_value: true
internal: true
entity_category: config
disabled_by_default: false
icon: mdi:dip-switch
... ...

View File

@@ -126,7 +126,7 @@ script:
} }
select: select:
- &relay_mode_base - &relay_select_mode_base
id: sl_relay_1_mode id: sl_relay_1_mode
name: Relay 1 mode name: Relay 1 mode
platform: template platform: template
@@ -143,15 +143,15 @@ select:
- id: sl_relay_2_mode - id: sl_relay_2_mode
name: Relay 2 mode name: Relay 2 mode
<<: *relay_mode_base <<: *relay_select_mode_base
- id: sl_relay_3_mode - id: sl_relay_3_mode
name: Relay 3 mode name: Relay 3 mode
<<: *relay_mode_base <<: *relay_select_mode_base
- id: sl_relay_4_mode - id: sl_relay_4_mode
name: Relay 4 mode name: Relay 4 mode
<<: *relay_mode_base <<: *relay_select_mode_base
switch: switch:
- &relay_switch_base - &relay_switch_base

View File

@@ -123,7 +123,7 @@ script:
then: then:
- binary_sensor.template.publish: - binary_sensor.template.publish:
id: bs_swipe_left id: bs_swipe_left
state: ON state: ON # yamllint disable-line rule:truthy
- delay: !lambda return nr_touch_duration->state; - delay: !lambda return nr_touch_duration->state;
- script.execute: touch_swipe_turn_off_binary_sensor - script.execute: touch_swipe_turn_off_binary_sensor
@@ -139,7 +139,7 @@ script:
then: then:
- binary_sensor.template.publish: - binary_sensor.template.publish:
id: bs_swipe_right id: bs_swipe_right
state: ON state: ON # yamllint disable-line rule:truthy
- delay: !lambda return nr_touch_duration->state; - delay: !lambda return nr_touch_duration->state;
- script.execute: touch_swipe_turn_off_binary_sensor - script.execute: touch_swipe_turn_off_binary_sensor
@@ -152,14 +152,14 @@ script:
then: then:
- binary_sensor.template.publish: - binary_sensor.template.publish:
id: bs_swipe_left id: bs_swipe_left
state: OFF state: OFF # yamllint disable-line rule:truthy
- if: - if:
condition: condition:
binary_sensor.is_on: bs_swipe_right binary_sensor.is_on: bs_swipe_right
then: then:
- binary_sensor.template.publish: - binary_sensor.template.publish:
id: bs_swipe_right id: bs_swipe_right
state: OFF state: OFF # yamllint disable-line rule:truthy
switch: switch:
- id: sw_touch_panel_power - id: sw_touch_panel_power

View File

@@ -49,7 +49,7 @@ script:
- id: !extend touch_on_multi_touch_release - id: !extend touch_on_multi_touch_release
then: then:
- script.execute: touch_on_multi_touch_release_vibration - script.execute: touch_on_multi_touch_release_vibration
- id: touch_on_multi_touch_release_vibration - id: touch_on_multi_touch_release_vibration
mode: restart mode: restart
then: then:
@@ -60,7 +60,7 @@ script:
- id: !extend touch_on_press - id: !extend touch_on_press
then: then:
- script.execute: touch_on_press_vibration - script.execute: touch_on_press_vibration
- id: touch_on_press_vibration - id: touch_on_press_vibration
mode: restart mode: restart
then: then:
@@ -71,7 +71,7 @@ script:
- id: !extend touch_on_release - id: !extend touch_on_release
then: then:
- script.execute: touch_on_release_vibration - script.execute: touch_on_release_vibration
- id: touch_on_release_vibration - id: touch_on_release_vibration
mode: restart mode: restart
then: then: