Skip to content

Commit

Permalink
Hack to override 'fr' to 'en' when sport is tennis
Browse files Browse the repository at this point in the history
  • Loading branch information
vasqued2 committed Jan 22, 2023
1 parent b9e56c9 commit 3fac9f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions custom_components/teamtracker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,15 @@ async def async_call_api(self, config, hass, lang) -> dict:

sport_path = config[CONF_SPORT_PATH]
league_path = config[CONF_LEAGUE_PATH]

#
# For some reason, the tennis API has behaves inconsistently when language is french so
# override it to 'en' to get consistent behavior ¯\_(ツ)_/¯
#
if lang == "fr" and sport_path == "tennis":
_LOGGER.debug("%s: Overriding language '%s' to 'en' for '%s'", sensor_name, lang, sport_path)
lang = "en"

url_parms = "?lang=" + lang[:2] + "&limit=" + str(API_LIMIT)

d1 = (date.today() - timedelta(days=1)).strftime("%Y%m%d")
Expand Down
2 changes: 1 addition & 1 deletion custom_components/teamtracker/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

# Misc
TEAM_ID = ""
VERSION = "v0.6.4-beta2"
VERSION = "v0.6.4-beta4"
ISSUE_URL = "https://github.com/vasqued2/ha-teamtracker"
DOMAIN = "teamtracker"
PLATFORM = "sensor"
Expand Down

0 comments on commit 3fac9f9

Please sign in to comment.