Real-Time Sports Scores w/ TeamTracker and TeamTracker-Card (Beta)

I use this. Add trigger entities as needed:

alias: Notify Game Ends
description: ""
mode: single
triggers:
  - entity_id:
      - sensor.texas_rangers
    to: POST
    from: IN
    trigger: state
conditions: []
actions:
  - variables:
      end_term: >-
        {% if trigger.to_state.attributes.sport == 'baseball' %} innings {% elif
        trigger.to_state.attributes.sport == 'hockey' %} periods {% elif
        trigger.to_state.attributes.sport == 'football' %} quarters {% else %}
        {% endif %}
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - data:
      title: >
        {{trigger.to_state.attributes.team_name}} vs 
        {{trigger.to_state.attributes.opponent_name}}
      message: >
        {{trigger.to_state.attributes.team_name}} {% if
        trigger.to_state.attributes.team_score|int >
        trigger.to_state.attributes.opponent_score|int %} win {% elif
        trigger.to_state.attributes.team_score|int <
        trigger.to_state.attributes.opponent_score|int %} lose {% else %} tie {%
        endif %} {{
        trigger.to_state.attributes.team_score}}-{{trigger.to_state.attributes.opponent_score}} 
        in  {{trigger.to_state.attributes.quarter}} {{end_term}}.
      data:
        image: "{{trigger.to_state.attributes.team_logo}}"
    action: notify.all_phones

Let us know if you need more.

The delay is because the wife would yell at me if she was notified before we saw it on our streaming service :slight_smile:

https://github.com/giasemidis/euroleague_api

1 Like

Salut can you post your code for the card? Do you have enter all teams from the ligue1 manually ?

So, I’ve got a tablet that I’m using as a home dashboard, and one of the things I want to have up on it is a few team tracker cards. The only issue is I want to lock down the tablet so that there’s no internet access (or at least, minimal internet access), but still be able to get team logos on the team tracker card. Of course, ESPN uses akamai so trying to nail down all the IP Addresses you’d need to open up is a can of worms, so limiting it that way is pretty much out of the question.

I could download all the assets for teams whose card I’d like to have up, or I could set up a reverse proxy - but then I’m stil stuck on how to update the cards so that they point to these local assets or the proxy. I think the path of least resistance is to use a helper entity to basically clone a team tracker entity and only update the logo attributes. I’m… Not certain how I could achieve that, though… Any ideas?

How often to team logos change? Just wondering. Not sure I see the issue here. Save them all off, block the tablet at the router, and serve the logos up locally.

Discovered you can create a template sensor and give it attributes, so duplicating it (and using a proxy) would look something like this, obviously use your own sensor and proxy address. Truncated for brevity’s sake, but you would just add all the attributes from the original team tracker sensor.

template:
	- sensor:
		- name: "Team name"
		state: {{ states('sensor.team_tracker' )}}
		attributes:
			attribution: "{{ state_attr('sensor.team_tracker', 'attribution') }}"
			sport: "{{ state_attr('sensor.team_tracker', 'sport') }}"
			league: "{{ state_attr('sensor.team_tracker', 'league') }}"
			league_logo: "{{ state_attr('sensor.team_tracker', 'league_logo') }} | regex_replace('https://a.espncdn.com', 'http://proxy')"

action: notify.all_phones does not work for me. Do I need to set this up separately?

Yes. You need to create a notify group.

Many threads on it. Here is one of them.
Sending notifications to a group - Feature Requests - Home Assistant Community

1 Like

Might have been written down here before, but I didn’t come up with a solution…

How do I make my game cards smaller? Not the text sizes but rather the spaces between the lines.

1 Like

Is there a better way of handling a scenario when there are no upcoming games for a team? Currently, instead of the normal football team logo and name etc, when the api returns no upcoming games, the card shows like this:
image

So it shows the League logo, and the team ID. Not sure if it would be possible to continue to show the team logo like normal, and the team name as well, or is this not possible due to the lack of any information coming back in the api during these breaks? For reference, I am using the integration type custom, with the sport path as soccer, the league path as eng.3, and the team ID 324. It was showing this way for a few days, due to an FA Cup game and no league games for a short spell, but has today reverted back to displaying correctly with the next upcoming league game:
image

No team name or logo is returned by the API in the first scenario so the league logo is the only thing available.

The Wiki shows how to use a Conditional card or an Auto Entities card to hide the NOT_FOUND card if you would prefer to display nothing.

Thank you - I should have paid more attention to the wiki :slight_smile:

I need to see the card only when the match is live.

This is the code I have

type: conditional
conditions:
  - condition: template
    value_template: "{{ state_attr('sensor.sri_lanka', 'clock') == 'Live' }}"
card:
  type: custom:teamtracker-card
  entity: sensor.sri_lanka

But I get an error like this

Untitledc

Please help

Just display it when the sensor state is IN

1 Like

PDC Darts World Cup starts soon! :partying_face: Anyone managed to get stats for darts? Does ESPN even have a darts scoreboard?

Hello all I have searched but failed to find the answer and my “figure it out on your own skills” Suck. Hope you can help. Getting this - TemplateError(‘ValueError: Template error: as_datetime got invalid input ‘None’ when rendering template ‘{{ as_datetime(state_attr(“sensor.san_francisco_49ers”,“date”)) - timedelta( hours = 3, minutes = 0 ) }}’ but no default was specified’) while processing template ‘Template<template=({{ as_datetime(state_attr(“sensor.san_francisco_49ers”,“date”)) - timedelta( hours = 3, minutes = 0 ) }}) renders=4>’ for attribute ‘_attr_native_value’ in entity ‘sensor.pre_game_san_francisco_49ers’ Question is- Is this a error? If Yes how do I correct it. or is throwing this because the game is not within the time?
FYI I see the “this topic has been solved” thing over to the right as I type but I could not find the answer, so again thank you for helping.

You will need to post your code here.

Use the preformatted text in the settings icon:
image

In general, that is a reference to something that is missing an attribute that was being referenced.

I am not aware of an ESPN API for darts. If you find one, lmk.

any guide that shows how to use this? :slight_smile: