/
suspend_motion_activation.yaml
62 lines (58 loc) · 1.55 KB
/
suspend_motion_activation.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
blueprint:
name: Suspend motion activation
description: Suspends a motion activation automation when a light is switched on
source_url: https://github.com/GordonFreemanK/ha-blueprints/blob/main/suspend_motion_activation.yaml
domain: automation
input:
lights:
name: Lights
description: The lights that will suspend the automations
selector:
entity:
domain: light
multiple: true
automations:
name: Automations
description: The automations that should be suspended when a light is switched on
selector:
entity:
domain: automation
multiple: true
duration:
name: Duration
description: The duration of the suspension
selector:
duration:
default:
minutes: 5
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: light_toggled
- platform: homeassistant
event: start
variables:
lights: !input lights
condition:
- condition: template
value_template: "{{ trigger.platform == 'homeassistant' or trigger.event.data.entity_id in lights }}"
action:
- if:
- condition: template
value_template: "{{ trigger.platform == 'event' and trigger.event.data.state }}"
then:
- service: automation.turn_off
target:
entity_id: !input automations
- delay: !input duration
- service: light.turn_off
target:
entity_id: !input lights
- service: automation.turn_on
target:
entity_id: !input automations
else:
- service: automation.turn_on
target:
entity_id: !input automations