tesla-fleet-api 0.7.5__tar.gz → 0.7.6__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {tesla_fleet_api-0.7.5/tesla_fleet_api.egg-info → tesla_fleet_api-0.7.6}/PKG-INFO +1 -1
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/setup.py +1 -1
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/const.py +17 -1
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/energy.py +7 -10
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/energyspecific.py +8 -9
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/teslafleetapi.py +1 -1
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6/tesla_fleet_api.egg-info}/PKG-INFO +1 -1
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/LICENSE +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/README.md +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/setup.cfg +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/__init__.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/charging.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/exceptions.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/partner.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/ratecalculator.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/teslafleetoauth.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/teslafleetopensource.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/teslemetry.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/tessie.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/user.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/vehicle.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api/vehiclespecific.py +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api.egg-info/SOURCES.txt +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api.egg-info/dependency_links.txt +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api.egg-info/requires.txt +0 -0
- {tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api.egg-info/top_level.txt +0 -0
@@ -3,7 +3,7 @@
|
|
3
3
|
from enum import Enum
|
4
4
|
import logging
|
5
5
|
|
6
|
-
VERSION = "0.7.
|
6
|
+
VERSION = "0.7.6"
|
7
7
|
LOGGER = logging.getLogger(__package__)
|
8
8
|
SERVERS = {
|
9
9
|
"na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
|
@@ -15,10 +15,16 @@ SERVERS = {
|
|
15
15
|
class IntEnum(int, Enum):
|
16
16
|
"""Integer Enum."""
|
17
17
|
|
18
|
+
def __str__(self) -> str:
|
19
|
+
return str(self.value)
|
20
|
+
|
18
21
|
|
19
22
|
class StrEnum(str, Enum):
|
20
23
|
"""String Enum."""
|
21
24
|
|
25
|
+
def __str__(self) -> str:
|
26
|
+
return self.value
|
27
|
+
|
22
28
|
|
23
29
|
class Method(StrEnum):
|
24
30
|
"""HTTP Methods."""
|
@@ -302,3 +308,13 @@ class TelemetryAlert(StrEnum):
|
|
302
308
|
CUSTOMER = "Customer"
|
303
309
|
SERVICE = "Service"
|
304
310
|
SERVICE_FIX = "ServiceFix"
|
311
|
+
|
312
|
+
|
313
|
+
class TeslaEnergyPeriod(StrEnum):
|
314
|
+
"""Period for history for energy sites"""
|
315
|
+
|
316
|
+
DAY = "day"
|
317
|
+
WEEK = "week"
|
318
|
+
MONTH = "month"
|
319
|
+
YEAR = "year"
|
320
|
+
LIFETIME = "lifetime"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from typing import Any, TYPE_CHECKING
|
3
|
-
from .const import Method, EnergyOperationMode, EnergyExportMode
|
3
|
+
from .const import Method, EnergyOperationMode, EnergyExportMode, TeslaEnergyKind, TeslaEnergyPeriod
|
4
4
|
from .energyspecific import EnergySpecific
|
5
5
|
|
6
6
|
if TYPE_CHECKING:
|
@@ -32,18 +32,17 @@ class Energy:
|
|
32
32
|
async def backup_history(
|
33
33
|
self,
|
34
34
|
energy_site_id: int,
|
35
|
-
kind: str,
|
36
35
|
start_date: str,
|
37
36
|
end_date: str,
|
38
|
-
period: str,
|
37
|
+
period: TeslaEnergyPeriod | str,
|
39
38
|
time_zone: str,
|
40
39
|
) -> dict[str, Any]:
|
41
40
|
"""Returns the backup (off-grid) event history of the site in duration of seconds."""
|
42
41
|
return await self._request(
|
43
42
|
Method.GET,
|
44
43
|
f"api/1/energy_sites/{energy_site_id}/calendar_history",
|
45
|
-
|
46
|
-
"kind":
|
44
|
+
params={
|
45
|
+
"kind": "backup",
|
47
46
|
"start_date": start_date,
|
48
47
|
"end_date": end_date,
|
49
48
|
"period": period,
|
@@ -54,7 +53,6 @@ class Energy:
|
|
54
53
|
async def charge_history(
|
55
54
|
self,
|
56
55
|
energy_site_id: int,
|
57
|
-
kind: str,
|
58
56
|
start_date: str,
|
59
57
|
end_date: str,
|
60
58
|
time_zone: str,
|
@@ -64,7 +62,7 @@ class Energy:
|
|
64
62
|
Method.GET,
|
65
63
|
f"api/1/energy_sites/{energy_site_id}/telemetry_history",
|
66
64
|
params={
|
67
|
-
"kind":
|
65
|
+
"kind": "charge",
|
68
66
|
"start_date": start_date,
|
69
67
|
"end_date": end_date,
|
70
68
|
"time_zone": time_zone,
|
@@ -74,10 +72,9 @@ class Energy:
|
|
74
72
|
async def energy_history(
|
75
73
|
self,
|
76
74
|
energy_site_id: int,
|
77
|
-
kind: str,
|
78
75
|
start_date: str,
|
79
76
|
end_date: str,
|
80
|
-
period: str,
|
77
|
+
period: TeslaEnergyPeriod | str,
|
81
78
|
time_zone: str,
|
82
79
|
) -> dict[str, Any]:
|
83
80
|
"""Returns the energy measurements of the site, aggregated to the requested period."""
|
@@ -85,7 +82,7 @@ class Energy:
|
|
85
82
|
Method.GET,
|
86
83
|
f"api/1/energy_sites/{energy_site_id}/calendar_history",
|
87
84
|
params={
|
88
|
-
"kind":
|
85
|
+
"kind": "energy",
|
89
86
|
"start_date": start_date,
|
90
87
|
"end_date": end_date,
|
91
88
|
"period": period,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from typing import Any, TYPE_CHECKING
|
3
|
-
from .const import EnergyExportMode, EnergyOperationMode
|
3
|
+
from .const import EnergyExportMode, EnergyOperationMode, TeslaEnergyKind, TeslaEnergyPeriod
|
4
4
|
|
5
5
|
if TYPE_CHECKING:
|
6
6
|
from .energy import Energy
|
@@ -29,20 +29,22 @@ class EnergySpecific:
|
|
29
29
|
|
30
30
|
async def backup_history(
|
31
31
|
self,
|
32
|
-
kind: str,
|
33
32
|
start_date: str,
|
34
33
|
end_date: str,
|
35
|
-
period: str,
|
34
|
+
period: TeslaEnergyPeriod | str,
|
36
35
|
time_zone: str,
|
37
36
|
) -> dict[str, Any]:
|
38
37
|
"""Returns the backup (off-grid) event history of the site in duration of seconds."""
|
39
38
|
return await self._parent.backup_history(
|
40
|
-
self.energy_site_id,
|
39
|
+
self.energy_site_id,
|
40
|
+
start_date,
|
41
|
+
end_date,
|
42
|
+
period,
|
43
|
+
time_zone,
|
41
44
|
)
|
42
45
|
|
43
46
|
async def charge_history(
|
44
47
|
self,
|
45
|
-
kind: str,
|
46
48
|
start_date: str,
|
47
49
|
end_date: str,
|
48
50
|
time_zone: str,
|
@@ -50,7 +52,6 @@ class EnergySpecific:
|
|
50
52
|
"""Returns the charging history of a wall connector."""
|
51
53
|
return await self._parent.charge_history(
|
52
54
|
self.energy_site_id,
|
53
|
-
kind,
|
54
55
|
start_date,
|
55
56
|
end_date,
|
56
57
|
time_zone,
|
@@ -58,16 +59,14 @@ class EnergySpecific:
|
|
58
59
|
|
59
60
|
async def energy_history(
|
60
61
|
self,
|
61
|
-
kind: str,
|
62
62
|
start_date: str,
|
63
63
|
end_date: str,
|
64
|
-
period: str,
|
64
|
+
period: TeslaEnergyPeriod | str,
|
65
65
|
time_zone: str,
|
66
66
|
) -> dict[str, Any]:
|
67
67
|
"""Returns the energy measurements of the site, aggregated to the requested period."""
|
68
68
|
return await self._parent.energy_history(
|
69
69
|
self.energy_site_id,
|
70
|
-
kind,
|
71
70
|
start_date,
|
72
71
|
end_date,
|
73
72
|
period,
|
@@ -98,7 +98,6 @@ class TeslaFleetApi:
|
|
98
98
|
if access_token := await self.refresh_hook():
|
99
99
|
self.access_token = access_token
|
100
100
|
|
101
|
-
LOGGER.debug("Sending request to %s", path)
|
102
101
|
|
103
102
|
# Remove None values from params and json
|
104
103
|
if params:
|
@@ -119,6 +118,7 @@ class TeslaFleetApi:
|
|
119
118
|
json=json,
|
120
119
|
params=params,
|
121
120
|
) as resp:
|
121
|
+
LOGGER.debug("Requested: %s", resp.url)
|
122
122
|
LOGGER.debug("Response Status: %s", resp.status)
|
123
123
|
if "x-txid" in resp.headers:
|
124
124
|
LOGGER.debug("Response TXID: %s", resp.headers["x-txid"])
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{tesla_fleet_api-0.7.5 → tesla_fleet_api-0.7.6}/tesla_fleet_api.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|