hass-core/homeassistant/components/tesla_fleet/models.py
Brett Adams 6ecc5c19a2
Add climate platform to Tesla Fleet (#123169)
* Add climate

* docstring

* Add tests

* Fix limited scope situation

* Add another test

* Add icons

* Type vehicle data

* Replace inline temperatures

* Fix handle_vehicle_command type

* Fix preset turning HVAC off

* Fix cop_mode check

* Use constants

* Reference docs in command signing error

* Move to a read-only check

* Remove raise_for

* Fixes

* Tests

* Remove raise_for_signing

* Remove unused strings

* Fix async_set_temperature

* Correct tests

* Remove HVAC modes at startup in read-only mode

* Fix order of init actions to set hvac_modes correctly

* Fix no temp test

* Add handle command type

* Docstrings

* fix matches and fix a bug

* Split tests

* Fix issues from rebase
2024-09-03 14:38:47 +02:00

49 lines
1.1 KiB
Python

"""The Tesla Fleet integration models."""
from __future__ import annotations
import asyncio
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 (
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
signing: bool
wakelock = asyncio.Lock()
@dataclass
class TeslaFleetEnergyData:
"""Data for a vehicle in the TeslaFleet integration."""
api: EnergySpecific
live_coordinator: TeslaFleetEnergySiteLiveCoordinator
info_coordinator: TeslaFleetEnergySiteInfoCoordinator
id: int
device: DeviceInfo