python-vw-carnet 0.3.0__tar.gz → 0.4.0__tar.gz
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.
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/PKG-INFO +1 -1
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/pyproject.toml +1 -1
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/__main__.py +12 -1
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/client.py +27 -0
- python_vw_carnet-0.4.0/src/python_vw_carnet/models/generic.py +9 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/README.md +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/__init__.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/constants.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/errors.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/__init__.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/ev_summary.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/garage.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/spin.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/token.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/vehicle.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/vehicle_location.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/vehicle_session.py +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/py.typed +0 -0
- {python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/utils.py +0 -0
|
@@ -9,7 +9,14 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
9
9
|
parser = argparse.ArgumentParser(description="Query captured myVW endpoints")
|
|
10
10
|
parser.add_argument(
|
|
11
11
|
"command",
|
|
12
|
-
choices=[
|
|
12
|
+
choices=[
|
|
13
|
+
"garage",
|
|
14
|
+
"status",
|
|
15
|
+
"location",
|
|
16
|
+
"ev-summary",
|
|
17
|
+
"preclimate_start",
|
|
18
|
+
"preclimate_stop",
|
|
19
|
+
],
|
|
13
20
|
help="Which payload to fetch",
|
|
14
21
|
)
|
|
15
22
|
parser.add_argument("--email", default=os.getenv("VW_EMAIL"))
|
|
@@ -44,6 +51,10 @@ def main() -> int:
|
|
|
44
51
|
payload = client.get_vehicle(vehicle_id=args.vehicle_id)
|
|
45
52
|
elif args.command == "location":
|
|
46
53
|
payload = client.get_vehicle_location(vehicle_id=args.vehicle_id)
|
|
54
|
+
elif args.command == "preclimate_start":
|
|
55
|
+
payload = client.start_ev_preclimate(vehicle_id=args.vehicle_id)
|
|
56
|
+
elif args.command == "preclimate_stop":
|
|
57
|
+
payload = client.stop_ev_preclimate(vehicle_id=args.vehicle_id)
|
|
47
58
|
else:
|
|
48
59
|
payload = client.get_ev_summary(
|
|
49
60
|
vehicle_id=args.vehicle_id, temp_unit=args.temp_unit
|
|
@@ -42,6 +42,7 @@ from .models import (
|
|
|
42
42
|
VehicleSessionRequest,
|
|
43
43
|
VehicleSessionResponse,
|
|
44
44
|
)
|
|
45
|
+
from .models.generic import GenericCorrelationIdResponse
|
|
45
46
|
|
|
46
47
|
logger = logging.getLogger(__name__)
|
|
47
48
|
|
|
@@ -177,6 +178,30 @@ class VWClient:
|
|
|
177
178
|
|
|
178
179
|
return EVSummaryResponse.model_validate(self._decode_json(response))
|
|
179
180
|
|
|
181
|
+
def start_ev_preclimate(self, vehicle_id: str) -> GenericCorrelationIdResponse:
|
|
182
|
+
logger.debug("Starting climate for %s", vehicle_id)
|
|
183
|
+
user_id = self._require(self.state.user_id, "Missing user id")
|
|
184
|
+
response = self._request(
|
|
185
|
+
"POST",
|
|
186
|
+
f"{BASE_URL}/ev/v1/vehicle/{vehicle_id}/pretripclimate/start",
|
|
187
|
+
token=self._resolve_vehicle_token(vehicle_id),
|
|
188
|
+
user_id_header=user_id,
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
return GenericCorrelationIdResponse.model_validate(self._decode_json(response))
|
|
192
|
+
|
|
193
|
+
def stop_ev_preclimate(self, vehicle_id: str) -> GenericCorrelationIdResponse:
|
|
194
|
+
logger.debug("Starting climate for %s", vehicle_id)
|
|
195
|
+
user_id = self._require(self.state.user_id, "Missing user id")
|
|
196
|
+
response = self._request(
|
|
197
|
+
"POST",
|
|
198
|
+
f"{BASE_URL}/ev/v1/vehicle/{vehicle_id}/pretripclimate/stop",
|
|
199
|
+
token=self._resolve_vehicle_token(vehicle_id),
|
|
200
|
+
user_id_header=user_id,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
return GenericCorrelationIdResponse.model_validate(self._decode_json(response))
|
|
204
|
+
|
|
180
205
|
def close(self) -> None:
|
|
181
206
|
logger.debug("Closing HTTP session")
|
|
182
207
|
self.session.close()
|
|
@@ -308,6 +333,8 @@ class VWClient:
|
|
|
308
333
|
return True
|
|
309
334
|
|
|
310
335
|
def _try_refresh_vehicle_token(self, vehicle_id: str) -> bool:
|
|
336
|
+
self._try_refresh_access_token()
|
|
337
|
+
|
|
311
338
|
if self._vehicle_token_valid(vehicle_id):
|
|
312
339
|
logger.debug('Using cached vehicle token for "%s"', vehicle_id)
|
|
313
340
|
return True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/vehicle_location.py
RENAMED
|
File without changes
|
{python_vw_carnet-0.3.0 → python_vw_carnet-0.4.0}/src/python_vw_carnet/models/vehicle_session.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|