Set renault quality scale to platinum (#85753)

* Set renault quality scale to platinum

* Ensure coordinators do not run at the same time

* Add comment
pull/86079/head
epenet 2023-01-17 11:50:17 +01:00 committed by GitHub
parent 1918f21fb1
commit b7f484a84f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -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"
}

View File

@ -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