Move asyncio lock in Teslemetry (#109044)

Use single wakelock per vehicle
This commit is contained in:
Brett Adams 2024-01-29 20:00:18 +10:00 committed by GitHub
parent fd87fd9559
commit d45227adbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -15,7 +15,6 @@ class TeslemetryVehicleEntity(CoordinatorEntity[TeslemetryVehicleDataCoordinator
"""Parent class for Teslemetry Entities."""
_attr_has_entity_name = True
_wakelock = asyncio.Lock()
def __init__(
self,
@ -26,6 +25,7 @@ class TeslemetryVehicleEntity(CoordinatorEntity[TeslemetryVehicleDataCoordinator
super().__init__(vehicle.coordinator)
self.key = key
self.api = vehicle.api
self._wakelock = vehicle.wakelock
car_type = self.coordinator.data["vehicle_config_car_type"]

View file

@ -1,6 +1,7 @@
"""The Teslemetry integration models."""
from __future__ import annotations
import asyncio
from dataclasses import dataclass
from tesla_fleet_api import VehicleSpecific
@ -15,3 +16,4 @@ class TeslemetryVehicleData:
api: VehicleSpecific
coordinator: TeslemetryVehicleDataCoordinator
vin: str
wakelock = asyncio.Lock()