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.
183 stars 20 forks source link

HA automation suddenly stopped giving correct result #143

Closed pdawg17 closed 6 months ago

pdawg17 commented 7 months ago

I have a HA automation set up:

alias: Warriors game result bulbs description: "" trigger:

For awhile now though, when the Warriors win, I still get the "else" result. I haven't changed the automation at all and it used to work correctly. Has any of the syntax changed for Team Tracker? Btw not sure why the code dashes are showing up differently once I update the comment...if anyone knows how to fix I'll edit...thanks..,

vasqued2 commented 7 months ago

Try explicitly converting the scores to type int and see if that solves it My guess is that it is comparing them as strings and in games where Warriors score 100+ and hold their opponents in the 90's as they have recently, the "9" > "1" and it hits the False criteria.

I think adding "(state_attr('sensor.warriors_basketball','team_score') | int) " will ensure it's of type int. You can use the Template tester in the Developer Tools section to confirm.