vasqued2 / ha-teamtracker-card

A Home Assistant frontend custom card that will display real-time updates for teams tracked with the ha-teamtracker integration. Has custom in-game layouts for football, baseball, basketball, hockey, soccer, golf, tennis, racing, and mma.
GNU General Public License v3.0
71 stars 16 forks source link

showing XXX when using a custom league (european soccer for example) #19

Closed tretabyte closed 1 year ago

tretabyte commented 1 year ago

Hi,

I would like to have a way to properly have the Leagues name on the top of the card, either using a regular manual input Title or picking the value from the API but right now if we use show_league: true while on custom league like european soccer, the top card will only show XXX

vasqued2 commented 1 year ago

Good catch. It will require changes to both the sensor and card to fix. I'll fix it in v0.6.0.

RickxZen commented 1 year ago

I just changed XXX in custom config to Eredivisie and it shows like this: afbeelding

tretabyte commented 1 year ago

that looks good, whatever we can put in there to name the league should work great. for example, the new world cup, the id is WC so the card only displays: image

vasqued2 commented 1 year ago

There are a couple different ways to handle this. Not sure what you all are thinking.

  1. Make no change - Inputting an unsupported league id behaves the same way (although unintentionally) as inputting XXX and allows you to input a sport_path and league_path. And then the card uses whatever value you specified as the league id like RickxZen discovered.
  2. Pull the official league names back from the API and use either the name, abbreviation, or midsizeName. Here are two examples of the values returned.
    "name":"Dutch Eredivisie",
    "abbreviation":"Erediv",
    "midsizeName":"NED.1"
    "name":"FIFA World Cup",
    "abbreviation":"WC",
    "midsizeName":"FIFA.WORLD"

    My initial inclination is to document that you can use values other than XXX as the league ID as long as you specify the sport_path and league_path, but interested in your thoughts and if you would prefer one of the other values.

tretabyte commented 1 year ago

Hi, why not a mix of both, pull the info from the API by default using the name/abbreviation and give the possibility of using a customizable name (just option given in the card), something like custom_name

vasqued2 commented 1 year ago

I hadn't thought of the option in the card. I think that's what I'll do. Easy and gives most control to the user. Thanks.

tretabyte commented 1 year ago

Hi Just noticed the card_title option but it doesn't seem to be working with custom leagues or am I doing something wrong?

vasqued2 commented 1 year ago

Looks like you saw the README for the pre-release version. You would have had to specifically re-download the 'main' version to get it. I was having someone test a fix for issues w/ Latin American translations before releasing.

Once you upgrade to v0.5.3, which I just released a couple minutes ago, you should be good. If you still have problems after the upgrade. Clear your browser cache and refresh. Let me know if you have problems after that and we'll work through them.

Here's an example of my card config:

  - type: custom:teamtracker-card
    entity: sensor.zui_test1
    outline: true
    outline_color: lightgray
    show_league: true
    card_title: World Cup
tretabyte commented 1 year ago

Hi, got the update and it works perfectly! thank you very much.

tretabyte commented 1 year ago

question, when we have no games within the time window the information gets pulled, it shows that smaller card with "no upcoming games", is there a way to change the XXX to whatever we use, maybe enable the name propertie or pulling the valid name from the API? the card with games in it is perfect, the one without games is what bothers me with those XXX (I tried create a new one and adding some name instead of XXX to trigger the custom confirmation but kept getting invalid config and wouldn't move forwared) image


entity: sensor.team_tracker
card_title: Primeira Liga
outline: true
outline_color: '#ffe500'
show_league: false
show_rank: true
home_side: left
----------------------------------------
type: custom:teamtracker-card
entity: sensor.world_cup
outline: true
outline_color: '#ffe500'
show_league: false
show_rank: true
card_title: World Cup
vasqued2 commented 1 year ago

The XXX is because it helps me troubleshoot issues quickly. Making your change makes sense and will clean up the card, but I want to spend some time figuring out how I can still make it easy to troubleshoot common problems.

By far, the biggest problem people ask about is sensor unavailable or games not found. Most of the time it's because they set up the sensor wrong, but it's always possible there is a coding problem that I need to check out. I use the info on this card to quickly triage out the user errors.

People who set up the sensor wrong generally take a screen shot but their ability to turn on debugging, check logs, and take other steps are limited. Some don't even know how to look at the state and attribute values in Dev Tools.

To date, my focus on the Not Found card has been purely to help w/ debugging, not on making the card look pretty. Let me think about how I can do both.

tretabyte commented 1 year ago

I can help you out if you wish, I did a bit of digging around and troubleshooting to make sure I was using the right league IDs (not using the typical ones but instead some from my country). overall I can say the instructions you provided are simple and easy to track but a few tweaks here and there may turn things even more easy and maybe even go further and start grabbing info from other sources?

vasqued2 commented 1 year ago

I'm open to suggestions

vasqued2 commented 1 year ago

Were you picturing something like this, where "Liga Portugal" is the card_title? BEN

tretabyte commented 1 year ago

Hi,

yeah that would be perfect.

One thing I think needs to be reviewed is the way you pick the information to populate the configuration, you say to "See Custom API Configuration section below on how to set up additional sports/leagues if you know the ESPN API." which for me would be the tricky part of all this. Anything that isn't "default" is always a pain to figure out. Oh another thing I think it's very important to highlight, apparently ESPN doesn't always shows all matches, per team or even per league. A good example is the one you pasted above, although it says there isn't any upcoming game through 12/01, yesterday there was one actually that didn't show in the website therefore the integration didn't pull the information, this is obviously an issue with ESPN not with your integration but it would be important to mention.

vasqued2 commented 1 year ago

Thanks. I'll include the changes in the next release.

Feel free to update or add a page to the Wiki on how to help others w/ the Custom API configurations and I'll link to it in the README. I don't know an easy way to explain it because there is no authoritative source for the APIs and it seems like someone is always finding more. It's a bunch of trial and error - or in your words - "a pain to figure out". Anything you can add to the Wiki to remove some of that pain would be a welcome addition!

The reason the game yesterday didn't show up is because it wasn't Liga Portugal game (looks like the league is on break through the World Cup, as are most leagues). It was part of something called the Allianz Cup. I assume you know more about what this is than I would. Maybe there is an API for that but you would have to look and find it, which gets back to your first point.

In the end, I created the Custom API Configuration to let people who could figure out the API themselves to do so. It's actually gotten easier as more people have found more resources which are included in the Wiki, but again, it's not always straight-forward, and I don't think it's ever going to be. Anything you can add to help is appreciated.

Thanks

vasqued2 commented 1 year ago

The revamped layout from above is included in v0.5.4. Let me know if you have issues after upgrading.