The sensors are created when Home Assistant starts, so I’m thinking that probably won’t work.
What you easily could do, though, is to create sensors for all the teams you care about, then switch between them with the input select for whatever you are doing.
Or, depending on how many teams you are following, you could do what I do. I have something similar set up, but only for two teams. I have static sensors and automations for each, but they only trigger the lights and sirens if the associated input boolean is turned on. This works, even if my two teams are playing each other.
I am not sure if something like this has been posted or not.
I want to share our situation and what I have coded for it.
We do not track all MLB teams. Just some of them. I use auto-entities to build the card. Of course, if two teams we are tracking play each other, we get two teamtracker-cards.
Thanks to @kbrown01 for the original auto-entities template I started with. I have built upon that to build a namespace with team_sensor from the teamtracker integration and the event_name from the sensor.
I feed that through unique on the event_name which removes the duplicates. Then build the teamtracker-card from that.
I hope someone finds this useful.
- type: custom:auto-entities
card:
type: entities
show_empty: false
filter:
template: |
{%- set ns = namespace(items=[]) -%}
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "league") == "MLB" -%}
{%- set ns.items = ns.items + [{"team_sensor": team, "event_name": state_attr(team, "event_name")}] -%}
{%- endif -%}
{%- endfor -%}
{%- for team in ns.items|unique(attribute="event_name") -%}
{{{"type": "custom:teamtracker-card","entity": team.team_sensor, "home_side": "right" }}},
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
options: null
sort:
method: attribute
attribute: team_id
This is really useful thank you! Cards look fantastic
I was wondering if anyone had any advice on
automations with the sensor. I have a WLED light strip and would like to use the “team colors” attribute (hex codes) when a game starts. Any ideas on how to do this?
Would it be easier to create a preset manually for the team colours then turn this on when a game starts? Thanks inadvance
For sports involving individual athletes, you should use the athlete’s name as the Team ID. You should use as much as is needed to uniquely identify the desired athlete.
I am trying to add the UFC to the home assistant. The standard integration is quite easy. It only shows the next card of the next event. I would like to see all the items on the next card.
I have however searched through a lot of topics. I haven’t found the solution yet. I don’t believe i am the only one that would like to see the complete CARD of the Upcoming event. I don’t have an athlete i wish to follow.
So, if multiple teams do not have an upcoming game, you only get one of them since there is no event name for any of them and this removes dupes on ‘None’.
So, I made a change. If event name does not exist, I use team_abbr. That gives all teams that we track whether they are playing or not.
- type: custom:auto-entities
card:
type: entities
show_empty: false
filter:
template: |
{%- set ns = namespace(items=[]) -%}
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "league") == "MLB" -%}
{%- set event_name = state_attr(team, "event_name") if state_attr(team, "event_name") else state_attr(team, "team_abbr") -%}
{%- set ns.items = ns.items + [{"team_sensor": team, "event_name": event_name}] -%}
{%- endif -%}
{%- endfor -%}
{%- for team in ns.items|unique(attribute="event_name") -%}
{{{"type": "custom:teamtracker-card","entity": team.team_sensor, "home_side": "right" }}},
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
options: null
sort:
method: attribute
attribute: team_id
Yes it works and tried it with Middlesbrough - no issues either.
Try this.
Click on the ESPN integration within Device and services.
click add and enter the following entries case sensitive.
Legaue : XXX
Team: MID
friendly name: team_mfc
press submit to enter the next page
sportspath: soccer
Leaguepath: eng.2