blueprint: name: Run actions once a day description: Run action(s) at most once a day when a binary sensor change into specific state for a certain period of time domain: automation input: trigger_start_time: name: (Required) When will the automation start triggering description: If the condition is already met(for example binary sensor already on for 1 hour, longer than configured duration) the actions will run immediately, otherwise wait until conditions are met selector: time: {} trigger_end_time: name: (Required) When will the automation stop triggering description: If the conditions are still not met the actions will never run afterwards selector: time: {} trigger_senor: name: (Required) Trigger Binary Sensor description: Actions will only run when this is in selected state and remains in selected state for certain duration selector: entity: domain: binary_sensor trigger_senor_match_state: name: (Required) Trigger Binary Sensor match state description: Actions will only run when senor match selected state and remains in selected state for duration default: "on" selector: select: mode: dropdown options: - label: "On(Open)" value: "on" - label: "Off(Closed)" value: "off" - label: "Unknown" value: "unknown" - label: "Unavailable" value: "unavailable" for_duration: name: (Required) For duration description: Actions will only run when it is in selected state for this duration default: hours: 0 minutes: 25 seconds: 0 selector: duration: enable_day: false minimal_interval: name: (Required) Minimal triggering interval description: If this value is set to 30 minutes and end - start time is 1 hour then it maybe possible to trigger actions twice, this value can also be used to skip automation every other day or every three days default: days: 0 hours: 8 minutes: 0 seconds: 0 selector: duration: enable_day: true actions: name: Action(s) to run description: Action(s) to run when trigger condition returns true for trigger duration default: [] selector: action: master_bypass_condition: name: Master bypass condition description: Allow execution of the automation to be completely bypassed if this returns true default: "{{ false }}" selector: template: variables: master_bypass_condition: !input master_bypass_condition minimal_interval: !input minimal_interval trigger: - platform: time # id: time_trigger at: !input trigger_start_time - platform: state # id: state_trigger entity_id: !input trigger_senor to: !input trigger_senor_match_state for: !input for_duration condition: - condition: template value_template: "{{ not master_bypass_condition }}" - condition: state entity_id: !input trigger_senor state: !input trigger_senor_match_state for: !input for_duration - condition: time after: !input trigger_start_time before: !input trigger_end_time - condition: template value_template: "{{ this.attributes.last_triggered is none or (now() - this.attributes.last_triggered > timedelta(**minimal_interval)) }}" action: !input actions mode: single