Loading automation/motion_light_timer_condition_illuminance.yaml 0 → 100644 +127 −0 Original line number Diff line number Diff line blueprint: name: Motion-activated Light with Timer and Condition & Illuminance description: Turn on a light when motion is detected and turn it off when "no-motion" timer finishes on specific condifion domain: automation source_url: https://github.com/DmitriySafronov/home-assistant_blueprints/blob/master/automation/motion_light_timer_condition_illuminance.yaml input: entity_trigger: name: Motion Sensor selector: entity: domain: binary_sensor device_class: motion entity_illuminance: name: Illuminance Sensor selector: entity: domain: sensor device_class: illuminance entity_illuminance_value: name: Illuminance Value selector: entity: domain: input_number entity_condition: name: Condition selector: entity: domain: - binary_sensor - input_boolean entity_target: name: Light selector: entity: domain: light timer_no_motion: name: Wait timer description: Time to leave the light on after last motion is detected. selector: entity: domain: timer # If motion is detected within the delay, # we restart the script. mode: restart max_exceeded: silent trigger: - platform: event event_type: timer.finished event_data: entity_id: !input timer_no_motion id: timer - platform: state entity_id: - !input entity_trigger id: motion - platform: state entity_id: - !input entity_target id: light condition: - condition: state entity_id: !input entity_condition state: "on" action: - choose: - conditions: - condition: trigger id: timer sequence: - service: light.turn_off target: entity_id: !input entity_target - conditions: - condition: trigger id: motion - condition: state entity_id: !input entity_trigger state: "on" - condition: numeric_state entity_id: !input entity_illuminance below: !input entity_illuminance_value sequence: - service: light.turn_on target: entity_id: !input entity_target - service: timer.cancel target: entity_id: !input timer_no_motion - conditions: - condition: trigger id: motion - condition: state entity_id: !input entity_trigger state: "off" - condition: state entity_id: !input entity_target state: "on" sequence: - service: timer.start target: entity_id: !input timer_no_motion - conditions: - condition: trigger id: light - condition: state entity_id: !input entity_target state: "on" - condition: template value_template: "{{ trigger.to_state.context.parent_id == none }}" sequence: - service: timer.start target: entity_id: !input timer_no_motion - conditions: - condition: trigger id: light - condition: state entity_id: !input entity_target state: "off" sequence: - service: timer.cancel target: entity_id: !input timer_no_motion Loading
automation/motion_light_timer_condition_illuminance.yaml 0 → 100644 +127 −0 Original line number Diff line number Diff line blueprint: name: Motion-activated Light with Timer and Condition & Illuminance description: Turn on a light when motion is detected and turn it off when "no-motion" timer finishes on specific condifion domain: automation source_url: https://github.com/DmitriySafronov/home-assistant_blueprints/blob/master/automation/motion_light_timer_condition_illuminance.yaml input: entity_trigger: name: Motion Sensor selector: entity: domain: binary_sensor device_class: motion entity_illuminance: name: Illuminance Sensor selector: entity: domain: sensor device_class: illuminance entity_illuminance_value: name: Illuminance Value selector: entity: domain: input_number entity_condition: name: Condition selector: entity: domain: - binary_sensor - input_boolean entity_target: name: Light selector: entity: domain: light timer_no_motion: name: Wait timer description: Time to leave the light on after last motion is detected. selector: entity: domain: timer # If motion is detected within the delay, # we restart the script. mode: restart max_exceeded: silent trigger: - platform: event event_type: timer.finished event_data: entity_id: !input timer_no_motion id: timer - platform: state entity_id: - !input entity_trigger id: motion - platform: state entity_id: - !input entity_target id: light condition: - condition: state entity_id: !input entity_condition state: "on" action: - choose: - conditions: - condition: trigger id: timer sequence: - service: light.turn_off target: entity_id: !input entity_target - conditions: - condition: trigger id: motion - condition: state entity_id: !input entity_trigger state: "on" - condition: numeric_state entity_id: !input entity_illuminance below: !input entity_illuminance_value sequence: - service: light.turn_on target: entity_id: !input entity_target - service: timer.cancel target: entity_id: !input timer_no_motion - conditions: - condition: trigger id: motion - condition: state entity_id: !input entity_trigger state: "off" - condition: state entity_id: !input entity_target state: "on" sequence: - service: timer.start target: entity_id: !input timer_no_motion - conditions: - condition: trigger id: light - condition: state entity_id: !input entity_target state: "on" - condition: template value_template: "{{ trigger.to_state.context.parent_id == none }}" sequence: - service: timer.start target: entity_id: !input timer_no_motion - conditions: - condition: trigger id: light - condition: state entity_id: !input entity_target state: "off" sequence: - service: timer.cancel target: entity_id: !input timer_no_motion