Set renault quality scale to platinum (#85753)
* Set renault quality scale to platinum * Ensure coordinators do not run at the same time * Add commentpull/86079/head
parent
1918f21fb1
commit
b7f484a84f
|
@ -7,5 +7,6 @@
|
|||
"requirements": ["renault-api==0.1.11"],
|
||||
"codeowners": ["@epenet"],
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["renault_api"]
|
||||
"loggers": ["renault_api"],
|
||||
"quality_scale": "platinum"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Proxy to handle account communication with Renault servers."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable, Callable
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
@ -18,6 +19,9 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, Upda
|
|||
|
||||
T = TypeVar("T", bound=Optional[KamereonVehicleDataAttributes])
|
||||
|
||||
# We have potentially 7 coordinators per vehicle
|
||||
_PARALLEL_SEMAPHORE = asyncio.Semaphore(1)
|
||||
|
||||
|
||||
class RenaultDataUpdateCoordinator(DataUpdateCoordinator[T]):
|
||||
"""Handle vehicle communication with Renault servers."""
|
||||
|
@ -47,7 +51,8 @@ class RenaultDataUpdateCoordinator(DataUpdateCoordinator[T]):
|
|||
if self.update_method is None:
|
||||
raise NotImplementedError("Update method not implemented")
|
||||
try:
|
||||
return await self.update_method()
|
||||
async with _PARALLEL_SEMAPHORE:
|
||||
return await self.update_method()
|
||||
except AccessDeniedException as err:
|
||||
# Disable because the account is not allowed to access this Renault endpoint.
|
||||
self.update_interval = None
|
||||
|
|
Loading…
Reference in New Issue