Just did some digging and it appears unpkg did indeed have issues earlier that impacted some regions and they’ve been resolved now. Maybe that’s why I’m not seeing issues now?
I believe you are correct as I have full functionality back now as well. I’ll do some testing tomorrow with local imports in the interim.
all working as of today
Could the “days until” value be modified to represent the actual number of days instead of the remaining time divided by 24 hours?
Currently, it displays “2 days” at 9 PM on Thursday, but it should say “3 days” until midnight and then switch to “2 days” afterward. Is it possible to make this change? Couldnt find anthing regarding this…
After some limited testing the following appears to work and allow for removing the dependency on unpkg:
const LitElement = customElements.get("hui-masonry-view")
? Object.getPrototypeOf(customElements.get("hui-masonry-view"))
: Object.getPrototypeOf(customElements.get("hui-view"));
const html = LitElement.prototype.html;
//import { html, LitElement } from "https://unpkg.com/lit?module";
I found similar code chunks across quite a few of my custom lovelace cards. I don’t know the full extent of advantages/disadvantages of the above code(reliability, future-proofing, compatibility, etc.) but in my brief testing I’ve had no issues. Would love a clarification or more explanation from someone more versed in JS!
In the Standings blog, someone asked a question that I believe would be a good enhancement request for Teamtracker so I am posting here also.
See Sports Standings and Scores - #32 by kbrown01
Essentially there are some of us that want the entire team set for particular sports so that we can look at all things going on, but also would like a view that contains only our favorite teams. I think it would be great to add an additional attribute to a teamtracker team … “favorite”. This additional attribute would only carry the fact that a team is one of my favorites (defaults to “false” but could be “true”).
Then all-sports dashboards can be viewed as all teams or just “favorites”. Or better, a view of all my “favorities” independent of sport. Yes, I know I can just do this in some view by changing the YAML for the card to add that team, but auto-entities and templates would reduce that to a few lines of code and when I add a new team, mark it as a favorite in the sensor creation, it would just be there.
I use the humanize()
function that is part of the arrow library (https://github.com/arrow-py/arrow) to calculate, translate, and localize the “days until”.
I would recommend opening an issue there.
Unless I am missing something, it seems like you could get the same functionality by just using a standard naming convention and then using a template filter to only pull in the sensors you want.
For example, all my sensors are named something like tt_{league}_{team_abbr}
or tt_test_{league}_{team_abbr}
so I can filter out the test or prod sensors only. See my example below.
It seems like if you use a naming convention like tt_{league}_{team_abbr}
and tt_{league}_fav_{team_abbr}
you could pull in all of the sensors or only the fav depending on whether you included fav or not in the filter.
The reason I like driving it off of the sensor name is because it gives a lot more flexibility. For example, someone could filter based on conference or division if the wanted to. You couldn’t do that with a simple binary flag.
If I’m missing something, let me know.
template: |
{%- for team in integration_entities("teamtracker") -%}
{%- if "sensor.tt_nba_" in team -%}
{{{"type": "custom:teamtracker-card",
"show_league": true,
"debug": true,
"outline": true,
"outline_color": "lightgray",
"entity": team }}},
{%- endif -%}
{%- endfor -%}
You are not missing anything. You could use that as a naming convention and I think not break anything (I have done). But personally to me naming a team as you suggested is cheating. Maybe we are cheating too … because we want some team treated different that others. It was only pointed out in my blog and I thought I would present it here.
I think your people use teamtracker (which is top notch by the way) to follow their teams. My people use it by Sport and not by Team.
We can do what you want without even a naming convention, just a simple JSON file that contains your favorites. I will do that for folks then.
The difference you suggest is minimal.
Do I do?
- platform: teamtracker
league_id: NFL
team_id: DET
name: Detroit Lions
favorite: true
or
- platform: teamtracker
league_id: NFL
team_id: DET
name: Detroit Lions Favorite
You control the integration, but from an experienced software person … one of these is the better answer.
You young’uns is so cute. The best solution is the one that provides the most flexibility w/ the least amount of coding changes. Actually, scratch that. The best solution is one that already works. Someday you’ll have enough experience to realize the wisdom of those words.
Let’s look at what would be needed for your proposal for a second.
Change the sensor setup. Change the UI config setup. Add an options flow handler for the flag. Update the localization files for the UI changes including languages I don’t speak. Force a config schema upgrade on the entire install base. Reestablish and regenerate a regression baseline. With most changes occurring in the portion of the code base w/ the least amount of test coverage.
Then about two weeks after release, someone would ask to add another boolean flag to tag the sensors that are their roomate’s favorites. Or to hide the scores for teams they want to watch later and not be spoiled. Or. Or. Or.
It’s almost as if an “experienced software person” were going to implement something like you requested if they would recognize the limitations of a boolean and implement it as a tag to give more flexibility.
But I’m not going to do that either.
Because name is essentially a sensor tag already. And the best solution is one that already works.
Sorry that this 61 yr old youngin that owns three software companies offended you for suggesting an enhancement.
We’ll handle it differently but simply.
Thanks for your invaluable advice.
Enhancement suggestions are always welcome. Portraying an obviously short-sighted solution as clearly better, not so much.
And unless you started out submitting punch cards, you’ll always be a young’un.
Thanks. I’ll see what I can track down. Appreciate the start.
Yes. A good solution was posted in the other thread using Home Assistant group which is perfect for this. Easier to manage for all.
And yes, 500,000 lines of code in Fortran for designing/monitoring nuclear reactor components … all in punch cards Vax 8800s, Cyber205 and (thank God) Cray XMP and the YMP. I cut my teeth, sorted cards many times.
Good morning, is there any way to follow the women’s teams in Europe and Portugal? where could i find such an API to create the sensor?
Glad to hear you found a good solution. And I guess we’re proof you can teach old dogs new tricks.
For soccer? You will need to create a Custom API Configuration.
Go to the ESPN page here Soccer Scores and then select the league you want from the Soccer Scores drop down and then look at the URL to determine what your league_path
should be.
Great work on this one. I really enjoy the integration, but having issues keeping it working. I have it set up to track only one team: STL. Yesterday it showed the info for today’s upcoming game against the Blue Jays. However, sometime overnight it stopped showing that game and now just says no games through 4/3. I have tried restarting and reloading the integration, but no luck. Any thoughts on how I can troubleshoot or fix this?
Here’s how the card is configured
type: custom:teamtracker-card
entity: sensor.team_tracker
outline: true
outline_color: null
show_timeouts: false
show_rank: true
Check your sensor in the states section in the developer menu. I track the Cardinals and I am showing their game today.
- type: 'custom:teamtracker-card'
entity: sensor.st_louis_cardinals
home_side: right
outline: true
outline_color: white