diff --git a/custom_components/keymaster/keymaster_common.yaml b/custom_components/keymaster/keymaster_common.yaml index d3971cbe..46a37371 100644 --- a/custom_components/keymaster/keymaster_common.yaml +++ b/custom_components/keymaster/keymaster_common.yaml @@ -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')}} @@ -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: diff --git a/custom_components/keymaster/keymaster_common_child.yaml b/custom_components/keymaster/keymaster_common_child.yaml index 7cf18d0b..0f395451 100644 --- a/custom_components/keymaster/keymaster_common_child.yaml +++ b/custom_components/keymaster/keymaster_common_child.yaml @@ -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: