tesla-fleet-api 0.7.8__py3-none-any.whl → 0.8.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
  from typing import Any, List, TYPE_CHECKING
3
+ from cryptography.hazmat.primitives.asymmetric import ec
3
4
  from .const import (
4
5
  Method,
5
6
  Trunk,
@@ -13,6 +14,7 @@ from .const import (
13
14
  Level,
14
15
  )
15
16
  from .vehiclespecific import VehicleSpecific
17
+ from .vehiclesigned import VehicleSigned
16
18
 
17
19
  if TYPE_CHECKING:
18
20
  from .teslafleetapi import TeslaFleetApi
@@ -31,6 +33,12 @@ class Vehicle:
31
33
  """Creates a class for each vehicle."""
32
34
  return VehicleSpecific(self, vin)
33
35
 
36
+ def specific_signed(
37
+ self, vin: str, private_key: ec.EllipticCurvePrivateKey | None = None
38
+ ) -> VehicleSigned:
39
+ """Creates a class for each vehicle with command signing."""
40
+ return VehicleSigned(self, vin, private_key)
41
+
34
42
  def pre2021(self, vin: str) -> bool:
35
43
  """Checks if a vehicle is a pre-2021 model S or X."""
36
44
  return vin[9] <= "L" and vin[3] in ["S", "X"]
@@ -719,7 +727,7 @@ class Vehicle:
719
727
  return await self._request(
720
728
  Method.POST,
721
729
  f"api/1/vehicles/{vehicle_tag}/signed_command",
722
- {"routable_message": routable_message},
730
+ json={"routable_message": routable_message},
723
731
  )
724
732
 
725
733
  async def vehicle(self, vehicle_tag: str | int) -> dict[str, Any]: