Skip to content

Commit

Permalink
prevent timer from starting if auto_unlock is off
Browse files Browse the repository at this point in the history
  • Loading branch information
FutureTense committed Jul 6, 2022
1 parent 9e931b3 commit b7cbc97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/keymaster/keymaster_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ script:
data_template: # if next_dusk happens sooner than next_dawn, then it's daylight
entity_id: timer.keymaster_LOCKNAME_autolock
duration: >
{% if ( as_timestamp(state_attr("sun.sun", "next_dusk")) > as_timestamp(state_attr("sun.sun", "next_dawn"))) %}
{% if (((as_timestamp(states.sun.sun.attributes.next_dusk)) > (as_timestamp(states.sun.sun.attributes.next_dawn)))) %}
{{ states('input_text.keymaster_LOCKNAME_autolock_door_time_night')}}
{% else %}
{{ states('input_text.keymaster_LOCKNAME_autolock_door_time_day')}}
Expand Down Expand Up @@ -311,6 +311,10 @@ automation:
platform: state
entity_id: DOORSENSORENTITYNAME
to: "on"
condition:
- condition: state
entity_id: input_boolean.keymaster_LOCKNAME_autolock
state: "on"
action:
- service: timer.start
data_template:
Expand Down
4 changes: 4 additions & 0 deletions custom_components/keymaster/keymaster_common_child.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ automation:
platform: state
entity_id: DOORSENSORENTITYNAME
to: "on"
condition:
- condition: state
entity_id: input_boolean.keymaster_LOCKNAME_autolock
state: "on"
action:
- service: timer.start
data_template:
Expand Down

0 comments on commit b7cbc97

Please sign in to comment.