Real-Time Sports Scores w/ TeamTracker and TeamTracker-Card (Beta)

Hope this gives you inspiration:
This nodes makes my lg tv and my mobile app notify on every goal, every remarkable action (yellow and red cards, eg) and also at the beginning and the end of every match when Spain plays. you can easily include icon for your team downloading it at home assistant tree structure.
The only sensor youll have to create is “marcador” that displays the current scoreboard in FRA 0-0 ENG format, that has this structure:

      espana_marcador:
        value_template:  >-
          {%- if is_state_attr('sensor.espana','team_homeaway', 'home') -%}
            ESP {{ states.sensor.espana.attributes["team_score"]}} - {{ states.sensor.espana.attributes["opponent_score"]}}  {{ states.sensor.espana.attributes["opponent_abbr"]}}  
            {%- else -%}
            {{ states.sensor.espana.attributes["opponent_abbr"]}} {{ states.sensor.espana.attributes["opponent_score"]}} - {{ states.sensor.espana.attributes["team_score"]}} ESP
            {%- endif %}
        friendly_name: Marcador ESP  

here is the code:

[{"id":"b34a1c3e55fd5f4c","type":"group","z":"dc945ea982446b2e","name":"ESP Mundial","style":{"label":true},"nodes":["7530158775641900","2acdb05f02ab96b7","487cae40f541bd5f","9a27e9c37a172850","4a91b0e2396e075f","d555eb311b7c6656","f35ce9084a758557","e089c6e5fb8f63c0","1443ad5b7381216c","071d02ba32c91fde","59fd7ab3a8c2a2ec","63dbac3cf73a1403","9dc030709232ae31","504dc03b350691fe","81a25140269ec1ec","f9002de6f81cfb7c","da41666b3aad9997","f121b8b07b30a46a","5c6ad4053091d941","968a4671e3157027"],"x":77,"y":1232,"w":704.4284744262695,"h":269.6785888671875},{"id":"7530158775641900","type":"server-state-changed","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"España","server":"5169096b.09f678","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.espana_marcador","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"None None - None ESP","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":153,"y":1273,"wires":[["5c6ad4053091d941"],[]]},{"id":"2acdb05f02ab96b7","type":"function","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"notifica","func":"var en_juego = global.get('homeassistant').homeAssistant.states['sensor.espana'].state\n\nif  (en_juego == \"IN\" && (!msg.payload.includes(\"0 - 0\"))) {\nvar minutos = global.get('homeassistant').homeAssistant.states['sensor.espana'].attributes.clock\nminutos = minutos.replace(\"'\",\"\")\n\nvar mensaje = \"¡¡¡GOL!!! \" + msg.data.new_state.state + \" min \" + minutos \nnode.warn(mensaje)\nnode.warn (minutos)\nmsg.payload = {}\nmsg.payload.chatId = 229448901\nmsg.payload.type = \"message\"\nmsg.payload.content = mensaje\nmsg.payload.icon = \"esp\"\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":1275,"wires":[["1443ad5b7381216c"]]},{"id":"487cae40f541bd5f","type":"server-state-changed","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"esp","server":"5169096b.09f678","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.espana_marcador","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"None None - None ESP","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":false,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":154.17852783203125,"y":1317.9287109375,"wires":[["968a4671e3157027"],[]]},{"id":"9a27e9c37a172850","type":"api-call-service","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"gol","server":"5169096b.09f678","version":5,"debugenabled":false,"domain":"notify","service":"alexa_media_salon","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"<speak>   <audio src='https://sonidoscavilesphoto.s3.eu-west-3.amazonaws.com/gol.mp3' />   </speak>\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":590.9285888671875,"y":1314.6787109375,"wires":[[]]},{"id":"4a91b0e2396e075f","type":"server-state-changed","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"espana","server":"5169096b.09f678","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.espana","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":155.42853546142578,"y":1455.6785888671875,"wires":[["9dc030709232ae31"]]},{"id":"d555eb311b7c6656","type":"server-state-changed","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"esp","server":"5169096b.09f678","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.espana","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":155.428466796875,"y":1393.6785888671875,"wires":[["da41666b3aad9997","f121b8b07b30a46a"]]},{"id":"f35ce9084a758557","type":"api-call-service","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"inicio","server":"5169096b.09f678","version":5,"debugenabled":false,"domain":"notify","service":"alexa_media_salon","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"<speak>   <audio src='https://sonidoscavilesphoto.s3.eu-west-3.amazonaws.com/pitido.mp3' />   </speak>\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":589.428466796875,"y":1359.6785888671875,"wires":[[]]},{"id":"e089c6e5fb8f63c0","type":"function","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"notifica","func":"var viejo = msg.data.old_state.state;\nvar nuevo = msg.data.new_state.state;\nif (viejo == \"PRE\" && nuevo==\"IN\")  {\n\nconst states = global.get('homeassistant').homeAssistant.states;\nvar marcador = \"¡¡INICIO!! \" + states['sensor.espana'].state\n\nmsg.payload = {}\nmsg.payload.chatId = 229448901\nmsg.payload.type = \"message\"\nmsg.payload.content = marcador\nmsg.payload.icon = \"esp\"\nreturn msg; \n} else { \n    if (viejo == \"IN\" && nuevo == \"MT\")\n    {\n\n        const states = global.get('homeassistant').homeAssistant.states;\n        var marcador = \"DESCANSO \" + states['sensor.espana_marcador'].state\n \n    }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":458.428466796875,"y":1362.6785888671875,"wires":[["f35ce9084a758557","1443ad5b7381216c"]]},{"id":"1443ad5b7381216c","type":"link out","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"notificar","links":["0ec16caf88118c4c","cca9c05fcace360b"],"x":718.4284744262695,"y":1351.6785888671875,"wires":[]},{"id":"071d02ba32c91fde","type":"function","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"notifica","func":"var mensaje =  msg.payload[msg.payload.length - 1] \n\nmensaje = mensaje.replace(\"'\", \"min\")\nmsg.payload = {}\nmsg.payload.chatId = 229448901\nmsg.payload.type = \"message\"\nmsg.payload.content = mensaje\nmsg.payload.icon = \"esp\"\nreturn msg;\n ","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":695.4284744262695,"y":1460.6785888671875,"wires":[["1443ad5b7381216c"]]},{"id":"59fd7ab3a8c2a2ec","type":"split","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"","splt":"     ","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":446.42847442626953,"y":1457.6785888671875,"wires":[["63dbac3cf73a1403"]]},{"id":"63dbac3cf73a1403","type":"join","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":565.4284744262695,"y":1459.6785888671875,"wires":[["071d02ba32c91fde"]]},{"id":"9dc030709232ae31","type":"function","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"eventos","func":"var mensaje=msg.data.new_state.attributes.last_play\nvar mensaje2 = msg.data.old_state.attributes.last_play\nvar en_juego  = msg.payload\n if (mensaje != mensaje2 &&  en_juego == \"IN\") {\n \nif (typeof mensaje != 'undefined' && mensaje !== null) {\n  \nmsg.payload=mensaje\n\n    return msg;\n}\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":311.92847442626953,"y":1457.6785888671875,"wires":[["59fd7ab3a8c2a2ec"]]},{"id":"504dc03b350691fe","type":"api-current-state","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"tele on?","server":"5169096b.09f678","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"media_player.lg_webos_smart_tv","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"for":0,"forType":"num","forUnits":"minutes","x":450.428466796875,"y":1315.6785888671875,"wires":[["9a27e9c37a172850"],[]]},{"id":"81a25140269ec1ec","type":"function","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"notifica","func":"var viejo = msg.data.old_state.state;\nvar nuevo = msg.data.new_state.state;\nif (viejo == \"IN\" && nuevo==\"POST\")  {\n\nconst states = global.get('homeassistant').homeAssistant.states;\nvar marcador = \"¡¡FINAL!! \" + states['sensor.espana_marcador'].state\n\nmsg.payload = {}\nmsg.payload.chatId = 229448901\nmsg.payload.type = \"message\"\nmsg.payload.content = marcador\nmsg.payload.icon = \"esp\"\nreturn msg; \n} else {\n    if (viejo == \"MT\" && nuevo == \"IN\") {\n\n        const states = global.get('homeassistant').homeAssistant.states;\n        var marcador = \"2º TiEMPO \" + states['sensor.espana_marcador'].state\n\n    }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":458,"y":1406,"wires":[["1443ad5b7381216c","f9002de6f81cfb7c"]]},{"id":"f9002de6f81cfb7c","type":"api-call-service","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"FINAL","server":"5169096b.09f678","version":5,"debugenabled":false,"domain":"notify","service":"alexa_media_salon","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"<speak>   <audio src='https://sonidoscavilesphoto.s3.eu-west-3.amazonaws.com/finalpartido.mp3' />   </speak>\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":590,"y":1408,"wires":[[]]},{"id":"da41666b3aad9997","type":"delay","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":321,"y":1365,"wires":[["e089c6e5fb8f63c0"]]},{"id":"f121b8b07b30a46a","type":"delay","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":316,"y":1409,"wires":[["81a25140269ec1ec"]]},{"id":"5c6ad4053091d941","type":"delay","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":314,"y":1276,"wires":[["2acdb05f02ab96b7"]]},{"id":"968a4671e3157027","type":"api-current-state","z":"dc945ea982446b2e","g":"b34a1c3e55fd5f4c","name":"IN GAME","server":"5169096b.09f678","version":3,"outputs":2,"halt_if":"IN","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.espana","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"for":0,"forType":"num","forUnits":"minutes","x":309,"y":1319,"wires":[["504dc03b350691fe"],[]]},{"id":"5169096b.09f678","type":"server","name":"homeAssistant","version":5,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"e82eb89a07300374","type":"group","z":"dc945ea982446b2e","style":{"stroke":"#2e333a","stroke-opacity":"1","fill":"#2e333a","fill-opacity":"0.75","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["497e76cac61dda8e","9d01d998a185320f","537c6a9da917b860","cca9c05fcace360b"],"x":901.5,"y":1296,"w":414.5,"h":132},{"id":"497e76cac61dda8e","type":"api-call-service","z":"dc945ea982446b2e","g":"e82eb89a07300374","name":"tele","server":"5169096b.09f678","version":5,"debugenabled":false,"domain":"notify","service":"lg_webos_smart_tv","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"{{payload.content}}\",\"data\":{\"icon\":\"/config/www/icons/{{payload.icon}}.png\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1240,"y":1337,"wires":[[]]},{"id":"9d01d998a185320f","type":"api-call-service","z":"dc945ea982446b2e","g":"e82eb89a07300374","name":"movil","server":"5169096b.09f678","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_note11","areaId":[],"deviceId":[],"entityId":[],"data":"{\t   \"message\": payload.content,\t   \"title\": payload.title\t   \t}\t \t","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1030,"y":1387,"wires":[[]]},{"id":"537c6a9da917b860","type":"function","z":"dc945ea982446b2e","g":"e82eb89a07300374","name":"msgNotificacion","func":"var mensaje=\"\"\nmensaje=msg.payload.content\n if (msg.payload.icon ==\"undefined\" ) {icono=\"captain_marvel\"} else {icono=msg.payload.icon}\nmsg.payload={}\nmsg.payload.content=mensaje\nmsg.payload.icon=icono\n\nreturn msg;","outputs":1,"noerr":3,"initialize":"","finalize":"","libs":[],"x":1067,"y":1337,"wires":[["497e76cac61dda8e"]]},{"id":"cca9c05fcace360b","type":"link in","z":"dc945ea982446b2e","g":"e82eb89a07300374","name":"link in 1","links":["1443ad5b7381216c"],"x":942.5,"y":1352,"wires":[["537c6a9da917b860","9d01d998a185320f"]]}]

hi there and thanks for this great card

dumb question I am sure but it is driving me mad - what are the numbers under EPL teams representing e.g. here you have 6-2-0 under Man City ?

6 wins - 2 ties - 0 losses (nice by the way! :smile: )

1 Like

Thanks! Gave this a shot and it works. I’ll be setting this up for Six Nations later on…

  - platform: teamtracker
    league_id: "XXX"
    team_id: "FRA"
    sport_path: "rugby"
    league_path: "180659"
    name: "SixNations_FRA"

CL doesn’t work for me. There is no update of match data. Any reason why this should be?

Prob that there are no CL games in near future…assuming integration setup correctly the status of the sensor will be Not Found until nearer the game…then goes to Pre then In and finally Post.

With club football back its only now my sensors are working again with them pretty much all being Not Found during the World Cup

If its not that maybe elaborate on where you say “doesn’t work” and I’m sure you’ll get a solution :+1:t2:

I’m trying to setup the tracking of Sheffield United (SHU) who play in the English League Championship. I believe that this is LC, but doesn’t seem to like it. I was trying to set it up with CL, but this is for teams that play in the Champions League. I not really a football fan and setting this up for the wife, so not really familier with the various leagues etc.

OK, so long time before the Blades will reach the Champions League…that sensor will never work :thinking::rofl:

English Championship is not supported out of the box so you need to add as a Custom using the instructions here…

So when you setup the integration choose XXX as the League, enter SHU for Sheffield United, choose your friendly name and click next.
On next page enter soccer as Sport Path (case is important) and then eng.2 for League Path.

That’ll give you a sensor for their League games only…set it up now and it’ll be status Pre with next game on 26th at home to Coventry :soccer:

Thanks Gav for the help. Really appreciate it… however the wife wasn’t too impressed with your initial comment. :rofl:

Just set that up as per your instructions and all working.

1 Like

Would it be possible to add the “sport-level” configuration mentioned here?

The /teams API seems like it would work for at least some sports. I haven’t found a way to use it for NCAAF for example since there doesn’t seem to be a groups parameter. Maybe new sensors could just be created as teams appear in scoreboard API?

What problem are you trying to solve?

Integrate Italian SERIE B, please.

1 Like

This card is awesome! thanks so much for the work you have put in.

Is there anyway I can track the world junior hockey starting boxing day? I can see news of it on ESPN/olympics/ice-hockey but I cant figure out how to get it implemented, any help is appreciated :slight_smile:

I am not aware of any API for world junior hockey. If you find one, let us know.

Italian SERIE B should be supported via a Custom API Configuration. Try league_path: ita.2

See the README file and Wiki on the repo for more details.

Has anyone created a blueprint to notify mobile or iPad on team score and final score? Also, I have no sensor.team_tracker. All of my sensors are like sensor.dallas_cowboys, etc. Have I misconfigured the integration?

No, the sensor’s name was just a generic example.

You should go check the state of yours, in Developer Tools.
The changes I talk about in those automations are about the attributes of those sensors, with whatever names you gave them.

Thank You!

Hey guys,

I succeeded to create sensors, but I have some few questions. Is it possible to get all the matches from different leagues in one sensor?
Like all the matches from Real Madrid in the CL, Liga and Copa del Rey? I tried with the XXX and * but does not work for me.

Also is it possible to show only the knowing upcoming matches from ESPN, so the card won’t show ‘no upcoming games through…’. Thanks a lot!

Btw, thanks for this great project.

You have to set up a separate sensor for each league Real Madrid is in. Unfortunately the ESPN Scoreboard APIs are by league, not by team.

You can use a Conditional Card to hide the card when the state is NOT_FOUND. You can even group multiple Conditional Cards into a Vertical Stack card so you end up w/ one Vertical Stack card that holds all of the sensors for Real Madrid and only displays the one for the league with a game.

This is exactly what I do so I have cards being displayed and hidden all the time based on the sport season.

Hope this helps.

Vasqued2,

Thanks for your quick respons. I will try your solution. :+1:t4: