Platinum quality for Tessie (#121962)

This commit is contained in:
Brett Adams 2024-07-18 17:38:26 +10:00 committed by GitHub
parent e4ef4b81ba
commit b06d3fe3b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 56 additions and 0 deletions

View File

@ -20,6 +20,8 @@ from .const import TessieState
from .entity import TessieEnergyEntity, TessieEntity
from .models import TessieEnergyData, TessieVehicleData
PARALLEL_UPDATES = 0
@dataclass(frozen=True, kw_only=True)
class TessieBinarySensorEntityDescription(BinarySensorEntityDescription):

View File

@ -22,6 +22,8 @@ from . import TessieConfigEntry
from .entity import TessieEntity
from .models import TessieVehicleData
PARALLEL_UPDATES = 0
@dataclass(frozen=True, kw_only=True)
class TessieButtonEntityDescription(ButtonEntityDescription):

View File

@ -26,6 +26,8 @@ from .const import TessieClimateKeeper
from .entity import TessieEntity
from .models import TessieVehicleData
PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -38,6 +38,7 @@ class TessieConfigFlow(ConfigFlow, domain=DOMAIN):
"""Get configuration from the user."""
errors: dict[str, str] = {}
if user_input:
self._async_abort_entries_match(dict(user_input))
try:
await get_state_of_all_vehicles(
session=async_get_clientsession(self.hass),

View File

@ -29,6 +29,8 @@ from .const import TessieCoverStates
from .entity import TessieEntity
from .models import TessieVehicleData
PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -12,6 +12,8 @@ from . import TessieConfigEntry
from .entity import TessieEntity
from .models import TessieVehicleData
PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -26,6 +26,8 @@ from .const import DOMAIN, TessieChargeCableLockStates
from .entity import TessieEntity
from .models import TessieVehicleData
PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -6,5 +6,6 @@
"documentation": "https://www.home-assistant.io/integrations/tessie",
"iot_class": "cloud_polling",
"loggers": ["tessie"],
"quality_scale": "platinum",
"requirements": ["tessie-api==0.1.1", "tesla-fleet-api==0.7.2"]
}

View File

@ -20,6 +20,8 @@ STATES = {
"Stopped": MediaPlayerState.IDLE,
}
PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -31,6 +31,8 @@ from .entity import TessieEnergyEntity, TessieEntity
from .helpers import handle_command
from .models import TessieEnergyData, TessieVehicleData
PARALLEL_UPDATES = 0
@dataclass(frozen=True, kw_only=True)
class TessieNumberEntityDescription(NumberEntityDescription):

View File

@ -32,6 +32,8 @@ SEAT_COOLERS = {
"climate_state_seat_fan_front_right": "front_right",
}
PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -367,6 +367,8 @@ ENERGY_INFO_DESCRIPTIONS: tuple[TessieSensorEntityDescription, ...] = (
),
)
PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
},
"error": {
"invalid_access_token": "[%key:common::config_flow::error::invalid_access_token%]",
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",

View File

@ -71,6 +71,8 @@ CHARGE_DESCRIPTION: TessieSwitchEntityDescription = TessieSwitchEntityDescriptio
off_func=lambda: stop_charging,
)
PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -15,6 +15,8 @@ from .const import TessieUpdateStatus
from .entity import TessieEntity
from .models import TessieVehicleData
PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -67,6 +67,33 @@ async def test_form(
assert result2["data"] == TEST_CONFIG
async def test_abort(
hass: HomeAssistant,
mock_config_flow_get_state_of_all_vehicles,
mock_async_setup_entry,
) -> None:
"""Test a duplicate entry aborts."""
mock_entry = MockConfigEntry(
domain=DOMAIN,
data=TEST_CONFIG,
)
mock_entry.add_to_hass(hass)
result1 = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
result2 = await hass.config_entries.flow.async_configure(
result1["flow_id"],
TEST_CONFIG,
)
await hass.async_block_till_done()
assert result2["type"] is FlowResultType.ABORT
assert result2["reason"] == "already_configured"
@pytest.mark.parametrize(
("side_effect", "error"),
[