mirror of
https://github.com/Anonym-tsk/smart-domofon.git
synced 2025-12-06 03:26:58 +03:00
Double click
This commit is contained in:
@@ -28,44 +28,69 @@ binary_sensor:
|
||||
filters:
|
||||
delayed_on: 25ms
|
||||
on_multi_click:
|
||||
# Short click - open door or enable once auto opening
|
||||
# Double click - mute mode
|
||||
- timing:
|
||||
- ON for at most $short_click_time_to
|
||||
- OFF for at most $short_click_time_to
|
||||
- ON for $short_click_time_from to $short_click_time_to
|
||||
- OFF for at least 200ms
|
||||
then:
|
||||
if:
|
||||
condition:
|
||||
binary_sensor.is_on: incoming_call
|
||||
then:
|
||||
script.execute: call_accept
|
||||
else:
|
||||
lambda: |-
|
||||
if (id(mode_auto_open_once)) {
|
||||
id(mode_auto_open) = true;
|
||||
id(mode_auto_open_once) = false;
|
||||
id(mode_auto_reject) = false;
|
||||
} else if (id(mode_auto_open)) {
|
||||
id(mode_auto_open) = false;
|
||||
id(mode_auto_open_once) = false;
|
||||
id(mode_auto_reject) = true;
|
||||
} else {
|
||||
id(mode_auto_open) = false;
|
||||
id(mode_auto_open_once) = true;
|
||||
id(mode_auto_reject) = false;
|
||||
}
|
||||
# Long click - disable auto opening
|
||||
- logger.log: "Double Click"
|
||||
- if:
|
||||
condition:
|
||||
binary_sensor.is_off: incoming_call
|
||||
then:
|
||||
lambda: |-
|
||||
if (id(mode_mute_once)) {
|
||||
id(mode_mute) = true;
|
||||
id(mode_mute_once) = false;
|
||||
} else {
|
||||
id(mode_mute) = false;
|
||||
id(mode_mute_once) = true;
|
||||
}
|
||||
# Long click - disable auto opening and mute
|
||||
- timing:
|
||||
- ON for at least $short_click_time_to
|
||||
then:
|
||||
if:
|
||||
condition:
|
||||
binary_sensor.is_on: incoming_call
|
||||
then:
|
||||
script.execute: call_reject
|
||||
else:
|
||||
- lambda: |-
|
||||
id(mode_auto_open) = false;
|
||||
id(mode_auto_open_once) = false;
|
||||
id(mode_auto_reject) = false;
|
||||
- delay: 10ms
|
||||
- script.execute: led_blink_blue_once
|
||||
- logger.log: "Single Long Click"
|
||||
- if:
|
||||
condition:
|
||||
binary_sensor.is_on: incoming_call
|
||||
then:
|
||||
script.execute: call_reject
|
||||
else:
|
||||
- lambda: |-
|
||||
id(mode_auto_open) = false;
|
||||
id(mode_auto_open_once) = false;
|
||||
id(mode_auto_reject) = false;
|
||||
id(mode_mute) = false;
|
||||
id(mode_mute_once) = false;
|
||||
- delay: 10ms
|
||||
- script.execute: led_blink_blue_once
|
||||
# Short click - open door or enable once auto opening
|
||||
- timing:
|
||||
- ON for at most $short_click_time_to
|
||||
- OFF for at least 500ms
|
||||
then:
|
||||
- logger.log: "Single Short Click"
|
||||
- if:
|
||||
condition:
|
||||
binary_sensor.is_on: incoming_call
|
||||
then:
|
||||
script.execute: call_accept
|
||||
else:
|
||||
lambda: |-
|
||||
if (id(mode_auto_open_once)) {
|
||||
id(mode_auto_open) = true;
|
||||
id(mode_auto_open_once) = false;
|
||||
id(mode_auto_reject) = false;
|
||||
} else if (id(mode_auto_open)) {
|
||||
id(mode_auto_open) = false;
|
||||
id(mode_auto_open_once) = false;
|
||||
id(mode_auto_reject) = true;
|
||||
} else {
|
||||
id(mode_auto_open) = false;
|
||||
id(mode_auto_open_once) = true;
|
||||
id(mode_auto_reject) = false;
|
||||
}
|
||||
# - <<: !include includes/binary_sensor.captive.yaml
|
||||
Reference in New Issue
Block a user