Do not toggle relay with multi-touch or swipe

Solves #14
This commit is contained in:
Edward Firmo
2024-07-26 08:33:30 +02:00
parent f7d750c059
commit 2091fc4623

View File

@@ -9,7 +9,7 @@ substitutions:
default_transition_length: 500ms
invalid_cooldown: 100ms
version: '0.0.2'
version: '0.0.3'
api:
id: api_server
@@ -41,7 +41,12 @@ binary_sensor:
on_click:
then:
- lambda: |-
if (sl_button_1_action->active_index().has_value() and sl_button_1_action->active_index().value() == 1)
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();
send_event_to_ha->execute("bs_button_1", "click");
on_double_click:
@@ -62,7 +67,12 @@ binary_sensor:
on_click:
then:
- lambda: |-
if (sl_button_2_action->active_index().has_value() and sl_button_2_action->active_index().value() == 1)
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();
send_event_to_ha->execute("bs_button_2", "click");
on_double_click:
@@ -82,7 +92,12 @@ binary_sensor:
on_click:
then:
- lambda: |-
if (sl_button_3_action->active_index().has_value() and sl_button_3_action->active_index().value() == 1)
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();
send_event_to_ha->execute("bs_button_3", "click");
on_double_click:
@@ -102,7 +117,12 @@ binary_sensor:
on_click:
then:
- lambda: |-
if (sl_button_4_action->active_index().has_value() and sl_button_4_action->active_index().value() == 1)
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();
send_event_to_ha->execute("bs_button_4", "click");
on_double_click: