NFL
NFL - Groups
nfl_teams:
name: nfl_teams
entities:
- sensor.arizona_cardinals
- sensor.atlanta_falcons
- sensor.baltimore_ravens
- sensor.buffalo_bills
- sensor.carolina_panthers
- sensor.chicago_bears
- sensor.cincinnati_bengals
- sensor.cleveland_browns
- sensor.dallas_cowboys
- sensor.denver_broncos
- sensor.detroit_lions
- sensor.green_bay_packers
- sensor.houston_texans
- sensor.indianapolis_colts
- sensor.jacksonville_jaguars
- sensor.kansas_city_chiefs
- sensor.las_vegas_raiders
- sensor.los_angeles_chargers
- sensor.los_angeles_rams
- sensor.miami_dolphins
- sensor.minnesota_vikings
- sensor.new_england_patriots
- sensor.new_orleans_saints
- sensor.new_york_giants
- sensor.new_york_jets
- sensor.philadelphia_eagles
- sensor.pittsburg_steelers
- sensor.san_francisco_49ers
- sensor.seattle_seahawks
- sensor.tampa_bay_buccaneers
- sensor.tennessee_titans
- sensor.washington_commanders
nfl_al_teams:
name: nfl_al_teams
entities:
- sensor.baltimore_ravens
- sensor.buffalo_bills
- sensor.cincinnati_bengals
- sensor.cleveland_browns
- sensor.denver_broncos
- sensor.houston_texans
- sensor.indianapolis_colts
- sensor.jacksonville_jaguars
- sensor.kansas_city_chiefs
- sensor.las_vegas_raiders
- sensor.los_angeles_chargers
- sensor.miami_dolphins
- sensor.new_england_patriots
- sensor.new_york_jets
- sensor.pittsburg_steelers
- sensor.tennessee_titans
nfl_nl_teams:
name: nfl_nl_teams
entities:
- sensor.arizona_cardinals
- sensor.atlanta_falcons
- sensor.carolina_panthers
- sensor.chicago_bears
- sensor.dallas_cowboys
- sensor.detroit_lions
- sensor.green_bay_packers
- sensor.los_angeles_rams
- sensor.minnesota_vikings
- sensor.new_orleans_saints
- sensor.new_york_giants
- sensor.philadelphia_eagles
- sensor.san_francisco_49ers
- sensor.seattle_seahawks
- sensor.tampa_bay_buccaneers
- sensor.washington_commanders
NFL - REST sensors
##
## Wildcards
##
- resource: https://site.web.api.espn.com/apis/v2/sports/football/nfl/standings?region=us&lang=en&contentorigin=espn&type=3&level=2&sort=playoffseed%3Aasc%2Cpoints%3Adesc%2Cgamesplayed%3Aasc%2Crotwins%3Adesc&seasontype=2
# every 10 hours
scan_interval: 36000
sensor:
- name: "NFL Wildcard"
unique_id: nfl_wildcard
icon: mdi:baseball
json_attributes:
- children
- overall
value_template: "{{ now() }}"
##
## Playoff Standings
##
- resource: https://site.web.api.espn.com/apis/v2/sports/football/nfl/standings?region=us&lang=en&contentorigin=espn&type=3&level=3&sort=playoffseed:asc,points:desc,gamesplayed:asc,rotwins:desc&seasontype=2
# every 10 hours
scan_interval: 36000
sensor:
- name: "NFL PO Standings"
unique_id: nfl_po_standings
icon: mdi:football
json_attributes:
- children
- overall
value_template: "{{ now() }}"
##
## Playoff Standings- Postseason
##
- resource_template: "https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard?limit=1000&dates={{ now().year }}"
# every 10 hours
scan_interval: 36000
sensor:
- name: "NFL Standings Postseason"
unique_id: nfl_standings_postseason
json_attributes:
- leagues
- events
value_template: "{{ now() }}"
##
## Schedule
##
- resource: https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard
# every 24 hours
scan_interval: 86400
sensor:
- name: "NFL Schedule"
unique_id: nfl_schedule
icon: mdi:football
json_attributes:
- events
value_template: "{{ now() }}"
NFL - Template Sensors
###
### TV Coverage
###
- sensor:
- name: NFL PO TV Coverage
unique_id: nfl_po_tv_coverage
device_class: timestamp
icon: mdi:baseball
state: "{{ now() }}"
attributes:
entries: >
{%- set ns = namespace(results=[], tv_channels=[], game_ctr=0, ctr=0, home='', away='') -%}
{%- set po_tv = state_attr("sensor.nfl_schedule", 'events') | list %}
{% for po_tv_sched in po_tv %}
{%- set ns.tv_channels = [] -%}
{% for game in po_tv_sched['competitions'] %}
{% set gm_dte = as_local(as_datetime(game.startDate)).strftime('%Y-%m-%d %H:%M:%S') %}
{% set game_dte = as_local(as_datetime(game.startDate)).strftime('%b %d') %}
{% set game_time = as_local(as_datetime(game.startDate)).strftime('%I:%M %p') %}
{% for channel in game['broadcasts'] %}
{%- set ns.tv_channels = ns.tv_channels + [channel.names[0]] -%}
{% endfor -%}
{%- set ns.ctr = 0 %}
{% for team in game['competitors'] %}
{%- if team.homeAway == 'home' %}
{%- set ns.home = team.team.displayName %}
{% else -%}
{%- set ns.away = team.team.displayName %}
{% endif -%}
{%- if ns.ctr == 1 %}
{% set ns.results = ns.results + [{'date': game_dte, 'time': game_time, 'home': ns.home, 'away': ns.away, 'tv': ns.tv_channels, 'gm_dte': gm_dte}] %}
{% endif -%}
{%- set ns.ctr = ns.ctr + 1 %}
{% endfor -%}
{%- set ns.game_ctr = ns.game_ctr + 1 %}
{%- endfor -%}
{%- endfor -%}
{{ ns.results }}
###
### National Football League
###
###
### Obtain Playoff Seeds, Playoff Games by League, and Teams by "Bracket" (WildCard, Division, League, "World")
###
###
### Wildcards - Used in Playoffs Tab to Forecast until the Playoff season starts
###
- sensor:
- name: NFL Wildcard Standings
unique_id: sensor.nfl_wildcard_standings
state: "{{ now() }}"
attributes:
nfl_afc_east_top: "{{ state_attr('sensor.nfl_po_standings','children')[0]['standings']['entries'][:1] }}"
nfl_afc_north_top: "{{ state_attr('sensor.nfl_po_standings','children')[0]['children'][1]['standings']['entries'][:1] }}"
nfl_afc_south_top: "{{ state_attr('sensor.nfl_po_standings','children')[0]['children'][2]['standings']['entries'][:1] }}"
nfl_afc_west_top: "{{ state_attr('sensor.nfl_po_standings','children')[0]['children'][3]['standings']['entries'][:1] }}"
nfl_afc_wc: >
{% set afc_east_top = state_attr('sensor.nfl_po_standings','children')[0]['children'][0]['standings']['entries'] %}
{% set afc_north_top = state_attr('sensor.nfl_po_standings','children')[0]['children'][1]['standings']['entries'] %}
{% set afc_south_top = state_attr('sensor.nfl_po_standings','children')[0]['children'][2]['standings']['entries'] %}
{% set afc_west_top = state_attr('sensor.nfl_po_standings','children')[0]['children'][3]['standings']['entries'] %}
{% set afc_east_name = afc_east_top[:1][0].team.displayName %}
{% set afc_north_name = afc_north_top[:1][0].team.displayName %}
{% set afc_south_name = afc_south_top[:1][0].team.displayName %}
{% set afc_west_name = afc_west_top[:1][0].team.displayName %}
{% set amer_all = state_attr('sensor.nfl_wildcard','children')[0]['standings']['entries'] %}
{% set afc_wc = amer_all |
rejectattr('team.displayName', 'eq', afc_east_name) |
rejectattr('team.displayName', 'eq', afc_north_name) |
rejectattr('team.displayName', 'eq', afc_south_name) |
rejectattr('team.displayName', 'eq', afc_west_name) | list %}
{{ afc_wc[:3] }}
nfl_afc_hunt: >
{% set afc_east_top = state_attr('sensor.nfl_po_standings','children')[0]['children'][0]['standings']['entries'] %}
{% set afc_north_top = state_attr('sensor.nfl_po_standings','children')[0]['children'][1]['standings']['entries'] %}
{% set afc_south_top = state_attr('sensor.nfl_po_standings','children')[0]['children'][2]['standings']['entries'] %}
{% set afc_west_top = state_attr('sensor.nfl_po_standings','children')[0]['children'][3]['standings']['entries'] %}
{% set afc_east_name = afc_east_top[:1][0].team.displayName %}
{% set afc_north_name = afc_north_top[:1][0].team.displayName %}
{% set afc_south_name = afc_south_top[:1][0].team.displayName %}
{% set afc_west_name = afc_west_top[:1][0].team.displayName %}
{% set amer_all = state_attr('sensor.nfl_wildcard','children')[0]['standings']['entries'] %}
{% set amer_wc = amer_all |
rejectattr('team.displayName', 'eq', afc_east_name) |
rejectattr('team.displayName', 'eq', afc_north_name) |
rejectattr('team.displayName', 'eq', afc_south_name) |
rejectattr('team.displayName', 'eq', afc_west_name) | list %}
{% set wc = amer_wc[:3] %}
{% set wc_east_one_name = wc[0].team.displayName %}
{% set wc_east_two_name = wc[1].team.displayName %}
{% set wc_east_three_name = wc[2].team.displayName %}
{% set amer_hunt = amer_all |
rejectattr('team.displayName', 'eq', afc_east_name) |
rejectattr('team.displayName', 'eq', afc_north_name) |
rejectattr('team.displayName', 'eq', afc_south_name) |
rejectattr('team.displayName', 'eq', afc_west_name) |
rejectattr('team.displayName', 'eq', wc_east_one_name) |
rejectattr('team.displayName', 'eq', wc_east_two_name) |
rejectattr('team.displayName', 'eq', wc_east_three_name) | list %}
{{ amer_hunt[:2] }}
nfl_afc_eliminated: >
{%- set wc_teams = state_attr('sensor.nfl_wildcard','children')[0]['standings']['entries'] |
sort(attribute="stats.playoffSeed") -%}
{{ wc_teams[9:] }}
nfl_nfc_east_top: "{{ state_attr('sensor.nfl_po_standings','children')[1]['children'][0]['standings']['entries'][:1] }}"
nfl_nfc_north_top: "{{ state_attr('sensor.nfl_po_standings','children')[1]['children'][1]['standings']['entries'][:1] }}"
nfl_nfc_south_top: "{{ state_attr('sensor.nfl_po_standings','children')[1]['children'][2]['standings']['entries'][:1] }}"
nfl_nfc_west_top: "{{ state_attr('sensor.nfl_po_standings','children')[1]['children'][3]['standings']['entries'][:1] }}"
nfl_nfc_wc: >
{% set nfc_east_top = state_attr('sensor.nfl_po_standings','children')[1]['children'][0]['standings']['entries'] %}
{% set nfc_north_top = state_attr('sensor.nfl_po_standings','children')[1]['children'][1]['standings']['entries'] %}
{% set nfc_south_top = state_attr('sensor.nfl_po_standings','children')[1]['children'][2]['standings']['entries'] %}
{% set nfc_west_top = state_attr('sensor.nfl_po_standings','children')[1]['children'][3]['standings']['entries'] %}
{% set nfc_east_name = nfc_east_top[:1][0].team.displayName %}
{% set nfc_north_name = nfc_north_top[:1][0].team.displayName %}
{% set nfc_south_name = nfc_south_top[:1][0].team.displayName %}
{% set nfc_west_name = nfc_west_top[:1][0].team.displayName %}
{% set amer_all = state_attr('sensor.nfl_wildcard','children')[1]['standings']['entries'] %}
{% set nfc_wc = amer_all |
rejectattr('team.displayName', 'eq', nfc_east_name) |
rejectattr('team.displayName', 'eq', nfc_north_name) |
rejectattr('team.displayName', 'eq', nfc_south_name) |
rejectattr('team.displayName', 'eq', nfc_west_name) | list %}
{{ nfc_wc[:3] }}
nfl_nfc_hunt: >
{% set nfc_east_top = state_attr('sensor.nfl_po_standings','children')[1]['children'][0]['standings']['entries'] %}
{% set nfc_north_top = state_attr('sensor.nfl_po_standings','children')[1]['children'][1]['standings']['entries'] %}
{% set nfc_south_top = state_attr('sensor.nfl_po_standings','children')[1]['children'][2]['standings']['entries'] %}
{% set nfc_west_top = state_attr('sensor.nfl_po_standings','children')[1]['children'][3]['standings']['entries'] %}
{% set nfc_east_name = nfc_east_top[:1][0].team.displayName %}
{% set nfc_north_name = nfc_north_top[:1][0].team.displayName %}
{% set nfc_south_name = nfc_south_top[:1][0].team.displayName %}
{% set nfc_west_name = nfc_west_top[:1][0].team.displayName %}
{% set amer_all = state_attr('sensor.nfl_wildcard','children')[1]['standings']['entries'] %}
{% set amer_wc = amer_all |
rejectattr('team.displayName', 'eq', nfc_east_name) |
rejectattr('team.displayName', 'eq', nfc_north_name) |
rejectattr('team.displayName', 'eq', nfc_south_name) |
rejectattr('team.displayName', 'eq', nfc_west_name) | list %}
{% set wc = amer_wc[:3] %}
{% set wc_east_one_name = wc[0].team.displayName %}
{% set wc_east_two_name = wc[1].team.displayName %}
{% set wc_east_three_name = wc[2].team.displayName %}
{% set amer_hunt = amer_all |
rejectattr('team.displayName', 'eq', nfc_east_name) |
rejectattr('team.displayName', 'eq', nfc_north_name) |
rejectattr('team.displayName', 'eq', nfc_south_name) |
rejectattr('team.displayName', 'eq', nfc_west_name) |
rejectattr('team.displayName', 'eq', wc_east_one_name) |
rejectattr('team.displayName', 'eq', wc_east_two_name) |
rejectattr('team.displayName', 'eq', wc_east_three_name) | list %}
{{ amer_hunt[:2] }}
nfl_nfc_eliminated: >
{%- set wc_teams = state_attr('sensor.nfl_wildcard','children')[1]['standings']['entries'] |
sort(attribute="stats.playoffSeed") -%}
{{ wc_teams[9:] }}
entries: >
{%- set ns = namespace(ateams=[],nteams=[],afce_team=[],nfce_team=[],results=[]) -%}
{%- set elim_def = 'Eliminated from Playoff Contention' -%}
{%- set al_dict = {'league':'AL'} -%}
{%- set nl_dict = {'league':'NL'} -%}
{%- set ns.ateams = ns.ateams + state_attr('sensor.nfl_standings','children')[0]['children'][0]['standings']['entries'] -%}
{%- set ns.ateams = ns.ateams + state_attr('sensor.nfl_standings','children')[0]['children'][1]['standings']['entries'] -%}
{%- set ns.ateams = ns.ateams + state_attr('sensor.nfl_standings','children')[0]['children'][2]['standings']['entries'] -%}
{%- set ns.ateams = ns.ateams + state_attr('sensor.nfl_standings','children')[0]['children'][3]['standings']['entries'] -%}
{% set ns.nteams = ns.nteams + state_attr('sensor.nfl_standings','children')[1]['children'][0]['standings']['entries'] %}
{% set ns.nteams = ns.nteams + state_attr('sensor.nfl_standings','children')[1]['children'][1]['standings']['entries'] %}
{% set ns.nteams = ns.nteams + state_attr('sensor.nfl_standings','children')[1]['children'][2]['standings']['entries'] %}
{% set ns.nteams = ns.nteams + state_attr('sensor.nfl_standings','children')[1]['children'][3]['standings']['entries'] %}
{%- for team in ns.ateams -%}
{%- set po_stat = team.stats | selectattr('name','eq','clincher') | map(attribute='description') | list -%}
{%- if po_stat[0] != elim_def -%}
{%- set rec_dict = dict(team.items(), **al_dict) -%}
{%- set ns.afce_team = ns.afce_team + [rec_dict] -%}
{%- endif -%}
{%- endfor -%}
{%- for team in ns.nteams -%}
{%- set po_stat = team.stats | selectattr('name','eq','clincher') | map(attribute='description') | list -%}
{%- if po_stat[0] != elim_def -%}
{%- set rec_dict = dict(team.items(), **nl_dict) -%}
{%- set ns.nfce_team = ns.nfce_team + [rec_dict] -%}
{%- endif %}
{%- endfor %}
{%- set tmp_teams = ns.afce_team + ns.nfce_team -%}
{{ tmp_teams }}
# ###
# ### Playoffs Seeds
# ###
- sensor:
- name: NFL Playoff Seeds
unique_id: sensor.nfl_playoff_seeds
state: "{{ now() }}"
attributes:
entries: >
{%- set ns = namespace(results=[], tmp_recs=[]) -%}
{%- for team in state_attr('sensor.nfl_wildcard_standings', 'entries') -%}
{%- set position = team.stats | selectattr('name','eq','clincher') | map(attribute='description') | list -%}
{%- set home_rec = team.stats | selectattr('name','eq','Home') | map(attribute='displayValue') | list -%}
{%- set away_rec = team.stats | selectattr('name','eq','Road') | map(attribute='displayValue') | list -%}
{%- set seed_val = team.stats | selectattr('name','eq','playoffSeed') | map(attribute='value') | list -%}
{%- set seed = seed_val[0] | int -%}
{%- set logo = team.team.logos[0].href -%}
{%- set ns.results = ns.results + [{ 'team': {'name': team.team.displayName, 'league':team.league, 'seed': seed,
'po_status': position[0],'home_rec': home_rec[0], 'away_rec': away_rec[0],'logo': logo}}] -%}
{%- endfor -%}
{%- set ns.tmp_recs = ns.results | sort(attribute='team.league,team.seed') -%}
{{ ns.tmp_recs }}
po_amer_wc_seeds: >
{%- set ns = namespace(results=[], amer_result=[], ctr=0) -%}
{%- for team in state_attr('sensor.nfl_wildcard_standings', 'entries') | selectattr('league','eq','AL') | list -%}
{%- set position = team.stats | selectattr('name','eq','clincher') | map(attribute='description') | list -%}
{%- set home_rec = team.stats | selectattr('name','eq','Home') | map(attribute='displayValue') | list -%}
{%- set away_rec = team.stats | selectattr('name','eq','Road') | map(attribute='displayValue') | list -%}
{%- set seed_val = team.stats | selectattr('name','eq','playoffSeed') | map(attribute='value') | list -%}
{%- set seed = seed_val[0] | int -%}
{%- set logo = team.team.logos[0].href -%}
{%- set ns.results = ns.results + [{ 'team': {'name': team.team.displayName, 'league': team.league,
'seed': seed, 'po_status': position[0], 'home_rec': home_rec[0], 'away_rec': away_rec[0],
'logo': logo}}] -%}
{%- endfor -%}
{% set ns.amer_result = ns.results | sort(attribute='team.seed') %}
{{ ns.amer_result }}
po_natl_wc_seeds: >
{%- set ns = namespace(results=[], natl_result=[], ctr=0) -%}
{%- for team in state_attr('sensor.nfl_wildcard_standings', 'entries') | selectattr('league','eq','NL') | list -%}
{%- set position = team.stats | selectattr('name','eq','clincher') | map(attribute='description') | list -%}
{%- set home_rec = team.stats | selectattr('name','eq','Home') | map(attribute='displayValue') | list -%}
{%- set away_rec = team.stats | selectattr('name','eq','Road') | map(attribute='displayValue') | list -%}
{%- set seed_val = team.stats | selectattr('name','eq','playoffSeed') | map(attribute='value') | list -%}
{%- set seed = seed_val[0] | int -%}
{%- set logo = team.team.logos[0].href -%}
{%- set ns.results = ns.results + [{ 'team': {'name': team.team.displayName, 'league': team.league,
'seed': seed, 'po_status': position[0], 'home_rec': home_rec[0], 'away_rec': away_rec[0],
'logo': logo}}] -%}
{%- endfor -%}
{% set ns.natl_result = ns.results | sort(attribute='team.seed') %}
{{ ns.natl_result }}
###
### Playoffs - Games
###
- sensor:
- name: NFL PO Games
unique_id: sensor.nfl_po_games
device_class: timestamp
icon: mdi:football
state: "{{ now() }}"
attributes:
entries: >
{%- set ns = namespace(results=[],sorted=[],gtype='',leag='',agctr=1,nlctr=1,gctr=1,ser_gm=1,tv='',weather='',odds='',hscore=0,ascore=0,winner='') -%}
{%- set po_schedule = state_attr("sensor.nfl_standings_postseason", 'events') -%}
{%- set po_sched_teams = po_schedule | selectattr('season.slug','eq','post-season') | sort(attribute='date') | list -%}
{%- set tday = as_local(now()).strftime('%Y-%m-%d') -%}
{%- set seeds = 'sensor.nfl_playoff_seeds' -%}
{%- set al_teams = expand('group.nfl_al_teams') | map(attribute='attributes.friendly_name') | list -%}
{%- set nl_teams = expand('group.nfl_nl_teams') | map(attribute='attributes.friendly_name') | list -%}
{%- set tmp_teams = ['TBD','AFC','NFC'] -%}
{% for evt in po_sched_teams -%}
{% if evt.competitions[0].notes[0].headline is search('Pro Bowl') %}
{%- continue -%}
{%- else -%}
{%- set game_dte = '{}'.format(evt.competitions[0].date) | as_datetime | as_timestamp | timestamp_custom('%b %d at %I:%M %p') -%}
{%- set game_day = as_local(as_datetime(evt.competitions[0].date)).strftime('%Y-%m-%d') -%}
{%- set gm_dte = as_local(as_datetime(evt.competitions[0].date)).strftime('%Y-%m-%d %H:%M:%S') -%}
{% if evt.competitions[0].notes[0].headline is search('Super Bowl') %}
{%- set ns.gtype = 'Super Bowl' -%}
{%- set ns.series = 4 -%}
{%- elif evt.competitions[0].notes[0].headline is search('Championship') -%}
{%- set ns.gtype = 'Championship' -%}
{%- set ns.series = 3 -%}
{%- elif evt.competitions[0].notes[0].headline is search('Divisional Playoffs') -%}
{%- set ns.gtype = 'Divisional Playoffs' -%}
{%- set ns.series = 2 -%}
{%- else -%}
{%- set ns.gtype = 'Wild Card' -%}
{%- set ns.series = 1 -%}
{%- endif -%}
{% if evt.competitions[0].broadcasts | length != 0 %}
{%- set ns.tv = evt.competitions[0].broadcasts[0].names[0] -%}
{%- else -%}
{%- set ns.tv = 'N/A' -%}
{%- endif -%}
{%- if game_day == tday %}
{%- set ns.stat = 'Ongoing' -%}
{%- elif game_day <= tday %}
{%- set ns.stat = 'Final' -%}
{%- else -%}
{%- set ns.stat = 'Ongoing' -%}
{% endif %}
{% if evt.weather is defined %}
{%- set ns.weather = evt.weather.displayValue + " " + (evt.weather.temperature | string) -%}
{%- else -%}
{%- set ns.weather = '' -%}
{% endif %}
{% for game in evt.competitions -%}
{%- if game.odds is defined -%}
{%- set ns.odds = game.odds[0].provider.name +": "+ game.odds[0].details +" OverUnder: "+ (game.odds[0].overUnder | string) + " Spread: "+ (game.odds[0].spread | string)-%}
{%- else -%}
{%- set ns.odds = 'N/A' -%}
{%- endif -%}
{%- set ns.winner = '' -%}
{%- for team in game['competitors'] -%}
{%- set team_name = team.team.displayName -%}
{%- if team.homeAway == 'home' -%}
{%- if team_name in tmp_teams -%}
{%- set ns.home = 'TBD' -%}
{%- else -%}
{% set ns.home = team_name -%}
{%- if ns.stat == 'Final' and team.score is defined -%}
{%- set ns.hscore = team.score | int -%}
{%- else -%}
{%- set ns.hscore = 0 -%}
{%- endif -%}
{%- endif -%}
{%- else -%}
{%- if team_name in tmp_teams -%}
{%- set ns.away = 'TBD' -%}
{%- else -%}
{%- set ns.away = team_name -%}
{%- if ns.stat == 'Final' and team.score is defined -%}
{%- set ns.ascore = team.score | int -%}
{%- else -%}
{%- set ns.ascore = 0 -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- if team_name in tmp_teams and evt.competitions[0].notes[0].headline is search('AFC Championship') %}
{%- set ns.leag = 'AL' -%}
{% elif team_name in tmp_teams and evt.competitions[0].notes[0].headline is search('NFC Championship') %}
{%- set ns.leag = 'NL' -%}
{%- else -%}
{%- if team_name in al_teams -%}
{%- set ns.leag = 'AL' -%}
{%- elif team_name in nl_teams -%}
{%- set ns.leag = 'NL' -%}
{%- else -%}
{%- continue -%}
{%- endif -%}
{%- endif -%}
{% endfor -%}
{%- if ns.stat == 'Final' -%}
{%- if ns.hscore > ns.ascore -%}
{%- set ns.winner = ns.home -%}
{%- set ns.loser = ns.away -%}
{%- else -%}
{%- set ns.winner = ns.away -%}
{%- set ns.loser = ns.home -%}
{%- endif -%}
{%- else -%}
{%- set ns.winner = '' -%}
{%- set ns.loser = '' -%}
{%- endif -%}
{%- if ns.leag == 'AL' -%}
{%- set ns.gctr = ns.agctr -%}
{%- set ns.agctr = ns.agctr + 1 -%}
{%- elif ns.leag == 'NL' -%}
{%- set ns.gctr = ns.nlctr -%}
{%- set ns.nlctr = ns.nlctr + 1 -%}
{%- else -%}
{%- continue -%}
{%- endif -%}
{%- set ns.results = ns.results + [{'date': game_day,'dte': game_dte,'Game': ns.gtype,'seriesStatus': ns.stat,'league': ns.leag,
'gm_dte': gm_dte, 'winner': ns.winner,'loser': ns.loser,'home': ns.home,'away': ns.away,'home_score': ns.hscore,'away_score': ns.ascore,
'seriesNumber': ns.series, 'gameNumber': ns.gctr, 'gamesInSeries': "1", 'seriesGameNumber':"1",'odds':ns.odds,'weather':ns.weather}] -%}
{%- endfor -%}
{%- endif -%}
{% endfor -%}
{{ ns.results }}
- sensor:
- name: NFL PO Amer Games
unique_id: sensor.nfl_po_amer_games
device_class: timestamp
icon: mdi:football
state: "{{ now() }}"
attributes:
entries: >
{%- set po_schedule = state_attr("sensor.nfl_po_games", 'entries') -%}
{%- set po_sched_teams = po_schedule | selectattr('league','eq','AL') | list -%}
{{ po_sched_teams }}
- sensor:
- name: NFL PO Natl Games
unique_id: sensor.nfl_po_natl_games
device_class: timestamp
icon: mdi:football
state: "{{ now() }}"
attributes:
entries: >
{%- set po_schedule = state_attr("sensor.nfl_po_games", 'entries') -%}
{%- set po_sched_teams = po_schedule | selectattr('league','eq','NL') | list -%}
{{ po_sched_teams }}
###
### Playoffs - Wildcard Games
###
- sensor:
- name: NFL PO Amer WC Games
unique_id: sensor.nfl_po_amer_wc_games
device_class: timestamp
icon: mdi:baseball
state: "{{ now() }}"
attributes:
entries: >
{%- set po_schedule = state_attr("sensor.nfl_po_amer_games", 'entries') -%}
{%- set po_sched_teams = po_schedule | selectattr('league','eq','AL') | list -%}
{{ po_sched_teams }}
- sensor:
- name: NFL PO Natl WC Games
unique_id: sensor.nfl_po_natl_wc_games
device_class: timestamp
icon: mdi:baseball
state: "{{ now() }}"
attributes:
entries: >
{%- set po_schedule = state_attr("sensor.nfl_po_natl_games", 'entries') -%}
{%- set po_sched_teams = po_schedule | selectattr('league','eq','NL') | list -%}
{{ po_sched_teams }}
###
### Playoffs - Division Games
###
- sensor:
- name: NFL PO Amer Div Games
unique_id: sensor.nfl_po_amer_div_games
device_class: timestamp
icon: mdi:football
state: "{{ now() }}"
attributes:
entries: >
{%- set po_sched_teams = state_attr("sensor.nfl_po_amer_games", 'entries') -%}
{%- set results = po_sched_teams | selectattr('Game','eq', 'Divisional Playoffs') | list %}
{{ results }}
- sensor:
- name: NFL PO Natl Div Games
unique_id: sensor.nfl_po_natl_div_games
device_class: timestamp
icon: mdi:football
state: "{{ now() }}"
attributes:
entries: >
{%- set po_sched_teams = state_attr("sensor.nfl_po_natl_games", 'entries') -%}
{%- set results = po_sched_teams | selectattr('Game','eq', 'Divisional Playoffs') | list %}
{{ results }}
###
### Playoffs - League Games
###
- sensor:
- name: NFL PO Amer Leag Games
unique_id: nfl_po_amer_leag_games
device_class: timestamp
icon: mdi:football
state: "{{ now() }}"
attributes:
entries: >
{%- set po_sched_teams = state_attr("sensor.nfl_po_amer_games", 'entries') -%}
{%- set results = po_sched_teams | selectattr('Game','eq', 'Championship') | list %}
{{ results }}
- sensor:
- name: NFL PO Natl Leag Games
unique_id: nfl_po_natl_leag_games
device_class: timestamp
icon: mdi:football
state: "{{ now() }}"
attributes:
entries: >
{%- set po_sched_teams = state_attr("sensor.nfl_po_natl_games" , 'entries') -%}
{%- set results = po_sched_teams | selectattr('Game','eq', 'Championship') | list %}
{{ results }}
###
### Playoffs - World Game
###
- sensor:
- name: NFL PO World Game
unique_id: nfl_po_world_game
device_class: timestamp
icon: mdi:football
state: "{{ now() }}"
attributes:
entries: >
{%- set po_sched_teams = state_attr("sensor.nfl_po_games" , 'entries') -%}
{%- set results = po_sched_teams | selectattr('Game','eq', 'Super Bowl') | list %}
{{ results }}
Part 2.1 of 4 (dashboard would not fit)