vasqued2 / ha-teamtracker

Home Assistant integration that provides real-time scores in multiple professional (NBA, NFL, NHL, MLB, MLS, and more), college (NCAA), and international (soccer, golf, tennis, mma, racing) sports using ESPN APIs.
184 stars 20 forks source link

Some MLB games informations remain to null #146

Closed gharl77 closed 6 months ago

gharl77 commented 7 months ago

Some MLB games informations remain to null and no information is reported.

Example:

attribution: Data provided by ESPN sport: baseball league: MLB league_logo: https://a.espncdn.com/i/teamlogos/leagues/500/mlb.png team_abbr: TOR opponent_abbr: SD event_name: TOR @ SD date: 2024-04-21T00:40Z kickoff_in: il y a 17 minutes venue: Petco Park location: San Diego, California tv_network: null odds: null overunder: null team_name: Blue Jays team_id: "14" team_record: 11-9 team_rank: null team_homeaway: away team_logo: https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/tor.png team_colors:

  • "#134a8e"
  • "#6cace5" team_score: "3" team_win_probability: 0 team_winner: null team_timeouts: null opponent_name: Padres opponent_id: "25" opponent_record: 11-11 opponent_rank: null opponent_homeaway: home opponent_logo: https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/sd.png opponent_colors:
  • "#3e2312"
  • "#ffc425" opponent_score: "0" opponent_win_probability: 0 opponent_winner: null opponent_timeouts: null quarter: 1 clock: Bottom 1er possession: "25" last_play: null down_distance_text: null outs: null balls: null strikes: null on_first: false on_second: false on_third: false team_shots_on_target: null team_total_shots: null opponent_shots_on_target: null opponent_total_shots: null team_sets_won: null opponent_sets_won: null last_update: "2024-04-20 20:57:01-04:00" api_message: null icon: mdi:baseball friendly_name: Toronto_bluejays
TomFrank19087 commented 6 months ago

When an MLB game goes to POST, the team_winner and opponent_winner attributes update correctly to their true/false values in developer tools/states, however, the team_winner attribute remains null in HA. Automations won't fire on attribute change and displaying team_winner in a tile card still shows it to be null in spite of the correct value being in developer tools/states. It appears that opponent_winner works correctly.

vasqued2 commented 6 months ago

@TomFrank19087 I am not sure I understand what you are saying. What do you mean it remains null in HA?

In the teamtracker_card I use team_winner to brighten the score if True and that's working for me. If it was null, it would be dimly displayed so I'm not sure what you are seeing. I don't have any triggers based on team_winner but will try to test one soon.

Anything more specific would be helpful.

vasqued2 commented 6 months ago

@gharl77 The sensor fills in all attributes provided by the ESPN API. What attributes are you expecting that are null?

TomFrank19087 commented 6 months ago

When the game goes to post, the two winner attributes are the correct true/false values corresponding to the game outcome on the States page of Developer tools. Nonetheless, my automation wasn't firing as expected. The teamtracker_card does correctly bold the winning score. To investigate, I added the following cards:           - type: horizontal-stack             cards:               - type: tile                 entity: sensor.phillies                 state_content:                   - team_name                   - team_winner                   - team_score                 name: ' '               - type: tile                 entity: sensor.phillies                 state_content:                   - opponent_name                   - opponent_winner                   - opponent_score                 name: ' ' I've monitored both a win and a loss. Pre-game and in-game, these cards correctly display both team names, a hyphen (null winner), and the respective team score. Once the game goes post, the winning side correctly updates the hyphen to "true" but the losing side remains a hyphen and does not update to "false". I was using a false test in a portion of my automation and I believe that is why my automation was failing. I tried using the winner attribute as a trigger and as a condition when triggered by IN->POST. I've updated my automation to only test for true conditions and will test during this evenings game. Basically, I'm trying to flash some bulbs the winning team colors at the end of the game. Flashing both team colors at the start and the appropriate colors when a team scores works fine. Thank you. On 5/18/2024 8:45:04 AM, David @.> wrote: @TomFrank19087 [https://github.com/TomFrank19087] I am not sure I understand what you are saying. What do you mean it remains null in HA? In the teamtracker_card I use team_winner to brighten the score if True and that's working for me. If it was null, it would be dimly displayed so I'm not sure what you are seeing. I don't have any triggers based on team_winner but will try to test one soon. Anything more specific would be helpful. — Reply to this email directly, view it on GitHub [https://github.com/vasqued2/ha-teamtracker/issues/146#issuecomment-2118812930], or unsubscribe [https://github.com/notifications/unsubscribe-auth/AL3VU4Q3THLIZWHGKE7Y44TZC5ENBAVCNFSM6AAAAABGQ5ICECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJYHAYTEOJTGA]. You are receiving this because you were mentioned.Message ID: @.>

vasqued2 commented 6 months ago

My guess is that through all the translations across the layers, Null and False end up both being turned into a value of zero. You would probably need to check for a status of POST along with the Winner field being False to know the game was over and they lost.

TomFrank19087 commented 6 months ago

I've gone back to triggering on IN->POST but testing the Winner fields for True to determine which team won. It worked properly last evening. The two tile cards were as before, true for the winner and nothing for the loser. Looks like testing for False is what was failing. Thanks again. On 5/19/2024 11:02:00 AM, David @.> wrote: My guess is that through all the translations across the layers, Null and False end up both being turned into a value of zero. You would probably need to check for a status of POST along with the Winner field being False to know the game was over and they lost. — Reply to this email directly, view it on GitHub [https://github.com/vasqued2/ha-teamtracker/issues/146#issuecomment-2119267213], or unsubscribe [https://github.com/notifications/unsubscribe-auth/AL3VU4RSLMTIGOWVWJXTKETZDC5GPAVCNFSM6AAAAABGQ5ICECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJZGI3DOMRRGM]. You are receiving this because you were mentioned.Message ID: @.>