diff --git a/base.yaml b/base.yaml index 881eb97..7511fe3 100644 --- a/base.yaml +++ b/base.yaml @@ -144,13 +144,8 @@ binary_sensor: filters: - delayed_on_off: 500ms on_press: - - if: - condition: - binary_sensor.is_off: ${id_prefix}_dry_contact_close - then: - - cover.open: ${id_prefix}_garage_door - else: - - cover.toggle: ${id_prefix}_garage_door + then: + script.execute: "${id_prefix}_dry_contact_door_control" - platform: gpio id: "${id_prefix}_dry_contact_close" pin: @@ -164,11 +159,8 @@ binary_sensor: filters: - delayed_on_off: 500ms on_press: - - if: - condition: - binary_sensor.is_off: ${id_prefix}_dry_contact_open - then: - - cover.close: ${id_prefix}_garage_door + then: + script.execute: "${id_prefix}_dry_contact_door_control" - platform: gpio id: "${id_prefix}_dry_contact_light" pin: @@ -184,6 +176,32 @@ binary_sensor: on_press: - light.toggle: ${id_prefix}_light +script: + - id: "${id_prefix}_dry_contact_door_control" + then: + - delay: 0.1s + - if: + condition: + and: + - binary_sensor.is_on: ${id_prefix}_dry_contact_close + - binary_sensor.is_on: ${id_prefix}_dry_contact_open + then: + - cover.toggle: ${id_prefix}_garage_door + - if: + condition: + and: + - binary_sensor.is_off: ${id_prefix}_dry_contact_close + - binary_sensor.is_on: ${id_prefix}_dry_contact_open + then: + - cover.open: ${id_prefix}_garage_door + - if: + condition: + and: + - binary_sensor.is_on: ${id_prefix}_dry_contact_close + - binary_sensor.is_off: ${id_prefix}_dry_contact_open + then: + - cover.close: ${id_prefix}_garage_door + number: - platform: ratgdo id: ${id_prefix}_rolling_code_counter diff --git a/base_secplusv1.yaml b/base_secplusv1.yaml index 0f94435..4248cac 100644 --- a/base_secplusv1.yaml +++ b/base_secplusv1.yaml @@ -96,13 +96,8 @@ binary_sensor: filters: - delayed_on_off: 500ms on_press: - - if: - condition: - binary_sensor.is_off: ${id_prefix}_dry_contact_close - then: - - cover.open: ${id_prefix}_garage_door - else: - - cover.toggle: ${id_prefix}_garage_door + then: + script.execute: "${id_prefix}_dry_contact_door_control" - platform: gpio id: "${id_prefix}_dry_contact_close" pin: @@ -116,11 +111,8 @@ binary_sensor: filters: - delayed_on_off: 500ms on_press: - - if: - condition: - binary_sensor.is_off: ${id_prefix}_dry_contact_open - then: - - cover.close: ${id_prefix}_garage_door + then: + script.execute: "${id_prefix}_dry_contact_door_control" - platform: gpio id: "${id_prefix}_dry_contact_light" pin: @@ -136,6 +128,32 @@ binary_sensor: on_press: - light.toggle: ${id_prefix}_light +script: + - id: "${id_prefix}_dry_contact_door_control" + then: + - delay: 0.1s + - if: + condition: + and: + - binary_sensor.is_on: ${id_prefix}_dry_contact_close + - binary_sensor.is_on: ${id_prefix}_dry_contact_open + then: + - cover.toggle: ${id_prefix}_garage_door + - if: + condition: + and: + - binary_sensor.is_off: ${id_prefix}_dry_contact_close + - binary_sensor.is_on: ${id_prefix}_dry_contact_open + then: + - cover.open: ${id_prefix}_garage_door + - if: + condition: + and: + - binary_sensor.is_on: ${id_prefix}_dry_contact_close + - binary_sensor.is_off: ${id_prefix}_dry_contact_open + then: + - cover.close: ${id_prefix}_garage_door + number: - platform: ratgdo id: ${id_prefix}_rolling_code_counter