From b3260cda1f90779c8219ae3523e6a3ab404d7e9c Mon Sep 17 00:00:00 2001 From: Nikolay Vasilchuk Date: Sun, 3 Nov 2019 00:13:46 +0300 Subject: [PATCH] Fix button --- esphome/domofon.yaml | 52 ++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/esphome/domofon.yaml b/esphome/domofon.yaml index 2cc847e..5779ee6 100755 --- a/esphome/domofon.yaml +++ b/esphome/domofon.yaml @@ -147,6 +147,14 @@ script: then: - logger.log: "Set state 'Incoming call'" - script.execute: led_off + - if: + condition: + and: + - switch.is_off: auto_open + - switch.is_off: auto_open_once + - switch.is_off: auto_reject + then: + script.execute: led_blink_red_1_on - if: condition: switch.is_on: auto_reject @@ -164,14 +172,6 @@ script: - script.execute: call_accept - delay: 1s - switch.turn_off: auto_open_once - - if: - condition: - and: - - switch.is_off: auto_open - - switch.is_off: auto_open_once - - switch.is_off: auto_reject - then: - script.execute: led_blink_red_1_on # Permanent blink green led with one flash - id: led_blink_green_1_on @@ -400,29 +400,19 @@ binary_sensor: then: script.execute: call_accept else: - - if: - condition: - and: - - switch.is_off: auto_open - - switch.is_off: auto_open_once - - switch.is_off: auto_reject - then: - switch.turn_on: auto_open_once - - if: - condition: - switch.is_on: auto_open_once - then: - switch.turn_on: auto_open - - if: - condition: - switch.is_on: auto_open - then: - switch.turn_on: auto_reject - - if: - condition: - switch.is_on: auto_reject - then: - switch.turn_on: auto_open_once + if: + condition: + switch.is_on: auto_open_once + then: + switch.turn_on: auto_open + else: + if: + condition: + switch.is_on: auto_open + then: + switch.turn_on: auto_reject + else: + switch.turn_on: auto_open_once # Long click - disable auto opening - timing: - ON for at least $short_click_time_to