2024-07-19 07:05:27 +00:00
|
|
|
"""The Tesla Fleet integration models."""
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
2024-09-03 12:38:47 +00:00
|
|
|
import asyncio
|
2024-07-19 07:05:27 +00:00
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
|
|
from tesla_fleet_api import EnergySpecific, VehicleSpecific
|
|
|
|
from tesla_fleet_api.const import Scope
|
|
|
|
|
|
|
|
from homeassistant.helpers.device_registry import DeviceInfo
|
|
|
|
|
|
|
|
from .coordinator import (
|
2025-01-17 09:34:35 +00:00
|
|
|
TeslaFleetEnergySiteHistoryCoordinator,
|
2024-07-19 07:05:27 +00:00
|
|
|
TeslaFleetEnergySiteInfoCoordinator,
|
|
|
|
TeslaFleetEnergySiteLiveCoordinator,
|
|
|
|
TeslaFleetVehicleDataCoordinator,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class TeslaFleetData:
|
|
|
|
"""Data for the TeslaFleet integration."""
|
|
|
|
|
|
|
|
vehicles: list[TeslaFleetVehicleData]
|
|
|
|
energysites: list[TeslaFleetEnergyData]
|
|
|
|
scopes: list[Scope]
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class TeslaFleetVehicleData:
|
|
|
|
"""Data for a vehicle in the TeslaFleet integration."""
|
|
|
|
|
|
|
|
api: VehicleSpecific
|
|
|
|
coordinator: TeslaFleetVehicleDataCoordinator
|
|
|
|
vin: str
|
|
|
|
device: DeviceInfo
|
2024-09-03 12:38:47 +00:00
|
|
|
signing: bool
|
|
|
|
wakelock = asyncio.Lock()
|
2024-07-19 07:05:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class TeslaFleetEnergyData:
|
|
|
|
"""Data for a vehicle in the TeslaFleet integration."""
|
|
|
|
|
|
|
|
api: EnergySpecific
|
|
|
|
live_coordinator: TeslaFleetEnergySiteLiveCoordinator
|
2025-01-17 09:34:35 +00:00
|
|
|
history_coordinator: TeslaFleetEnergySiteHistoryCoordinator
|
2024-07-19 07:05:27 +00:00
|
|
|
info_coordinator: TeslaFleetEnergySiteInfoCoordinator
|
|
|
|
id: int
|
|
|
|
device: DeviceInfo
|