Closed JeffCrum1 closed 1 year ago
I am not sure that I understand what you are asking for.
The date
attribute on the sensor is when the event starts. Use that attribute to know when the event starts.
All the card does is display a different term for the start based on what the sport is. This is controlled by the language files in dist/localize/languages
distributed with the card. The language file used is determined by what language the user picks as the language for their front end.
Thanks for your response.
Here is my situation. I have one automation with several triggers that notifies my wife an hour before each team plays. When 'kickoff in' of MLB team changes from 'in an hour' When 'kickoff in' of NHL team changes from 'in an hour' When 'kickoff in' of NFL team changes from 'in an hour' And, a notification of:
service: notify.{wife's_phone}
data:
title: >-
{{state_attr(trigger.entity_id, 'team_name')}} vs
{{state_attr(trigger.entity_id, 'opponent_name')}} @<br>
{{state_attr(trigger.entity_id, 'venue')}}
message: Game starts {{state_attr(trigger.entity_id, 'kickoff_in')}}
data:
image: "{{state_attr(trigger.entity_id, 'team_logo')}}"
I'd like to change the message to: message: {{state_attr(trigger.entity_id, 'start_term')}} {{state_attr(trigger.entity_id, 'kickoff_in')}}
So, it automatically fills in the start term for the correct sport in the correct language. Clearly, not a 'need'. But, I think it would be cool to name them correctly in the notification.
I know I could do a separate automation for each type of sport and just hard code the start term. But, was just wondering if it'd be possible in your project.
I hope that clears it up. I just like to limit the number of automations if it is possible to combine them.
Thanks for your consideration. If not, that is certainly okay :)
Got it.
I consciously split out anything that needs translations to other languages for display purposes into the card instead of the sensor. I rely on the ESPN and other API's to translate anything returned by the sensor. That makes is easy for someone to add a translation file if they want it and I assume ESPN translates their stuff correctly. This would push non-API stuff that needs translated into the sensor and I am reluctant to do that.
You should be able to get the same functionality by setting a start_term based on the sport
attribute. Once you get the sport attribute, set the start_term as you want and use that in your message.
{% set start_term = "Game Starts " %}
{% if sport == "football" %}
{% set start_term = "Kickoff " %}
{% elif sport == "baseball" %}
{% set start_term = "First pitch in " %}
{% endif %}
Let me know if you don't follow what I am talking about.
That makes total sense. Thanks so much for you input!
I can make that work.
Can you make the start_term attribute available?
These are different by sport. First Pitch Puck Drop Kick Off
I found the reference in ha_teamtracker_card. But,I don't see it here.
I am currently using 'Game starts ' for all. But, it just seems wrong :)