Mainly I’d like to track all teams in a league without manually setting up all the sensors. Not that that’s a ton of work, more so that it would just feel more organized to me.
The other reason is that I don’t like hitting APIs more than necessary. If I have sensors for two teams that are playing each other, I’m hitting the API twice every 5 seconds rather than once. Again, not a huge issue more so one that bugs me.
If you think this would be realistic, I’d be willing to try implementing it.
Teamtracker was designed to track a limited number of teams and wasn’t designed to efficiently handle multiple calls to the same API for multiple teams all having ongoing games.
It looks like HA has some sort of throttling mechanism that will limit API calls but I need to look into it more to truly understand what is happening. I am reluctant to make it easier to create a ton of sensors w/o some controls/throttles in place for the API calls. Bad for HA performance and bad for the ESPN APIs.
Even if I can get the controls/throttles in place, I would want to figure out if they can be made without it being a breaking change or if it would be better as a completely different integration. I always viewed what you are asking for as something like a “league” tracker that would display standings and limited info like scores and game clock while games were going on, but updated less frequently and not having nearly the detail available via team tracker.
Bottom line, it’s on my backlog to at least look into making the API calls more efficient, but it’s not a quick turnaround and would likely require a major rewrite of the guts of the sensor.
If anyone has already done this for another custom component, I’d love to hear suggestions or look at the code.
In this case, using entity-filter as card i can see only the teams with NOT FOUND state, but how to set the card to see only the teams NOT in NOT_FOUND state?
Not sure what you are trying to do. The Entity Filter Card to displays the sensor, not the card. Is that really what you want to do? You can specify the operator to be “!=” in the YAML if that’s what you really want to do.
I think what you want to do is use the Conditional Card to display (or not display) the card. You can select “State is not equal to” to only display the card when the state is something other than NOT_FOUND.
v0.6.1 is out and has some pretty major changes under the covers.
I completely revamped the API update process to cache the data and share it across sensors whenever possible. This will significantly reduce the number of API calls being made when multiple sensors are set up for teams in the same league.
Also, finally found the APIs for cricket so this release also has beta support for cricket, although there are meaningful limitations. See Wiki for details. All cricket sensors must be set up as Custom API Configurations.
If you notice problems w/ the in-game updates with this release, it could be related to the data caching, so please let me know.
Hello @vasqued2 and others who might have thoughts to this.
I had an interesting scenario pop up today. My hockey team, the Boston Bruins, played late last night (on the west coast) so the game ended after midnight here on the east coast. They also have a game today, in about 1 hour as I type this.
At the moment, my team tracker card is still showing last nights game rather than the upcoming game. I recognize that the card seems to show the previous game for…24 hours? Or so? So it doesn’t seem to anticipate a situation like this.
I have no idea how frequently this might occur across sports. MLB definitely does back to back games (and sometimes day/night doubleheaders).
My apologies if this was already brought up and discussed. I did a quick search but didn’t find anything.
Edit to add: I just went to look at the team tracker entity for the Bruins and noticed something peculiar which I think must be on ESPN’s end…
If I’m understanding that correctly, it was reflecting pregame from 2 am to 4 pm, but since that time, it swapped back to last nights game. Any ideas why it would do that?
Thanks for catching this. I was able to recreate it while the BOS/ANA game was still going on.
When two events are returned for the same team, it should use the following logic:
PRE/PRE - Use the earliest PRE event
POST/POST - Use the latest POST event
POST/PRE - If the PRE event starts within the next 18 hours use it, otherwise use POST
IN/anything else - Always use IN
Using this logic it should always show the IN game and it’s not. I found the bug causing the IN problem. It’s essentially confusing another game that is in progress as BOS being in progress and stops searching before it ever finds real BOS/ANA game. Then it displays the last BOS game it found, which is the one from yesterday.
I know how to fix it but the current logic doesn’t really make any sense and I’m trying to remember why I put it in there in the first place so I don’t break anything else when I pull it out. I also don’t understand why I wouldn’t have noticed it before because this scenario happens regularly w/ NHL games and I would have thought I would have noticed it. The only explanation I can think of is that the CBJ are doing so bad that I subconsciously wanted to forget they were even playing.
What time zone are you in? My suspicion is that the same bug that I am seeing now kicked in when another NHL game started around 4:00 your time and suddenly caused it to stop searching before it found the BOS/ANA game.
I haven’t confirmed but I believe this bug was introduced in v0.6.0 when I did a major refactor of the code. You could try reverting to v0.5.4 if you wanted to see if that fixes it.
Or if you wait, I’ll fix it in the next release. Probably within a week.
Haha, you couldn’t guess by my team? Though granted, we seem to travel well. But…Eastern Time!
And ouch, I’ve been watching a lot of CBJ games this year (Switched to Hulu + Live so ESPN+ [and a VPN to block the blackouts!] means LOTS of hockey) and they ARE riding the struggle bus hard.
Yeah, I could tell when it suddenly turned to in (since the B’s were especially prolific tonight) … all of a sudden my “goal” automation started going off (in one case, twice within a minute!) during…I’d guess the second period.
If you’re thinking the VAN/WIN game, that appears to have started at 3 PM my time. Which matches up roughly with the Bruins oddity. It went from PRE to POST at about 3:17 PM.
The information that you included in your initial post was exactly what I needed. I’ve got the fix and will include it in the next release.
It only happens when there is a back-to-back, and even then, only in certain situations that generally occur when the second game is late. For example, PHI has the second of a back-to-back tonight that I thought I could use to test it, but because they played earlier, it didn’t trigger the scenario.
In reality, this specific scenario probably doesn’t happen that often in hockey, but it definitely would have caused trouble in baseball season.
Thanks again for the detail you provided. It was exactly what I needed to make the fix.
I have TeamTracker up and running. Really nice integration/card I have to say. So thanks a bunch for all the hard work.
A question. Now that the regular season of NFL is coming to an end, is there a way to create a sensor.team_tracker that follows ALL the remaining teams? Through wildcard, playoffs all the way until superbowl, and perhaps even the probowl (probowl not important, though)?
I mean, so that the card shows the next game, regardless of who is playing.
My team didn’t make it, so now I just want to follow all remaining teams.
I made a quick change to enable wildcards to be used for teams by inputting an"*" instead of a team name.
I haven’t released it yet because I want to confirm that it works first. You can download it in HACS by selecting the ‘master’ version at the bottom of the list. If there are problems, you can always redownload the last version.
It will still only track one game at a time but will should match whatever game is in progress. If none are in progress, it will match the next upcoming game (if starting in the next 18 hours) or the last game that was played. It should automatically switch between games based on their status. If two games are going on at the same time, it will just pick one randomly.
Let me know if it works and I will include it in a future release after this weekend’s games. If not, I will pull the code.
I keep getting an error trying to test this template. {{ trigger.to_state.attributes.team_score | int > (trigger.from_state.attributes.team_score | int ) }}
from Automation expamples
this is the error I am getting UndefinedError: 'trigger' is undefined