1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-20 02:48:57 +00:00

Bump Tesla Fleet to 1.3.0 (#159048)

This commit is contained in:
Brett Adams
2025-12-15 12:34:11 +10:00
committed by GitHub
parent e58fc6976d
commit 9b41bb09a7
6 changed files with 15 additions and 19 deletions

View File

@@ -1,6 +1,5 @@
"""Tesla Fleet integration.""" """Tesla Fleet integration."""
import asyncio
from typing import Final from typing import Final
from aiohttp.client_exceptions import ClientResponseError from aiohttp.client_exceptions import ClientResponseError
@@ -83,10 +82,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: TeslaFleetConfigEntry) -
region: str = token["ou_code"].lower() region: str = token["ou_code"].lower()
oauth_session = OAuth2Session(hass, entry, implementation) oauth_session = OAuth2Session(hass, entry, implementation)
refresh_lock = asyncio.Lock()
async def _refresh_token() -> str: async def _get_access_token() -> str:
async with refresh_lock:
try: try:
await oauth_session.async_ensure_token_valid() await oauth_session.async_ensure_token_valid()
except ClientResponseError as e: except ClientResponseError as e:
@@ -99,13 +96,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: TeslaFleetConfigEntry) -
# Create API connection # Create API connection
tesla = TeslaFleetApi( tesla = TeslaFleetApi(
session=session, session=session,
access_token=access_token, access_token=_get_access_token,
region=region, region=region,
charging_scope=False, charging_scope=False,
partner_scope=False, partner_scope=False,
energy_scope=Scope.ENERGY_DEVICE_DATA in scopes, energy_scope=Scope.ENERGY_DEVICE_DATA in scopes,
vehicle_scope=Scope.VEHICLE_DEVICE_DATA in scopes, vehicle_scope=Scope.VEHICLE_DEVICE_DATA in scopes,
refresh_hook=_refresh_token,
) )
try: try:
products = (await tesla.products())["response"] products = (await tesla.products())["response"]

View File

@@ -8,5 +8,5 @@
"integration_type": "hub", "integration_type": "hub",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["tesla-fleet-api"], "loggers": ["tesla-fleet-api"],
"requirements": ["tesla-fleet-api==1.2.7"] "requirements": ["tesla-fleet-api==1.3.0"]
} }

View File

@@ -7,5 +7,5 @@
"integration_type": "hub", "integration_type": "hub",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["tesla-fleet-api"], "loggers": ["tesla-fleet-api"],
"requirements": ["tesla-fleet-api==1.2.7", "teslemetry-stream==0.7.10"] "requirements": ["tesla-fleet-api==1.3.0", "teslemetry-stream==0.7.10"]
} }

View File

@@ -7,5 +7,5 @@
"integration_type": "hub", "integration_type": "hub",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["tessie", "tesla-fleet-api"], "loggers": ["tessie", "tesla-fleet-api"],
"requirements": ["tessie-api==0.1.1", "tesla-fleet-api==1.2.7"] "requirements": ["tessie-api==0.1.1", "tesla-fleet-api==1.3.0"]
} }

2
requirements_all.txt generated
View File

@@ -2978,7 +2978,7 @@ temperusb==1.6.1
# homeassistant.components.tesla_fleet # homeassistant.components.tesla_fleet
# homeassistant.components.teslemetry # homeassistant.components.teslemetry
# homeassistant.components.tessie # homeassistant.components.tessie
tesla-fleet-api==1.2.7 tesla-fleet-api==1.3.0
# homeassistant.components.powerwall # homeassistant.components.powerwall
tesla-powerwall==0.5.2 tesla-powerwall==0.5.2

View File

@@ -2478,7 +2478,7 @@ temperusb==1.6.1
# homeassistant.components.tesla_fleet # homeassistant.components.tesla_fleet
# homeassistant.components.teslemetry # homeassistant.components.teslemetry
# homeassistant.components.tessie # homeassistant.components.tessie
tesla-fleet-api==1.2.7 tesla-fleet-api==1.3.0
# homeassistant.components.powerwall # homeassistant.components.powerwall
tesla-powerwall==0.5.2 tesla-powerwall==0.5.2