Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move logic to script with short delay #324

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
42 changes: 30 additions & 12 deletions base_secplusv1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
Loading