Bump tesla-fleet-api to 0.4.9 (#112288)
* Bump to 0.4.9 * Use SubscriptionRequired instead of PaymentRequiredpull/112483/head
parent
995d93dd33
commit
f801ec45ce
|
@ -3,7 +3,11 @@ import asyncio
|
|||
from typing import Final
|
||||
|
||||
from tesla_fleet_api import EnergySpecific, Teslemetry, VehicleSpecific
|
||||
from tesla_fleet_api.exceptions import InvalidToken, PaymentRequired, TeslaFleetError
|
||||
from tesla_fleet_api.exceptions import (
|
||||
InvalidToken,
|
||||
SubscriptionRequired,
|
||||
TeslaFleetError,
|
||||
)
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, Platform
|
||||
|
@ -36,7 +40,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
except InvalidToken:
|
||||
LOGGER.error("Access token is invalid, unable to connect to Teslemetry")
|
||||
return False
|
||||
except PaymentRequired:
|
||||
except SubscriptionRequired:
|
||||
LOGGER.error("Subscription required, unable to connect to Telemetry")
|
||||
return False
|
||||
except TeslaFleetError as e:
|
||||
|
|
|
@ -6,7 +6,11 @@ from typing import Any
|
|||
|
||||
from aiohttp import ClientConnectionError
|
||||
from tesla_fleet_api import Teslemetry
|
||||
from tesla_fleet_api.exceptions import InvalidToken, PaymentRequired, TeslaFleetError
|
||||
from tesla_fleet_api.exceptions import (
|
||||
InvalidToken,
|
||||
SubscriptionRequired,
|
||||
TeslaFleetError,
|
||||
)
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
|
@ -41,7 +45,7 @@ class TeslemetryConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
await teslemetry.test()
|
||||
except InvalidToken:
|
||||
errors[CONF_ACCESS_TOKEN] = "invalid_access_token"
|
||||
except PaymentRequired:
|
||||
except SubscriptionRequired:
|
||||
errors["base"] = "subscription_required"
|
||||
except ClientConnectionError:
|
||||
errors["base"] = "cannot_connect"
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
"documentation": "https://www.home-assistant.io/integrations/teslemetry",
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["tesla-fleet-api"],
|
||||
"requirements": ["tesla-fleet-api==0.4.6"]
|
||||
"requirements": ["tesla-fleet-api==0.4.9"]
|
||||
}
|
||||
|
|
|
@ -2677,7 +2677,7 @@ temperusb==1.6.1
|
|||
# tensorflow==2.5.0
|
||||
|
||||
# homeassistant.components.teslemetry
|
||||
tesla-fleet-api==0.4.6
|
||||
tesla-fleet-api==0.4.9
|
||||
|
||||
# homeassistant.components.powerwall
|
||||
tesla-powerwall==0.5.1
|
||||
|
|
|
@ -2051,7 +2051,7 @@ temescal==0.5
|
|||
temperusb==1.6.1
|
||||
|
||||
# homeassistant.components.teslemetry
|
||||
tesla-fleet-api==0.4.6
|
||||
tesla-fleet-api==0.4.9
|
||||
|
||||
# homeassistant.components.powerwall
|
||||
tesla-powerwall==0.5.1
|
||||
|
|
|
@ -4,7 +4,11 @@ from unittest.mock import patch
|
|||
|
||||
from aiohttp import ClientConnectionError
|
||||
import pytest
|
||||
from tesla_fleet_api.exceptions import InvalidToken, PaymentRequired, TeslaFleetError
|
||||
from tesla_fleet_api.exceptions import (
|
||||
InvalidToken,
|
||||
SubscriptionRequired,
|
||||
TeslaFleetError,
|
||||
)
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.teslemetry.const import DOMAIN
|
||||
|
@ -54,7 +58,7 @@ async def test_form(
|
|||
("side_effect", "error"),
|
||||
[
|
||||
(InvalidToken, {CONF_ACCESS_TOKEN: "invalid_access_token"}),
|
||||
(PaymentRequired, {"base": "subscription_required"}),
|
||||
(SubscriptionRequired, {"base": "subscription_required"}),
|
||||
(ClientConnectionError, {"base": "cannot_connect"}),
|
||||
(TeslaFleetError, {"base": "unknown"}),
|
||||
],
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
from freezegun.api import FrozenDateTimeFactory
|
||||
from tesla_fleet_api.exceptions import (
|
||||
InvalidToken,
|
||||
PaymentRequired,
|
||||
SubscriptionRequired,
|
||||
TeslaFleetError,
|
||||
VehicleOffline,
|
||||
)
|
||||
|
@ -42,7 +42,7 @@ async def test_auth_failure(hass: HomeAssistant, mock_products) -> None:
|
|||
async def test_subscription_failure(hass: HomeAssistant, mock_products) -> None:
|
||||
"""Test init with an client response error."""
|
||||
|
||||
mock_products.side_effect = PaymentRequired
|
||||
mock_products.side_effect = SubscriptionRequired
|
||||
entry = await setup_platform(hass)
|
||||
assert entry.state is ConfigEntryState.SETUP_ERROR
|
||||
|
||||
|
|
Loading…
Reference in New Issue