Is there a way to use the conditional card to only show the card when the state attribute “kickoff_in” is within 1 day or less?
I don’t know how to use state attributes for conditional cards. I don’t know if it can be used, you’ll have to search.
Only for state (or state_not) sensor, in this case PRE, POST, NOT_FOUND…
You can’t use attributes with a conditional card, only for state values.
The workaround is to use a template to create a binary sensor based on the attributes/formula you desire, and then use that binary sensor to determine whether to show the card or not.
I updated my screen to this:
type: custom:auto-entities
unique: true
show_empty: false
card:
type: grid
square: false
columns: 4
card_param: cards
filter:
template: |
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "team_homeaway") == "home" -%}
{{{"type": "custom:teamtracker-card",
"entity": team }}},
{%- endif -%}
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
sort:
method: attribute
attribute: date
Trying to set up a card for the World Cup for all matches. I do get a card but something seems to be missing? Anyone who has succeeded? I would like to add all matches and if possible see them today even though it is starting on Sunday. I have added via the integration gui in HA.
I would like to be able to have soccer team Slovakia, to be able to see friendly games + qualifying games
and in UEFA conference league there is also Slovan Bratislava which I would like to have… Is it possible? I am not able to make it work.
Is there going to be also Slovak soccer league and Slovak hockey league?
thanks in advance
You will have to set up a Custom API Configuration. This link provides more details on how to set up one and see if ESPN has an API for the leagues you want.
@planet4 You can’t use an ‘*’ for team sports. You have to input each team you want to follow individually in separate sensors. The API will only return games 4-5 days into the future.
Good news - there is an ESPN API for AFL, and it works! The Sport Path is ‘australian-football’ and the League Path is ‘afl’.
It’d be great if the ESPN API had the number of goals and behinds, but I’m thrilled with the great work done for the custom integration and the card. Thanks vasqued2!
This is awesome!!! Thanks for pointing that out!
Edit: can you show me your config please? I’m getting invalid league
Just released v0.5.3 which has native support for the AFL. Just use league AFL. The API does not return info for goals and behinds in the post-game info. Once the season starts, I’ll try to catch a game in progress and see what’s available. Feel free to capture the JSON yourself and post it here or log an issue on the repo and I’ll take a look at it.
Thanks for finding the API!
Thank you both!
Thank you for the integration. I can’t seem to get the integration to pull my country’s soccer team info from espn api.
My team’s espn link
you know what could be wrong?
update: I checked the wiki. I’ll give the integration another 24hs to check again.
Thank you!
Hard to troubleshoot w/ no info. Post the sensor values and/or the card. The game is showing for me.
I was putting the wrong team abbr. Thanks
Hi,
I’m not seeing any API’s for Rugby. Anyone know if there is any?
I’m wondering how you found the AFL one because I didn’t see that either on the API explorer page.
Thanks!
Based on the url below that displays scores, it looks like sport_path
is rubgy and league_path
is a six-digit number depending on the league you select. Looks like there are dozens to choose from. Never tested rugby. If you find one that works, feel free to add it to the Wiki.
I’m trying to attach a photo or simply an added notification that would send the change of the score, but also the values itself ex: TeamA1-0TeamB…
Any ideas?
-edit-
This seems to be working:
service: notify.mobile_app_phonexxx #your companion device
data:
message: >-
"There was a goal!! {{ state_attr('sensor.teamtracker',
'team_abbr') }} {{ state_attr('sensor.teamtracker, 'team_score') }} -
{{ state_attr('sensor.teamtracker', 'opponent_score') }} {{
state_attr('sensor.teamtracker, 'opponent_abbr') }}"
Receiving something like: “There was a goal!! TeamA 1 - 0 TeamB”
How is that working for a change in score? What is the actual trigger?
In the documentation you find Automation Examples.
Such as:
alias: Automation - Team Score
trigger:
- platform: state
entity_id: sensor.team_tracker
attribute: team_score
condition:
- condition: template
value_template: >-
{{ trigger.to_state.attributes.team_score | int >
(trigger.from_state.attributes.team_score | int ) }}
action:
- your-action-here
But I guess it wouldn’t trigger if the other team (opponent_score) scores.
From what I could test it, adding both triggers (team_score & opponet_score) and the “Or” condition will resolve most problems and false triggers:
alias: Score - both teams
description: ""
trigger:
- platform: state
entity_id: sensor.teamtracker #sensor
attribute: team_score #attribute - your team scores
- platform: state
entity_id: sensor.teamtracker
attribute: opponent_score #attribute - opponent team scores
enabled: true
condition:
- condition: or
conditions:
- condition: template
value_template: >-
{{ trigger.to_state.attributes.team_score | int >
(trigger.from_state.attributes.team_score | int ) }}
- condition: template
value_template: >-
{{ trigger.to_state.attributes.opponent_score | int >
(trigger.from_state.attributes.opponent_score | int ) }}
action: #whatever actions you want to add
-edit-
Ohh, and to trigger one automation when the game is over and also receive the final result:
alias: The game is over
description: ""
trigger:
- platform: state
entity_id:
- sensor.teamtracker
to: POST
condition:
- condition: template
value_template: "{{ trigger.to_state.state | int > (trigger.from_state.state | int ) }}"
action:
- service: notify.mobile_app_phonexxx
data:
message: >-
"The game is over. {{ state_attr('sensor.teamtracker', 'team_abbr') }} {{
state_attr('sensor.teamtracker', 'team_score') }} - {{
state_attr('sensor.teamtracker', 'opponent_score') }} {{
state_attr('sensor.teamtracker', 'opponent_abbr') }}"
enabled: true