-
Notifications
You must be signed in to change notification settings - Fork 1
/
automation.tv_auto_tune.yaml
159 lines (159 loc) · 4.14 KB
/
automation.tv_auto_tune.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
alias: TV Auto Tune
trigger:
- entity_id: calendar.tv_auto_tune
from: "off"
platform: state
to: "on"
id: calendar
- platform: state
entity_id:
- calendar.tv_auto_tune
attribute: description
- platform: state
entity_id:
- calendar.carolina_panthers
from: "off"
to: "on"
id: panthers
- platform: state
entity_id:
- calendar.north_carolina_tar_heels_fball
from: "off"
to: "on"
id: heelsfball
- platform: state
entity_id:
- calendar.north_carolina_tar_heels_bball
from: "off"
to: "on"
id: heelsbball
- platform: state
entity_id:
- remote.living_room_tv
from: "off"
id: lrtv
for:
hours: 0
minutes: 0
seconds: 3
- platform: state
entity_id:
- remote.bedroom_android_tv
from: "off"
id: bedtv
for:
hours: 0
minutes: 0
seconds: 3
- platform: state
entity_id:
- sensor.carolina_panthers
from: PRE
to: IN
id: panthers
- platform: state
entity_id:
- sensor.unc_basketball
from: PRE
to: IN
id: heelsbball
- platform: state
entity_id:
- sensor.unc_football
id: heelsfball
from: PRE
to: IN
condition:
- condition: or
conditions:
- condition: not
conditions:
- condition: state
entity_id: remote.bedroom_android_tv
state: "off"
- condition: state
entity_id: remote.bedroom_android_tv
state: unavailable
- condition: not
conditions:
- condition: state
entity_id: remote.living_room_tv
state: "off"
- condition: state
entity_id: remote.living_room_tv
state: unavailable
- condition: or
conditions:
- condition: state
entity_id: calendar.tv_auto_tune
state: "on"
- condition: state
entity_id: calendar.carolina_panthers
state: "on"
- condition: state
entity_id: calendar.north_carolina_tar_heels_bball
state: "on"
- condition: state
entity_id: calendar.north_carolina_tar_heels_fball
state: "on"
- condition: state
entity_id: sensor.carolina_panthers
state: IN
- condition: state
entity_id: sensor.unc_basketball
state: IN
- condition: state
entity_id: sensor.unc_football
state: IN
action:
- alias: Set Channel
variables:
channel: >
{% if is_state('calendar.tv_auto_tune', 'on') %}
{{ state_attr("calendar.tv_auto_tune", "description") | upper }}
{% elif is_state('calendar.north_carolina_tar_heels_fball', 'on') or
is_state('sensor.unc_football', 'IN') %}
{{ state_attr('sensor.unc_football', 'tv_network') | upper }}
{% elif is_state('calendar.north_carolina_tar_heels_bball', 'on') or
is_state('sensor.unc_basketball', 'IN') %}
{{ state_attr('sensor.unc_basketball', 'tv_network') | upper }}
{% elif is_state('calendar.carolina_panthers', 'on') or
is_state('sensor.carolina_panthers', 'IN') %}
{{ state_attr('sensor.carolina_panthers', 'tv_network') | upper }}
{% endif %}
- if:
- condition: not
conditions:
- condition: trigger
id: bedtv
- condition: not
conditions:
- condition: state
entity_id: remote.living_room_tv
state: "off"
- condition: state
entity_id: remote.living_room_tv
state: unavailable
then:
- data:
channel: "{{ channel }}"
device: living_room_tv
service: script.tv_tune_channel
- if:
- condition: not
conditions:
- condition: trigger
id: lrtv
- condition: not
conditions:
- condition: state
entity_id: remote.bedroom_android_tv
state: "off"
- condition: state
entity_id: remote.bedroom_android_tv
state: unavailable
then:
- data:
channel: "{{ channel }}"
device: bedroom_android_tv
service: script.tv_tune_channel