-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathschedule-action.yaml
More file actions
49 lines (44 loc) · 1.21 KB
/
schedule-action.yaml
File metadata and controls
49 lines (44 loc) · 1.21 KB
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
blueprint:
name: Schedule Action
description: Call actions based on schedule change state
domain: automation
input:
entity_schedule:
name: Schedule
description: Schedule to listen for state triggers
selector:
entity:
domain: schedule
multiple: false
entity_switch_on:
name: "On Actions"
description: Actions to run when schedule is changed to on
default: []
selector:
action: { }
entity_switch_off:
name: "Off Actions"
description: Actions to run when schedule is changed to off
default: []
selector:
action: { }
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: !input "entity_schedule"
to: 'on'
- platform: state
entity_id: !input "entity_schedule"
to: 'off'
action:
- variables:
entity_schedule: !input "entity_schedule"
payload: "{% if trigger.to_state|default(false,true) %}{{ trigger.to_state.state }}{% else %}{{ states(entity_schedule) }}{% endif %}"
- if:
- condition: template
value_template: "{{ payload == 'on' }}"
then:
- sequence: !input "entity_switch_on"
else:
- sequence: !input "entity_switch_off"