tesla-fleet-api 0.9.9__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tesla_fleet_api/__init__.py +7 -22
- tesla_fleet_api/const.py +1 -225
- tesla_fleet_api/exceptions.py +117 -0
- tesla_fleet_api/tesla/__init__.py +11 -0
- tesla_fleet_api/tesla/bluetooth.py +33 -0
- tesla_fleet_api/{charging.py → tesla/charging.py} +1 -1
- tesla_fleet_api/{energy.py → tesla/energysite.py} +41 -33
- tesla_fleet_api/{teslafleetapi.py → tesla/fleet.py} +8 -53
- tesla_fleet_api/{teslafleetoauth.py → tesla/oauth.py} +3 -4
- tesla_fleet_api/{partner.py → tesla/partner.py} +1 -1
- tesla_fleet_api/tesla/tesla.py +52 -0
- tesla_fleet_api/{user.py → tesla/user.py} +1 -1
- tesla_fleet_api/teslemetry/__init__.py +5 -0
- tesla_fleet_api/{teslemetry.py → teslemetry/teslemetry.py} +16 -25
- tesla_fleet_api/teslemetry/vehicle.py +73 -0
- tesla_fleet_api/tessie/__init__.py +5 -0
- tesla_fleet_api/{tessie.py → tessie/tessie.py} +17 -9
- tesla_fleet_api/tessie/vehicle.py +41 -0
- {tesla_fleet_api-0.9.9.dist-info → tesla_fleet_api-1.0.0.dist-info}/METADATA +3 -2
- tesla_fleet_api-1.0.0.dist-info/RECORD +24 -0
- tesla_fleet_api/energyspecific.py +0 -125
- tesla_fleet_api/pb2/__init__.py +0 -0
- tesla_fleet_api/pb2/__init__.pyi +0 -9
- tesla_fleet_api/pb2/car_server_pb2.py +0 -175
- tesla_fleet_api/pb2/car_server_pb2.pyi +0 -904
- tesla_fleet_api/pb2/common_pb2.py +0 -33
- tesla_fleet_api/pb2/common_pb2.pyi +0 -130
- tesla_fleet_api/pb2/errors_pb2.py +0 -17
- tesla_fleet_api/pb2/errors_pb2.pyi +0 -32
- tesla_fleet_api/pb2/keys_pb2.py +0 -15
- tesla_fleet_api/pb2/keys_pb2.pyi +0 -21
- tesla_fleet_api/pb2/managed_charging_pb2.py +0 -15
- tesla_fleet_api/pb2/managed_charging_pb2.pyi +0 -17
- tesla_fleet_api/pb2/signatures_pb2.py +0 -35
- tesla_fleet_api/pb2/signatures_pb2.pyi +0 -152
- tesla_fleet_api/pb2/universal_message_pb2.py +0 -30
- tesla_fleet_api/pb2/universal_message_pb2.pyi +0 -148
- tesla_fleet_api/pb2/vcsec_pb2.py +0 -79
- tesla_fleet_api/pb2/vcsec_pb2.pyi +0 -482
- tesla_fleet_api/pb2/vehicle_pb2.py +0 -125
- tesla_fleet_api/pb2/vehicle_pb2.pyi +0 -1183
- tesla_fleet_api/teslafleetopensource.py +0 -61
- tesla_fleet_api/vehicle.py +0 -878
- tesla_fleet_api/vehiclesigned.py +0 -1127
- tesla_fleet_api/vehiclespecific.py +0 -505
- tesla_fleet_api-0.9.9.dist-info/RECORD +0 -42
- {tesla_fleet_api-0.9.9.dist-info → tesla_fleet_api-1.0.0.dist-info}/LICENSE +0 -0
- {tesla_fleet_api-0.9.9.dist-info → tesla_fleet_api-1.0.0.dist-info}/WHEEL +0 -0
- {tesla_fleet_api-0.9.9.dist-info → tesla_fleet_api-1.0.0.dist-info}/top_level.txt +0 -0
tesla_fleet_api/__init__.py
CHANGED
@@ -1,30 +1,15 @@
|
|
1
|
-
from .
|
2
|
-
from .
|
3
|
-
from .
|
4
|
-
from .
|
5
|
-
from .
|
6
|
-
from .
|
7
|
-
from .energy import Energy
|
8
|
-
from .energyspecific import EnergySpecific
|
9
|
-
from .partner import Partner
|
10
|
-
from .user import User
|
11
|
-
from .vehicle import Vehicle
|
12
|
-
from .vehiclespecific import VehicleSpecific
|
13
|
-
from .vehiclesigned import VehicleSigned
|
14
|
-
|
1
|
+
from .tesla.fleet import TeslaFleetApi
|
2
|
+
from .tesla.bluetooth import TeslaBluetooth
|
3
|
+
from .tesla.oauth import TeslaFleetOAuth
|
4
|
+
from .tesla.opensource import TeslaFleetOpenSource
|
5
|
+
from .teslemetry.teslemetry import Teslemetry
|
6
|
+
from .tessie.tessie import Tessie
|
15
7
|
|
16
8
|
__all__ = [
|
17
9
|
"TeslaFleetApi",
|
10
|
+
"TeslaBluetooth",
|
18
11
|
"TeslaFleetOAuth",
|
19
12
|
"TeslaFleetOpenSource",
|
20
13
|
"Teslemetry",
|
21
14
|
"Tessie",
|
22
|
-
"Charging",
|
23
|
-
"Energy",
|
24
|
-
"EnergySpecific",
|
25
|
-
"Partner",
|
26
|
-
"User",
|
27
|
-
"Vehicle",
|
28
|
-
"VehicleSpecific",
|
29
|
-
"VehicleSigned",
|
30
15
|
]
|
tesla_fleet_api/const.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
from enum import Enum
|
4
4
|
import logging
|
5
5
|
|
6
|
-
VERSION = "0.
|
6
|
+
VERSION = "1.0.0"
|
7
7
|
LOGGER = logging.getLogger(__package__)
|
8
8
|
SERVERS = {
|
9
9
|
"na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
|
@@ -151,230 +151,6 @@ class EnergyExportMode(StrEnum):
|
|
151
151
|
NEVER = "never"
|
152
152
|
|
153
153
|
|
154
|
-
class TelemetryField(StrEnum):
|
155
|
-
"""Fields available in telemetry streams"""
|
156
|
-
|
157
|
-
AC_CHARGING_ENERGY_IN = "ACChargingEnergyIn"
|
158
|
-
AC_CHARGING_POWER = "ACChargingPower"
|
159
|
-
AUTO_SEAT_CLIMATE_LEFT = "AutoSeatClimateLeft"
|
160
|
-
AUTO_SEAT_CLIMATE_RIGHT = "AutoSeatClimateRight"
|
161
|
-
AUTOMATIC_BLIND_SPOT_CAMERA = "AutomaticBlindSpotCamera"
|
162
|
-
AUTOMATIC_EMERGENCY_BRAKING_OFF = "AutomaticEmergencyBrakingOff"
|
163
|
-
BATTERY_HEATER_ON = "BatteryHeaterOn"
|
164
|
-
BATTERY_LEVEL = "BatteryLevel"
|
165
|
-
BLIND_SPOT_COLLISION_WARNING_CHIME = "BlindSpotCollisionWarningChime"
|
166
|
-
BMS_FULL_CHARGE_COMPLETE = "BmsFullchargecomplete"
|
167
|
-
BMS_STATE = "BMSState"
|
168
|
-
BRAKE_PEDAL = "BrakePedal"
|
169
|
-
BRAKE_PEDAL_POS = "BrakePedalPos"
|
170
|
-
BRICK_VOLTAGE_MAX = "BrickVoltageMax"
|
171
|
-
BRICK_VOLTAGE_MIN = "BrickVoltageMin"
|
172
|
-
CABIN_OVERHEAT_PROTECTION_MODE = "CabinOverheatProtectionMode"
|
173
|
-
CABIN_OVERHEAT_PROTECTION_TEMPERATURE_LIMIT = "CabinOverheatProtectionTemperatureLimit"
|
174
|
-
CAR_TYPE = "CarType"
|
175
|
-
CENTER_DISPLAY = "CenterDisplay"
|
176
|
-
CHARGE_AMPS = "ChargeAmps"
|
177
|
-
CHARGE_CURRENT_REQUEST = "ChargeCurrentRequest"
|
178
|
-
CHARGE_CURRENT_REQUEST_MAX = "ChargeCurrentRequestMax"
|
179
|
-
CHARGE_ENABLE_REQUEST = "ChargeEnableRequest"
|
180
|
-
CHARGE_LIMIT_SOC = "ChargeLimitSoc"
|
181
|
-
CHARGE_PORT = "ChargePort"
|
182
|
-
CHARGE_PORT_COLD_WEATHER_MODE = "ChargePortColdWeatherMode"
|
183
|
-
CHARGE_PORT_DOOR_OPEN = "ChargePortDoorOpen"
|
184
|
-
CHARGE_PORT_LATCH = "ChargePortLatch"
|
185
|
-
CHARGE_STATE = "ChargeState"
|
186
|
-
CHARGER_PHASES = "ChargerPhases"
|
187
|
-
CHARGING_CABLE_TYPE = "ChargingCableType"
|
188
|
-
CLIMATE_KEEPER_MODE = "ClimateKeeperMode"
|
189
|
-
CRUISE_FOLLOW_DISTANCE = "CruiseFollowDistance"
|
190
|
-
CRUISE_SET_SPEED = "CruiseSetSpeed"
|
191
|
-
CRUISE_STATE = "CruiseState"
|
192
|
-
CURRENT_LIMIT_MPH = "CurrentLimitMph"
|
193
|
-
DC_CHARGING_ENERGY_IN = "DCChargingEnergyIn"
|
194
|
-
DC_CHARGING_POWER = "DCChargingPower"
|
195
|
-
DC_DC_ENABLE = "DCDCEnable"
|
196
|
-
DEFROST_FOR_PRECONDITIONING = "DefrostForPreconditioning"
|
197
|
-
DEFROST_MODE = "DefrostMode"
|
198
|
-
DESTINATION_NAME = "DestinationName"
|
199
|
-
DESTINATION_LOCATION = "DestinationLocation"
|
200
|
-
DETAILED_CHARGE_STATE = "DetailedChargeState"
|
201
|
-
DI_AXLE_SPEED_F = "DiAxleSpeedF"
|
202
|
-
DI_AXLE_SPEED_R = "DiAxleSpeedR"
|
203
|
-
DI_AXLE_SPEED_REL = "DiAxleSpeedREL"
|
204
|
-
DI_AXLE_SPEED_RER = "DiAxleSpeedRER"
|
205
|
-
DI_HEATSINK_TF = "DiHeatsinkTF"
|
206
|
-
DI_HEATSINK_TR = "DiHeatsinkTR"
|
207
|
-
DI_HEATSINK_TREL = "DiHeatsinkTREL"
|
208
|
-
DI_HEATSINK_TRER = "DiHeatsinkTRER"
|
209
|
-
DI_MOTOR_CURRENT_F = "DiMotorCurrentF"
|
210
|
-
DI_MOTOR_CURRENT_R = "DiMotorCurrentR"
|
211
|
-
DI_MOTOR_CURRENT_REL = "DiMotorCurrentREL"
|
212
|
-
DI_MOTOR_CURRENT_RER = "DiMotorCurrentRER"
|
213
|
-
DI_SLAVE_TORQUE_CMD = "DiSlaveTorqueCmd"
|
214
|
-
DI_STATE_F = "DiStateF"
|
215
|
-
DI_STATE_R = "DiStateR"
|
216
|
-
DI_STATE_REL = "DiStateREL"
|
217
|
-
DI_STATE_RER = "DiStateRER"
|
218
|
-
DI_STATOR_TEMP_F = "DiStatorTempF"
|
219
|
-
DI_STATOR_TEMP_R = "DiStatorTempR"
|
220
|
-
DI_STATOR_TEMP_REL = "DiStatorTempREL"
|
221
|
-
DI_STATOR_TEMP_RER = "DiStatorTempRER"
|
222
|
-
DI_TORQUE_ACTUAL_F = "DiTorqueActualF"
|
223
|
-
DI_TORQUE_ACTUAL_R = "DiTorqueActualR"
|
224
|
-
DI_TORQUE_ACTUAL_REL = "DiTorqueActualREL"
|
225
|
-
DI_TORQUE_ACTUAL_RER = "DiTorqueActualRER"
|
226
|
-
DI_TORQUEMOTOR = "DiTorquemotor"
|
227
|
-
DI_V_BAT_F = "DiVBatF"
|
228
|
-
DI_V_BAT_R = "DiVBatR"
|
229
|
-
DI_V_BAT_REL = "DiVBatREL"
|
230
|
-
DI_V_BAT_RER = "DiVBatRER"
|
231
|
-
DOOR_STATE = "DoorState"
|
232
|
-
DRIVE_RAIL = "DriveRail"
|
233
|
-
DRIVER_SEAT_BELT = "DriverSeatBelt"
|
234
|
-
DRIVER_SEAT_OCCUPIED = "DriverSeatOccupied"
|
235
|
-
EFFICIENCY_PACKAGE = "EfficiencyPackage"
|
236
|
-
EMERGENCY_LANE_DEPARTURE_AVOIDANCE = "EmergencyLaneDepartureAvoidance"
|
237
|
-
ENERGY_REMAINING = "EnergyRemaining"
|
238
|
-
EST_BATTERY_RANGE = "EstBatteryRange"
|
239
|
-
ESTIMATED_HOURS_TO_CHARGE_TERMINATION = "EstimatedHoursToChargeTermination"
|
240
|
-
EUROPE_VEHICLE = "EuropeVehicle"
|
241
|
-
EXPECTED_ENERGY_PERCENT_AT_TRIP_ARRIVAL = "ExpectedEnergyPercentAtTripArrival"
|
242
|
-
EXPERIMENTAL_1 = "Experimental_1"
|
243
|
-
EXPERIMENTAL_2 = "Experimental_2"
|
244
|
-
EXPERIMENTAL_3 = "Experimental_3"
|
245
|
-
EXPERIMENTAL_4 = "Experimental_4"
|
246
|
-
EXTERIOR_COLOR = "ExteriorColor"
|
247
|
-
FAST_CHARGER_PRESENT = "FastChargerPresent"
|
248
|
-
FAST_CHARGER_TYPE = "FastChargerType"
|
249
|
-
FD_WINDOW = "FdWindow"
|
250
|
-
FORWARD_COLLISION_WARNING = "ForwardCollisionWarning"
|
251
|
-
FP_WINDOW = "FpWindow"
|
252
|
-
GEAR = "Gear"
|
253
|
-
GPS_HEADING = "GpsHeading"
|
254
|
-
GPS_STATE = "GpsState"
|
255
|
-
GUEST_MODE_ENABLED = "GuestModeEnabled"
|
256
|
-
GUEST_MODE_MOBILE_ACCESS_STATE = "GuestModeMobileAccessState"
|
257
|
-
HOMELINK_DEVICE_COUNT = "HomelinkDeviceCount"
|
258
|
-
HOMELINK_NEARBY = "HomelinkNearby"
|
259
|
-
HVAC_AC_ENABLED = "HvacACEnabled"
|
260
|
-
HVAC_AUTO_MODE = "HvacAutoMode"
|
261
|
-
HVAC_FAN_SPEED = "HvacFanSpeed"
|
262
|
-
HVAC_FAN_STATUS = "HvacFanStatus"
|
263
|
-
HVAC_LEFT_TEMPERATURE_REQUEST = "HvacLeftTemperatureRequest"
|
264
|
-
HVAC_POWER = "HvacPower"
|
265
|
-
HVAC_RIGHT_TEMPERATURE_REQUEST = "HvacRightTemperatureRequest"
|
266
|
-
HVAC_STEERING_WHEEL_HEAT_AUTO = "HvacSteeringWheelHeatAuto"
|
267
|
-
HVAC_STEERING_WHEEL_HEAT_LEVEL = "HvacSteeringWheelHeatLevel"
|
268
|
-
HVIL = "Hvil"
|
269
|
-
IDEAL_BATTERY_RANGE = "IdealBatteryRange"
|
270
|
-
INSIDE_TEMP = "InsideTemp"
|
271
|
-
ISOLATION_RESISTANCE = "IsolationResistance"
|
272
|
-
LANE_DEPARTURE_AVOIDANCE = "LaneDepartureAvoidance"
|
273
|
-
LATERAL_ACCELERATION = "LateralAcceleration"
|
274
|
-
LIFETIME_ENERGY_GAINED_REGEN = "LifetimeEnergyGainedRegen"
|
275
|
-
LIFETIME_ENERGY_USED = "LifetimeEnergyUsed"
|
276
|
-
LIFETIME_ENERGY_USED_DRIVE = "LifetimeEnergyUsedDrive"
|
277
|
-
LOCATION = "Location"
|
278
|
-
LOCKED = "Locked"
|
279
|
-
LONGITUDINAL_ACCELERATION = "LongitudinalAcceleration"
|
280
|
-
MILES_TO_ARRIVAL = "MilesToArrival"
|
281
|
-
MINUTES_TO_ARRIVAL = "MinutesToArrival"
|
282
|
-
MODULE_TEMP_MAX = "ModuleTempMax"
|
283
|
-
MODULE_TEMP_MIN = "ModuleTempMin"
|
284
|
-
NOT_ENOUGH_POWER_TO_HEAT = "NotEnoughPowerToHeat"
|
285
|
-
NUM_BRICK_VOLTAGE_MAX = "NumBrickVoltageMax"
|
286
|
-
NUM_BRICK_VOLTAGE_MIN = "NumBrickVoltageMin"
|
287
|
-
NUM_MODULE_TEMP_MAX = "NumModuleTempMax"
|
288
|
-
NUM_MODULE_TEMP_MIN = "NumModuleTempMin"
|
289
|
-
ODOMETER = "Odometer"
|
290
|
-
OFFROAD_LIGHTBAR_PRESENT = "OffroadLightbarPresent"
|
291
|
-
ORIGIN_LOCATION = "OriginLocation"
|
292
|
-
OUTSIDE_TEMP = "OutsideTemp"
|
293
|
-
PACK_CURRENT = "PackCurrent"
|
294
|
-
PACK_VOLTAGE = "PackVoltage"
|
295
|
-
PAIRED_PHONE_KEY_AND_KEY_FOB_QTY = "PairedPhoneKeyAndKeyFobQty"
|
296
|
-
PASSENGER_SEAT_BELT = "PassengerSeatBelt"
|
297
|
-
PEDAL_POSITION = "PedalPosition"
|
298
|
-
PIN_TO_DRIVE_ENABLED = "PinToDriveEnabled"
|
299
|
-
POWERSHARE_HOURS_LEFT = "PowershareHoursLeft"
|
300
|
-
POWERSHARE_INSTANTANEOUS_POWER_KW = "PowershareInstantaneousPowerKW"
|
301
|
-
POWERSHARE_STATUS = "PowershareStatus"
|
302
|
-
POWERSHARE_STOP_REASON = "PowershareStopReason"
|
303
|
-
POWERSHARE_TYPE = "PowershareType"
|
304
|
-
PRECONDITIONING_ENABLED = "PreconditioningEnabled"
|
305
|
-
RATED_RANGE = "RatedRange"
|
306
|
-
RD_WINDOW = "RdWindow"
|
307
|
-
REAR_DISPLAY_HVAC_ENABLED = "RearDisplayHvacEnabled"
|
308
|
-
REAR_SEAT_HEATERS = "RearSeatHeaters"
|
309
|
-
REMOTE_START_ENABLED = "RemoteStartEnabled"
|
310
|
-
RIGHT_HAND_DRIVE = "RightHandDrive"
|
311
|
-
ROOF_COLOR = "RoofColor"
|
312
|
-
ROUTE_LAST_UPDATED = "RouteLastUpdated"
|
313
|
-
ROUTE_LINE = "RouteLine"
|
314
|
-
ROUTE_TRAFFIC_MINUTES_DELAY = "RouteTrafficMinutesDelay"
|
315
|
-
RP_WINDOW = "RpWindow"
|
316
|
-
SCHEDULED_CHARGING_MODE = "ScheduledChargingMode"
|
317
|
-
SCHEDULED_CHARGING_PENDING = "ScheduledChargingPending"
|
318
|
-
SCHEDULED_CHARGING_START_TIME = "ScheduledChargingStartTime"
|
319
|
-
SCHEDULED_DEPARTURE_TIME = "ScheduledDepartureTime"
|
320
|
-
SEAT_HEATER_LEFT = "SeatHeaterLeft"
|
321
|
-
SEAT_HEATER_REAR_CENTER = "SeatHeaterRearCenter"
|
322
|
-
SEAT_HEATER_REAR_LEFT = "SeatHeaterRearLeft"
|
323
|
-
SEAT_HEATER_REAR_RIGHT = "SeatHeaterRearRight"
|
324
|
-
SEAT_HEATER_RIGHT = "SeatHeaterRight"
|
325
|
-
SENTRY_MODE = "SentryMode"
|
326
|
-
SERVICE_MODE = "ServiceMode"
|
327
|
-
SOC = "Soc"
|
328
|
-
SOFTWARE_UPDATE_DOWNLOAD_PERCENT_COMPLETE = "SoftwareUpdateDownloadPercentComplete"
|
329
|
-
SOFTWARE_UPDATE_EXPECTED_DURATION_MINUTES = "SoftwareUpdateExpectedDurationMinutes"
|
330
|
-
SOFTWARE_UPDATE_INSTALLATION_PERCENT_COMPLETE = "SoftwareUpdateInstallationPercentComplete"
|
331
|
-
SOFTWARE_UPDATE_SCHEDULED_START_TIME = "SoftwareUpdateScheduledStartTime"
|
332
|
-
SOFTWARE_UPDATE_VERSION = "SoftwareUpdateVersion"
|
333
|
-
SPEED_LIMIT_MODE = "SpeedLimitMode"
|
334
|
-
SPEED_LIMIT_WARNING = "SpeedLimitWarning"
|
335
|
-
SUPERCHARGER_SESSION_TRIP_PLANNER = "SuperchargerSessionTripPlanner"
|
336
|
-
TIME_TO_FULL_CHARGE = "TimeToFullCharge"
|
337
|
-
TONNEAU_OPEN_PERCENT = "TonneauOpenPercent"
|
338
|
-
TONNEAU_POSITION = "TonneauPosition"
|
339
|
-
TONNEAU_TENT_MODE = "TonneauTentMode"
|
340
|
-
TPMS_HARD_WARNINGS = "TpmsHardWarnings"
|
341
|
-
TPMS_LAST_SEEN_PRESSURE_TIME_FL = "TpmsLastSeenPressureTimeFl"
|
342
|
-
TPMS_LAST_SEEN_PRESSURE_TIME_FR = "TpmsLastSeenPressureTimeFr"
|
343
|
-
TPMS_LAST_SEEN_PRESSURE_TIME_RL = "TpmsLastSeenPressureTimeRl"
|
344
|
-
TPMS_LAST_SEEN_PRESSURE_TIME_RR = "TpmsLastSeenPressureTimeRr"
|
345
|
-
TPMS_PRESSURE_FL = "TpmsPressureFl"
|
346
|
-
TPMS_PRESSURE_FR = "TpmsPressureFr"
|
347
|
-
TPMS_PRESSURE_RL = "TpmsPressureRl"
|
348
|
-
TPMS_PRESSURE_RR = "TpmsPressureRr"
|
349
|
-
TPMS_SOFT_WARNINGS = "TpmsSoftWarnings"
|
350
|
-
TRIM = "Trim"
|
351
|
-
VALET_MODE_ENABLED = "ValetModeEnabled"
|
352
|
-
VEHICLE_NAME = "VehicleName"
|
353
|
-
VEHICLE_SPEED = "VehicleSpeed"
|
354
|
-
VERSION = "Version"
|
355
|
-
WHEEL_TYPE = "WheelType"
|
356
|
-
WIPER_HEAT_ENABLED = "WiperHeatEnabled"
|
357
|
-
LOCATED_AT_HOME = "LocatedAtHome"
|
358
|
-
LOCATED_AT_WORK = "LocatedAtWork"
|
359
|
-
LOCATED_AT_FAVORITE = "LocatedAtFavorite"
|
360
|
-
SETTING_DISTANCE_UNIT = "SettingDistanceUnit"
|
361
|
-
SETTING_TEMPERATURE_UNIT = "SettingTemperatureUnit"
|
362
|
-
SETTING_24_HOUR_TIME = "Setting24HourTime"
|
363
|
-
SETTING_TIRE_PRESSURE_UNIT = "SettingTirePressureUnit"
|
364
|
-
SETTING_CHARGE_UNIT = "SettingChargeUnit"
|
365
|
-
CLIMATE_SEAT_COOLING_FRONT_LEFT = "ClimateSeatCoolingFrontLeft"
|
366
|
-
CLIMATE_SEAT_COOLING_FRONT_RIGHT = "ClimateSeatCoolingFrontRight"
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
class TelemetryAlert(StrEnum):
|
371
|
-
"""Alerts available in telemetry streams"""
|
372
|
-
|
373
|
-
CUSTOMER = "Customer"
|
374
|
-
SERVICE = "Service"
|
375
|
-
SERVICE_FIX = "ServiceFix"
|
376
|
-
|
377
|
-
|
378
154
|
class TeslaEnergyPeriod(StrEnum):
|
379
155
|
"""Period for history for energy sites"""
|
380
156
|
|
tesla_fleet_api/exceptions.py
CHANGED
@@ -853,6 +853,123 @@ SIGNED_MESSAGE_INFORMATION_FAULTS = [
|
|
853
853
|
SignedMessageInformationFaultCouldNotHashMetadata,
|
854
854
|
]
|
855
855
|
|
856
|
+
class WhitelistOperationStatus(TeslaFleetError):
|
857
|
+
message = "Whitelist operation failed"
|
858
|
+
|
859
|
+
class WhitelistOperationUndocumentedError(WhitelistOperationStatus):
|
860
|
+
message = "Undocumented whitelist operation error"
|
861
|
+
code = 1
|
862
|
+
|
863
|
+
class WhitelistOperationNoPermissionToRemoveOneself(WhitelistOperationStatus):
|
864
|
+
message = "No permission to remove oneself from whitelist"
|
865
|
+
code = 2
|
866
|
+
|
867
|
+
class WhitelistOperationKeyfobSlotsFull(WhitelistOperationStatus):
|
868
|
+
message = "Keyfob slots are full"
|
869
|
+
code = 3
|
870
|
+
|
871
|
+
class WhitelistOperationWhitelistFull(WhitelistOperationStatus):
|
872
|
+
message = "Whitelist is full"
|
873
|
+
code = 4
|
874
|
+
|
875
|
+
class WhitelistOperationNoPermissionToAdd(WhitelistOperationStatus):
|
876
|
+
message = "No permission to add to whitelist"
|
877
|
+
code = 5
|
878
|
+
|
879
|
+
class WhitelistOperationInvalidPublicKey(WhitelistOperationStatus):
|
880
|
+
message = "Invalid public key"
|
881
|
+
code = 6
|
882
|
+
|
883
|
+
class WhitelistOperationNoPermissionToRemove(WhitelistOperationStatus):
|
884
|
+
message = "No permission to remove from whitelist"
|
885
|
+
code = 7
|
886
|
+
|
887
|
+
class WhitelistOperationNoPermissionToChangePermissions(WhitelistOperationStatus):
|
888
|
+
message = "No permission to change permissions"
|
889
|
+
code = 8
|
890
|
+
|
891
|
+
class WhitelistOperationAttemptingToElevateOthersAboveOneself(WhitelistOperationStatus):
|
892
|
+
message = "Attempting to elevate others above oneself"
|
893
|
+
code = 9
|
894
|
+
|
895
|
+
class WhitelistOperationAttemptingToDemoteSuperiorToOneself(WhitelistOperationStatus):
|
896
|
+
message = "Attempting to demote superior to oneself"
|
897
|
+
code = 10
|
898
|
+
|
899
|
+
class WhitelistOperationAttemptingToRemoveOwnPermissions(WhitelistOperationStatus):
|
900
|
+
message = "Attempting to remove own permissions"
|
901
|
+
code = 11
|
902
|
+
|
903
|
+
class WhitelistOperationPublicKeyNotOnWhitelist(WhitelistOperationStatus):
|
904
|
+
message = "Public key not on whitelist"
|
905
|
+
code = 12
|
906
|
+
|
907
|
+
class WhitelistOperationAttemptingToAddExistingKey(WhitelistOperationStatus):
|
908
|
+
message = "Attempting to add key that is already on the whitelist"
|
909
|
+
code = 13
|
910
|
+
|
911
|
+
class WhitelistOperationNotAllowedToAddUnlessOnReader(WhitelistOperationStatus):
|
912
|
+
message = "Not allowed to add unless on reader"
|
913
|
+
code = 14
|
914
|
+
|
915
|
+
class WhitelistOperationFMModifyingOutsideOfFMode(WhitelistOperationStatus):
|
916
|
+
message = "FM modifying outside of F mode"
|
917
|
+
code = 15
|
918
|
+
|
919
|
+
class WhitelistOperationFMAttemptingToAddPermanentKey(WhitelistOperationStatus):
|
920
|
+
message = "FM attempting to add permanent key"
|
921
|
+
code = 16
|
922
|
+
|
923
|
+
class WhitelistOperationFMAttemptingToRemovePermanentKey(WhitelistOperationStatus):
|
924
|
+
message = "FM attempting to remove permanent key"
|
925
|
+
code = 17
|
926
|
+
|
927
|
+
class WhitelistOperationKeychainWhileFSFull(WhitelistOperationStatus):
|
928
|
+
message = "Keychain while FS full"
|
929
|
+
code = 18
|
930
|
+
|
931
|
+
class WhitelistOperationAttemptingToAddKeyWithoutRole(WhitelistOperationStatus):
|
932
|
+
message = "Attempting to add key without role"
|
933
|
+
code = 19
|
934
|
+
|
935
|
+
class WhitelistOperationAttemptingToAddKeyWithServiceRole(WhitelistOperationStatus):
|
936
|
+
message = "Attempting to add key with service role"
|
937
|
+
code = 20
|
938
|
+
|
939
|
+
class WhitelistOperationNonServiceKeyAttemptingToAddServiceTech(WhitelistOperationStatus):
|
940
|
+
message = "Non-service key attempting to add service tech"
|
941
|
+
code = 21
|
942
|
+
|
943
|
+
class WhitelistOperationServiceKeyAttemptingToAddServiceTechOutsideServiceMode(WhitelistOperationStatus):
|
944
|
+
message = "Service key attempting to add service tech outside service mode"
|
945
|
+
code = 22
|
946
|
+
|
947
|
+
WHITELIST_OPERATION_STATUS = [
|
948
|
+
None,
|
949
|
+
WhitelistOperationUndocumentedError,
|
950
|
+
WhitelistOperationNoPermissionToRemoveOneself,
|
951
|
+
WhitelistOperationKeyfobSlotsFull,
|
952
|
+
WhitelistOperationWhitelistFull,
|
953
|
+
WhitelistOperationNoPermissionToAdd,
|
954
|
+
WhitelistOperationInvalidPublicKey,
|
955
|
+
WhitelistOperationNoPermissionToRemove,
|
956
|
+
WhitelistOperationNoPermissionToChangePermissions,
|
957
|
+
WhitelistOperationAttemptingToElevateOthersAboveOneself,
|
958
|
+
WhitelistOperationAttemptingToDemoteSuperiorToOneself,
|
959
|
+
WhitelistOperationAttemptingToRemoveOwnPermissions,
|
960
|
+
WhitelistOperationPublicKeyNotOnWhitelist,
|
961
|
+
WhitelistOperationAttemptingToAddExistingKey,
|
962
|
+
WhitelistOperationNotAllowedToAddUnlessOnReader,
|
963
|
+
WhitelistOperationFMModifyingOutsideOfFMode,
|
964
|
+
WhitelistOperationFMAttemptingToAddPermanentKey,
|
965
|
+
WhitelistOperationFMAttemptingToRemovePermanentKey,
|
966
|
+
WhitelistOperationKeychainWhileFSFull,
|
967
|
+
WhitelistOperationAttemptingToAddKeyWithoutRole,
|
968
|
+
WhitelistOperationAttemptingToAddKeyWithServiceRole,
|
969
|
+
WhitelistOperationNonServiceKeyAttemptingToAddServiceTech,
|
970
|
+
WhitelistOperationServiceKeyAttemptingToAddServiceTechOutsideServiceMode
|
971
|
+
]
|
972
|
+
|
856
973
|
|
857
974
|
async def raise_for_status(resp: aiohttp.ClientResponse) -> None:
|
858
975
|
"""Raise an exception if the response status code is >=400."""
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"""Bluetooth only interface."""
|
2
|
+
|
3
|
+
import re
|
4
|
+
from .tesla import Tesla
|
5
|
+
from .vehicle.bluetooth import VehicleBluetooth
|
6
|
+
|
7
|
+
class TeslaBluetooth(Tesla):
|
8
|
+
"""Class describing a Tesla Bluetooth connection."""
|
9
|
+
|
10
|
+
def __init__(
|
11
|
+
self,
|
12
|
+
):
|
13
|
+
"""Initialize the Tesla Fleet API."""
|
14
|
+
|
15
|
+
self.vehicles = Vehicles(self)
|
16
|
+
|
17
|
+
def valid_name(self, name: str) -> bool:
|
18
|
+
"""Check if a BLE device name is a valid Tesla vehicle."""
|
19
|
+
return bool(re.match("^S[a-f0-9]{16}[A-F]$", name))
|
20
|
+
|
21
|
+
class Vehicles(dict[str, VehicleBluetooth]):
|
22
|
+
"""Class containing and creating vehicles."""
|
23
|
+
|
24
|
+
_parent: TeslaBluetooth
|
25
|
+
|
26
|
+
def __init__(self, parent: TeslaBluetooth):
|
27
|
+
self._parent = parent
|
28
|
+
|
29
|
+
def createBluetooth(self, vin: str) -> VehicleBluetooth:
|
30
|
+
"""Creates a specific vehicle."""
|
31
|
+
vehicle = VehicleBluetooth(self._parent, vin)
|
32
|
+
self[vin] = vehicle
|
33
|
+
return vehicle
|
@@ -1,37 +1,35 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from typing import Any, TYPE_CHECKING
|
3
|
-
from
|
4
|
-
from .energyspecific import EnergySpecific
|
3
|
+
from ..const import Method, EnergyOperationMode, EnergyExportMode, TeslaEnergyPeriod
|
5
4
|
|
6
5
|
if TYPE_CHECKING:
|
7
|
-
from .
|
6
|
+
from . import TeslaFleetApi
|
8
7
|
|
9
|
-
|
10
|
-
class Energy:
|
8
|
+
class EnergySite:
|
11
9
|
"""Class describing the Tesla Fleet API partner endpoints"""
|
12
10
|
|
13
|
-
|
11
|
+
energy_site_id: int
|
14
12
|
|
15
|
-
def __init__(
|
13
|
+
def __init__(
|
14
|
+
self,
|
15
|
+
parent: TeslaFleetApi,
|
16
|
+
energy_site_id: int
|
17
|
+
):
|
16
18
|
self._request = parent._request
|
17
|
-
|
18
|
-
def specific(self, energy_site_id: int) -> EnergySpecific:
|
19
|
-
"""Create a specific energy site."""
|
20
|
-
return EnergySpecific(self, energy_site_id)
|
19
|
+
self.energy_site_id = energy_site_id
|
21
20
|
|
22
21
|
async def backup(
|
23
|
-
self,
|
22
|
+
self, backup_reserve_percent: int
|
24
23
|
) -> dict[str, Any]:
|
25
24
|
"""Adjust the site's backup reserve."""
|
26
25
|
return await self._request(
|
27
26
|
Method.POST,
|
28
|
-
f"api/1/energy_sites/{energy_site_id}/backup",
|
27
|
+
f"api/1/energy_sites/{self.energy_site_id}/backup",
|
29
28
|
json={"backup_reserve_percent": backup_reserve_percent},
|
30
29
|
)
|
31
30
|
|
32
31
|
async def backup_history(
|
33
32
|
self,
|
34
|
-
energy_site_id: int,
|
35
33
|
period: TeslaEnergyPeriod | str | None,
|
36
34
|
start_date: str | None = None,
|
37
35
|
end_date: str | None = None,
|
@@ -40,7 +38,7 @@ class Energy:
|
|
40
38
|
"""Returns the backup (off-grid) event history of the site in duration of seconds."""
|
41
39
|
return await self._request(
|
42
40
|
Method.GET,
|
43
|
-
f"api/1/energy_sites/{energy_site_id}/calendar_history",
|
41
|
+
f"api/1/energy_sites/{self.energy_site_id}/calendar_history",
|
44
42
|
params={
|
45
43
|
"kind": "backup",
|
46
44
|
"start_date": start_date,
|
@@ -52,7 +50,6 @@ class Energy:
|
|
52
50
|
|
53
51
|
async def charge_history(
|
54
52
|
self,
|
55
|
-
energy_site_id: int,
|
56
53
|
start_date: str,
|
57
54
|
end_date: str,
|
58
55
|
time_zone: str | None = None,
|
@@ -60,7 +57,7 @@ class Energy:
|
|
60
57
|
"""Returns the charging history of a wall connector."""
|
61
58
|
return await self._request(
|
62
59
|
Method.GET,
|
63
|
-
f"api/1/energy_sites/{energy_site_id}/telemetry_history",
|
60
|
+
f"api/1/energy_sites/{self.energy_site_id}/telemetry_history",
|
64
61
|
params={
|
65
62
|
"kind": "charge",
|
66
63
|
"start_date": start_date,
|
@@ -71,7 +68,6 @@ class Energy:
|
|
71
68
|
|
72
69
|
async def energy_history(
|
73
70
|
self,
|
74
|
-
energy_site_id: int,
|
75
71
|
period: TeslaEnergyPeriod | str | None,
|
76
72
|
start_date: str | None = None,
|
77
73
|
end_date: str | None = None,
|
@@ -80,7 +76,7 @@ class Energy:
|
|
80
76
|
"""Returns the energy measurements of the site, aggregated to the requested period."""
|
81
77
|
return await self._request(
|
82
78
|
Method.GET,
|
83
|
-
f"api/1/energy_sites/{energy_site_id}/calendar_history",
|
79
|
+
f"api/1/energy_sites/{self.energy_site_id}/calendar_history",
|
84
80
|
params={
|
85
81
|
"kind": "energy",
|
86
82
|
"start_date": start_date,
|
@@ -92,70 +88,82 @@ class Energy:
|
|
92
88
|
|
93
89
|
async def grid_import_export(
|
94
90
|
self,
|
95
|
-
energy_site_id: int,
|
96
91
|
disallow_charge_from_grid_with_solar_installed: bool | None = None,
|
97
92
|
customer_preferred_export_rule: EnergyExportMode | str | None = None,
|
98
93
|
) -> dict[str, Any]:
|
99
94
|
"""Allow/disallow charging from the grid and exporting energy to the grid."""
|
100
95
|
return await self._request(
|
101
96
|
Method.POST,
|
102
|
-
f"api/1/energy_sites/{energy_site_id}/grid_import_export",
|
97
|
+
f"api/1/energy_sites/{self.energy_site_id}/grid_import_export",
|
103
98
|
json={
|
104
99
|
"disallow_charge_from_grid_with_solar_installed": disallow_charge_from_grid_with_solar_installed,
|
105
100
|
"customer_preferred_export_rule": customer_preferred_export_rule,
|
106
101
|
},
|
107
102
|
)
|
108
103
|
|
109
|
-
async def live_status(self
|
104
|
+
async def live_status(self) -> dict[str, Any]:
|
110
105
|
"""Returns the live status of the site (power, state of energy, grid status, storm mode)."""
|
111
106
|
return await self._request(
|
112
107
|
Method.GET,
|
113
|
-
f"api/1/energy_sites/{energy_site_id}/live_status",
|
108
|
+
f"api/1/energy_sites/{self.energy_site_id}/live_status",
|
114
109
|
)
|
115
110
|
|
116
111
|
async def off_grid_vehicle_charging_reserve(
|
117
|
-
self,
|
112
|
+
self, off_grid_vehicle_charging_reserve_percent: int
|
118
113
|
) -> dict[str, Any]:
|
119
114
|
"""Adjust the site's off-grid vehicle charging backup reserve."""
|
120
115
|
return await self._request(
|
121
116
|
Method.POST,
|
122
|
-
f"api/1/energy_sites/{energy_site_id}/off_grid_vehicle_charging_reserve",
|
117
|
+
f"api/1/energy_sites/{self.energy_site_id}/off_grid_vehicle_charging_reserve",
|
123
118
|
json={
|
124
119
|
"off_grid_vehicle_charging_reserve_percent": off_grid_vehicle_charging_reserve_percent
|
125
120
|
},
|
126
121
|
)
|
127
122
|
|
128
123
|
async def operation(
|
129
|
-
self,
|
124
|
+
self, default_real_mode: EnergyOperationMode | str
|
130
125
|
) -> dict[str, Any]:
|
131
126
|
"""Set the site's mode."""
|
132
127
|
return await self._request(
|
133
128
|
Method.POST,
|
134
|
-
f"api/1/energy_sites/{energy_site_id}/operation",
|
129
|
+
f"api/1/energy_sites/{self.energy_site_id}/operation",
|
135
130
|
json={"default_real_mode": default_real_mode},
|
136
131
|
)
|
137
132
|
|
138
|
-
async def site_info(self
|
133
|
+
async def site_info(self) -> dict[str, Any]:
|
139
134
|
"""Returns information about the site. Things like assets (has solar, etc), settings (backup reserve, etc), and features (storm_mode_capable, etc)."""
|
140
135
|
return await self._request(
|
141
136
|
Method.GET,
|
142
|
-
f"api/1/energy_sites/{energy_site_id}/site_info",
|
137
|
+
f"api/1/energy_sites/{self.energy_site_id}/site_info",
|
143
138
|
)
|
144
139
|
|
145
|
-
async def storm_mode(self,
|
140
|
+
async def storm_mode(self, enabled: bool) -> dict[str, Any]:
|
146
141
|
"""Update storm watch participation."""
|
147
142
|
return await self._request(
|
148
143
|
Method.POST,
|
149
|
-
f"api/1/energy_sites/{energy_site_id}/storm_mode",
|
144
|
+
f"api/1/energy_sites/{self.energy_site_id}/storm_mode",
|
150
145
|
json={"enabled": enabled},
|
151
146
|
)
|
152
147
|
|
153
148
|
async def time_of_use_settings(
|
154
|
-
self,
|
149
|
+
self, settings: dict[str, Any]
|
155
150
|
) -> dict[str, Any]:
|
156
151
|
"""Update the time of use settings for the energy site."""
|
157
152
|
return await self._request(
|
158
153
|
Method.POST,
|
159
|
-
f"api/1/energy_sites/{energy_site_id}/time_of_use_settings",
|
154
|
+
f"api/1/energy_sites/{self.energy_site_id}/time_of_use_settings",
|
160
155
|
json={"tou_settings": {"tariff_content_v2": settings}},
|
161
156
|
)
|
157
|
+
|
158
|
+
class EnergySites(dict[int, EnergySite]):
|
159
|
+
"""Class describing the Tesla Fleet API partner endpoints"""
|
160
|
+
|
161
|
+
_parent: TeslaFleetApi
|
162
|
+
|
163
|
+
def __init__(self, parent: TeslaFleetApi):
|
164
|
+
self._parent = parent
|
165
|
+
|
166
|
+
def create(self, energy_site_id: int) -> EnergySite:
|
167
|
+
"""Create a specific energy site."""
|
168
|
+
self[energy_site_id] = EnergySite(self._parent, energy_site_id)
|
169
|
+
return self[energy_site_id]
|