-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.yaml
183 lines (183 loc) · 7.73 KB
/
template.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
###
### MLB Divisions
###
- name: MLB American East
unique_id: sensor.mlb_american_east
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.mlb_standings','children')[0]['children'][0]['standings']['entries'] }}"
- name: MLB American Central
unique_id: sensor.mlb_american_central
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.mlb_standings','children')[0]['children'][1]['standings']['entries'] }}"
- name: MLB American West
unique_id: sensor.mlb_american_west
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.mlb_standings','children')[0]['children'][2]['standings']['entries'] }}"
- name: MLB National East
unique_id: sensor.mlb_national_east
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.mlb_standings','children')[1]['children'][0]['standings']['entries'] }}"
- name: MLB National Central
unique_id: sensor.mlb_national_central
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.mlb_standings','children')[1]['children'][1]['standings']['entries'] }}"
- name: MLB National West
unique_id: sensor.mlb_national_west
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.mlb_standings','children')[1]['children'][2]['standings']['entries'] }}"
###
### NHL Divisions
###
- name: NHL East Atlantic
unique_id: sensor.nhl_east_atlantic
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nhl_standings','children')[0]['children'][0]['standings']['entries'] }}"
- name: NHL East Metropolitan
unique_id: sensor.nhl_east_metropolitan
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nhl_standings','children')[0]['children'][1]['standings']['entries'] }}"
- name: NHL West Central
unique_id: sensor.nhl_west_central
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nhl_standings','children')[1]['children'][0]['standings']['entries'] }}"
- name: NHL West Pacific
unique_id: sensor.nhl_west_pacific
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nhl_standings','children')[1]['children'][1]['standings']['entries'] }}"
###
### NHL Wildcard
###
- name: NHL Wildcard Standings
unique_id: sensor.nhl_wildcard_standings
state: "{{ now() }}"
attributes:
east_atlantic_top: "{{ state_attr('sensor.nhl_wildcard','overall')[0]['children'][0]['standings']['entries'] }}"
east_metropolitan_top: "{{ state_attr('sensor.nhl_wildcard','overall')[0]['children'][1]['standings']['entries'] }}"
east_wildcard: "{{ state_attr('sensor.nhl_wildcard','children')[0]['standings']['entries'][:2] }}"
east_hunt: >
{% set hteams = namespace(hteam=[]) %}
{% for team in state_attr('sensor.nhl_wildcard','children')[0]['standings']['entries'][2:] %}
{% for stat in team['stats'] | selectattr('name','eq','clincher') %}
{% else %}
{% set hteams.hteam = hteams.hteam + [team] %}
{% endfor %}
{% endfor %}
{{ hteams.hteam }}
east_eliminated: >
{% set eteams = namespace(eteam=[]) %}
{% for team in state_attr('sensor.nhl_wildcard','children')[0]['standings']['entries'][2:] %}
{% for stat in team['stats'] %}
{% if stat.name == 'clincher' %}
{% set eteams.eteam = eteams.eteam + [team] %}
{% endif %}
{% endfor %}
{% endfor %}
{{ eteams.eteam }}
west_central_top: "{{ state_attr('sensor.nhl_wildcard','overall')[1]['children'][0]['standings']['entries'] }}"
west_pacific_top: "{{ state_attr('sensor.nhl_wildcard','overall')[1]['children'][1]['standings']['entries'] }}"
west_wildcard: "{{ state_attr('sensor.nhl_wildcard','children')[1]['standings']['entries'][:2] }}"
west_hunt: >
{% set hteams = namespace(hteam=[]) %}
{% for team in state_attr('sensor.nhl_wildcard','children')[1]['standings']['entries'][2:] %}
{% for stat in team['stats'] | selectattr('name','eq','clincher') %}
{% else %}
{% set hteams.hteam = hteams.hteam + [team] %}
{% endfor %}
{% endfor %}
{{ hteams.hteam }}
west_eliminated: >
{% set eteams = namespace(eteam=[]) %}
{% for team in state_attr('sensor.nhl_wildcard','children')[1]['standings']['entries'][2:] %}
{% for stat in team['stats'] %}
{% if stat.name == 'clincher' %}
{% set eteams.eteam = eteams.eteam + [team] %}
{% endif %}
{% endfor %}
{% endfor %}
{{ eteams.eteam }}
###
### NFL Divisions
###
- name: NFL AFC East
unique_id: sensor.nfl_afc_east
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nfl_standings','children')[0]['children'][0]['standings']['entries'] }}"
- name: NFL AFC North
unique_id: sensor.nfl_afc_north
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nfl_standings','children')[0]['children'][1]['standings']['entries'] }}"
- name: NFL AFC South
unique_id: sensor.nfl_afc_south
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nfl_standings','children')[0]['children'][2]['standings']['entries'] }}"
- name: NFL AFC West
unique_id: sensor.nfl_afc_west
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nfl_standings','children')[0]['children'][3]['standings']['entries'] }}"
- name: NFL NFC East
unique_id: sensor.nfl_nfc_east
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nfl_standings','children')[1]['children'][0]['standings']['entries'] }}"
- name: NFL NFC North
unique_id: sensor.nfl_nfc_north
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nfl_standings','children')[1]['children'][1]['standings']['entries'] }}"
- name: NFL NFC South
unique_id: sensor.nfl_nfc_south
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nfl_standings','children')[1]['children'][2]['standings']['entries'] }}"
- name: NFL NFC West
unique_id: sensor.nfl_nfc_west
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nfl_standings','children')[1]['children'][3]['standings']['entries'] }}"
###
### NBA Divisions
###
- name: NBA Eastern Atlantic
unique_id: sensor.nba_eastern_atlantic
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nba_standings','children')[0]['children'][0]['standings']['entries'] }}"
- name: NBA Eastern Central
unique_id: sensor.nba_eastern_central
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nba_standings','children')[0]['children'][1]['standings']['entries'] }}"
- name: NBA Eastern Southeast
unique_id: sensor.nba_eastern_southeast
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nba_standings','children')[0]['children'][2]['standings']['entries'] }}"
- name: NBA Western Northwest
unique_id: sensor.nba_western_northwest
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nba_standings','children')[1]['children'][0]['standings']['entries'] }}"
- name: NBA Western Pacific
unique_id: sensor.nba_western_pacific
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nba_standings','children')[1]['children'][1]['standings']['entries'] }}"
- name: NBA Western Southwest
unique_id: sensor.nba_western_southwest
state: "{{ now() }}"
attributes:
entries: "{{ state_attr('sensor.nba_standings','children')[1]['children'][2]['standings']['entries'] }}"