Last active
April 29, 2024 08:14
-
-
Save bperkinspdx/bdfee4124eb398fbcb68a7ea1f62bf2f to your computer and use it in GitHub Desktop.
MotionScenes V0.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: MotionScenes V0.1 | |
| description: Motion activated lighting scenes with wall switch functions and rgb indicator lighting. | |
| domain: automation | |
| source_url: https://gist.github.com/bperkinspdx/84b7105d0e2d7d7f020465b1782fc15d | |
| input: | |
| motion_entity: | |
| name: Motion Sensor | |
| description: Motion Sensor or a group with Motion Sensors (But can be anything switching between "on" and "off") | |
| selector: | |
| entity: | |
| light_target: | |
| name: Light | |
| selector: | |
| target: | |
| entity: | |
| domain: light | |
| light_indicator: | |
| name: Indicator | |
| selector: | |
| target: | |
| entity: | |
| domain: light | |
| no_motion_wait: | |
| name: Wait time | |
| description: Time to leave the light on after last motion is detected. | |
| default: 120 | |
| selector: | |
| number: | |
| min: 0 | |
| max: 3600 | |
| unit_of_measurement: seconds | |
| no_motion_blocker: | |
| name: No Motion Blocker | |
| description: No motion sequence is not run if this boolean is in desired state (see next input) | |
| default: | |
| selector: | |
| entity: | |
| no_motion_blocker_boolean: | |
| name: No Motion Chooser | |
| description: Desired state of no motion blocker, choose on for on and off for off | |
| default: false | |
| selector: | |
| boolean: | |
| scene_early_morning: | |
| name: Scene for the early morning | |
| default: scene.none | |
| selector: | |
| entity: | |
| domain: scene | |
| time_scene_early_morning: | |
| name: Time for the early morning scene | |
| description: A time input which defines the time from which on the scene will be activated if motion is detected. | |
| default: "06:30:00" | |
| selector: | |
| time: | |
| scene_morning: | |
| name: Scene for the morning | |
| default: scene.none | |
| selector: | |
| entity: | |
| domain: scene | |
| time_scene_morning: | |
| name: Time for the morning scene | |
| description: A time input which defines the time from which on the scene will be activated if motion is detected. | |
| default: "07:45:00" | |
| selector: | |
| time: | |
| scene_day: | |
| name: Scene for the bright day | |
| default: scene.none | |
| selector: | |
| entity: | |
| domain: scene | |
| time_scene_day: | |
| name: Time for the day scene | |
| description: A time input which defines the time from which on the scene will be activated if motion is detected. | |
| default: "09:00:00" | |
| selector: | |
| time: | |
| scene_early_evening: | |
| name: Scene for the early evening | |
| default: scene.none | |
| selector: | |
| entity: | |
| domain: scene | |
| time_scene_early_evening: | |
| name: Time for the early evening scene | |
| description: A time input which defines the time from which on the scene will be activated if motion is detected. | |
| default: "17:30:00" | |
| selector: | |
| time: | |
| scene_evening: | |
| name: Scene for the evening | |
| default: scene.none | |
| selector: | |
| entity: | |
| domain: scene | |
| time_scene_evening: | |
| name: Time for the evening scene | |
| description: A time input which defines the time from which on the scene will be activated if motion is detected. | |
| default: "19:00:00" | |
| selector: | |
| time: | |
| scene_late_evening: | |
| name: Scene for the late evening | |
| default: scene.none | |
| selector: | |
| entity: | |
| domain: scene | |
| time_scene_late_evening: | |
| name: Time for the late evening scene | |
| description: A time input which defines the time from which on the scene will be activated if motion is detected. | |
| default: "21:00:00" | |
| selector: | |
| time: | |
| scene_night: | |
| name: Scene for the dark night | |
| default: scene.none | |
| selector: | |
| entity: | |
| domain: scene | |
| time_scene_night: | |
| name: Time for the night scene | |
| description: A time input which defines the time from which on the scene will be activated if motion is detectedd. | |
| default: "22:15:00" | |
| selector: | |
| time: | |
| scene_no_motion: | |
| name: Default scene for no motion | |
| description: Set this Scene if you want to activate a scene if motion stops | |
| default: scene.none | |
| selector: | |
| entity: | |
| domain: scene | |
| mode: restart | |
| max_exceeded: silent | |
| variables: | |
| scene_early_morning: !input scene_early_morning | |
| scene_morning: !input scene_morning | |
| scene_day: !input scene_day | |
| scene_early_evening: !input scene_early_evening | |
| scene_evening: !input scene_evening | |
| scene_late_evening: !input scene_late_evening | |
| scene_night: !input scene_night | |
| no_motion_blocker: !input no_motion_blocker | |
| no_motion_blocker_boolean: !input no_motion_blocker_boolean | |
| scene_no_motion: !input scene_no_motion | |
| motion_entity: !input motion_entity | |
| trigger: | |
| - platform: state | |
| entity_id: !input motion_entity | |
| from: "off" | |
| to: "on" | |
| - platform: state | |
| entity_id: !input motion_entity | |
| from: "on" | |
| to: "off" | |
| for: !input no_motion_wait | |
| action: | |
| - choose: | |
| # Trigger to state == "on" | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ trigger.to_state.state == 'on' }}" | |
| sequence: | |
| - choose: | |
| # Early Morning Scene | |
| - conditions: | |
| - "{{ scene_early_morning != 'scene.none'}}" | |
| - condition: time | |
| after: !input time_scene_early_morning | |
| before: !input time_scene_morning | |
| sequence: | |
| - scene: !input scene_early_morning | |
| # Morning Scene | |
| - conditions: | |
| - "{{ scene_morning != 'scene.none'}}" | |
| - condition: time | |
| after: !input time_scene_morning | |
| before: !input time_scene_day | |
| sequence: | |
| - scene: !input scene_morning | |
| # Day Scene | |
| - conditions: | |
| - "{{ scene_day != 'scene.none'}}" | |
| - condition: time | |
| after: !input time_scene_day | |
| before: !input time_scene_early_evening | |
| sequence: | |
| - scene: !input scene_day | |
| # Early Evening Scene | |
| - conditions: | |
| - "{{ scene_evening != 'scene.none'}}" | |
| - condition: time | |
| after: !input time_scene_early_evening | |
| before: !input time_scene_evening | |
| sequence: | |
| - scene: !input scene_early_evening | |
| # Evening Scene | |
| - conditions: | |
| - "{{ scene_evening != 'scene.none'}}" | |
| - condition: time | |
| after: !input time_scene_evening | |
| before: !input time_scene_late_evening | |
| sequence: | |
| - scene: !input scene_evening | |
| # Late Evening Scene | |
| - conditions: | |
| - "{{ scene_evening != 'scene.none'}}" | |
| - condition: time | |
| after: !input time_scene_late_evening | |
| before: !input time_scene_night | |
| sequence: | |
| - scene: !input scene_late_evening | |
| # Night Scene | |
| - conditions: | |
| - "{{ scene_night != 'scene.none'}}" | |
| - condition: time | |
| after: !input time_scene_night | |
| before: !input time_scene_early_morning | |
| sequence: | |
| - scene: !input scene_night | |
| # If State -> "On" defaulting to turn light on | |
| default: | |
| - service: light.turn_on | |
| target: !input light_target | |
| # Trigger to state = "off" | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ trigger.to_state.state == 'off' }}" | |
| # Check if no motion blocker exist or in in desired state, otherwise do not run any no motion action | |
| - condition: or | |
| conditions: | |
| - "{{ no_motion_blocker == none }}" | |
| - "{{ no_motion_blocker_boolean and states[no_motion_blocker].state == 'on' }}" | |
| - "{{ not no_motion_blocker_boolean and states[no_motion_blocker].state == 'off' }}" | |
| sequence: | |
| - choose: | |
| # Used if default no motion scene is set | |
| - conditions: | |
| - "{{ scene_no_motion != 'scene.none' }}" | |
| sequence: | |
| - scene: !input scene_no_motion | |
| # If State -> "off" default to turn lights off | |
| default: | |
| - service: light.turn_off | |
| target: !input light_target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment