aiopytedapi 0.1.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.
- aiopytedapi/__init__.py +71 -0
- aiopytedapi/_proto/__init__.py +1 -0
- aiopytedapi/_proto/tedapi.proto +641 -0
- aiopytedapi/_proto/tedapi_pb2.py +186 -0
- aiopytedapi/_proto/tedapi_pb2.pyi +857 -0
- aiopytedapi/_version.py +24 -0
- aiopytedapi/client.py +364 -0
- aiopytedapi/exceptions.py +76 -0
- aiopytedapi/keys.py +142 -0
- aiopytedapi/models.py +404 -0
- aiopytedapi/py.typed +0 -0
- aiopytedapi/transport.py +351 -0
- aiopytedapi-0.1.0.dist-info/METADATA +139 -0
- aiopytedapi-0.1.0.dist-info/RECORD +17 -0
- aiopytedapi-0.1.0.dist-info/WHEEL +4 -0
- aiopytedapi-0.1.0.dist-info/licenses/LICENSE +21 -0
- aiopytedapi-0.1.0.dist-info/licenses/NOTICE +32 -0
aiopytedapi/__init__.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""aiopytedapi: an async client for the Tesla Powerwall gateway's local TEDAPI.
|
|
2
|
+
|
|
3
|
+
Talks to the gateway over the signed connection (an RSA key registered with
|
|
4
|
+
the gateway) or the Gateway Wi-Fi connection (the Wi-Fi password). Uses an
|
|
5
|
+
aiohttp session the caller provides.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from .client import NOT_IMPLEMENTED, TedapiClient
|
|
11
|
+
from .exceptions import (
|
|
12
|
+
GatewayAuthError,
|
|
13
|
+
GatewayBusyError,
|
|
14
|
+
GatewayConnectionError,
|
|
15
|
+
GatewayRejectedError,
|
|
16
|
+
KeyNotAuthorizedError,
|
|
17
|
+
KeyPendingVerificationError,
|
|
18
|
+
MessageFaultError,
|
|
19
|
+
NotSupportedError,
|
|
20
|
+
SignedConnectionRequired,
|
|
21
|
+
TedapiError,
|
|
22
|
+
UnexpectedResponseError,
|
|
23
|
+
)
|
|
24
|
+
from .keys import RsaKey, fingerprint, public_key_bytes, rsa_public_key_der
|
|
25
|
+
from .models import (
|
|
26
|
+
AuthorizedClient,
|
|
27
|
+
AuthorizedClients,
|
|
28
|
+
CalibrationDelayStatus,
|
|
29
|
+
IPv4Settings,
|
|
30
|
+
NetworkInterfaceStatus,
|
|
31
|
+
NetworkStatus,
|
|
32
|
+
SiteLimits,
|
|
33
|
+
)
|
|
34
|
+
from .transport import WIFI_HOST, SignedTransport, Transport, WifiTransport
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
from ._version import __version__
|
|
38
|
+
except ImportError: # pragma: no cover - only in an unbuilt checkout
|
|
39
|
+
__version__ = "0.0.0"
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"NOT_IMPLEMENTED",
|
|
43
|
+
"WIFI_HOST",
|
|
44
|
+
"AuthorizedClient",
|
|
45
|
+
"AuthorizedClients",
|
|
46
|
+
"CalibrationDelayStatus",
|
|
47
|
+
"GatewayAuthError",
|
|
48
|
+
"GatewayBusyError",
|
|
49
|
+
"GatewayConnectionError",
|
|
50
|
+
"GatewayRejectedError",
|
|
51
|
+
"IPv4Settings",
|
|
52
|
+
"KeyNotAuthorizedError",
|
|
53
|
+
"KeyPendingVerificationError",
|
|
54
|
+
"MessageFaultError",
|
|
55
|
+
"NetworkInterfaceStatus",
|
|
56
|
+
"NetworkStatus",
|
|
57
|
+
"NotSupportedError",
|
|
58
|
+
"RsaKey",
|
|
59
|
+
"SignedConnectionRequired",
|
|
60
|
+
"SignedTransport",
|
|
61
|
+
"SiteLimits",
|
|
62
|
+
"TedapiClient",
|
|
63
|
+
"TedapiError",
|
|
64
|
+
"Transport",
|
|
65
|
+
"UnexpectedResponseError",
|
|
66
|
+
"WifiTransport",
|
|
67
|
+
"__version__",
|
|
68
|
+
"fingerprint",
|
|
69
|
+
"public_key_bytes",
|
|
70
|
+
"rsa_public_key_der",
|
|
71
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Generated protobuf bindings (see tools/gen_proto.sh)."""
|
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
// aiopytedapi - Tesla TEDAPI wire schema
|
|
2
|
+
//
|
|
3
|
+
// Derived from pypowerwall's tedapi_combined.proto (MIT, Copyright (c) Jason A.
|
|
4
|
+
// Cox and contributors; see NOTICE), including the networking status,
|
|
5
|
+
// authorized clients and battery calibration delay messages contributed there.
|
|
6
|
+
//
|
|
7
|
+
// Credits carried over from pypowerwall:
|
|
8
|
+
// - @Matthew1471's Tesla-API repository (signing protocol)
|
|
9
|
+
// - @Nexarian's TEDAPI protocol updates (Feb 12, 2026)
|
|
10
|
+
// - Teslemetry/tesla-protocol for documenting the energy device schema:
|
|
11
|
+
// https://github.com/Teslemetry/tesla-protocol
|
|
12
|
+
//
|
|
13
|
+
// The package and file path are this library's own, so its descriptors never
|
|
14
|
+
// collide with pypowerwall's (or any other copy of Tesla's protos) in the same
|
|
15
|
+
// process, e.g. inside Home Assistant.
|
|
16
|
+
//
|
|
17
|
+
// Regenerate the Python bindings with: bash tools/gen_proto.sh
|
|
18
|
+
// Never edit tedapi_pb2.py / tedapi_pb2.pyi by hand.
|
|
19
|
+
|
|
20
|
+
syntax = "proto3";
|
|
21
|
+
|
|
22
|
+
package aiopytedapi.tedapi;
|
|
23
|
+
|
|
24
|
+
import "google/protobuf/timestamp.proto";
|
|
25
|
+
import "google/protobuf/wrappers.proto";
|
|
26
|
+
|
|
27
|
+
// ===================================================================
|
|
28
|
+
// PART 1: Signed Message Protocol
|
|
29
|
+
// (originally from tesla.proto.universal_message.v1)
|
|
30
|
+
// ===================================================================
|
|
31
|
+
|
|
32
|
+
enum Domain {
|
|
33
|
+
DOMAIN_BROADCAST = 0;
|
|
34
|
+
DOMAIN_VEHICLE_SECURITY = 2;
|
|
35
|
+
DOMAIN_INFOTAINMENT = 3;
|
|
36
|
+
DOMAIN_AUTHD = 5;
|
|
37
|
+
DOMAIN_ENERGY_DEVICE = 7;
|
|
38
|
+
DOMAIN_ENERGY_DEVICE_AUTH = 8;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
message Destination {
|
|
42
|
+
oneof sub_destination{
|
|
43
|
+
Domain domain = 1;
|
|
44
|
+
bytes routing_address = 2;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
enum Flags {
|
|
49
|
+
FLAGS_NONE = 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
enum MessageFault_E {
|
|
53
|
+
MESSAGEFAULT_ERROR_NONE = 0;
|
|
54
|
+
MESSAGEFAULT_ERROR_BUSY = 1;
|
|
55
|
+
MESSAGEFAULT_ERROR_TIMEOUT = 2;
|
|
56
|
+
MESSAGEFAULT_ERROR_UNKNOWN_KEY_ID = 3;
|
|
57
|
+
MESSAGEFAULT_ERROR_INACTIVE_KEY = 4;
|
|
58
|
+
MESSAGEFAULT_ERROR_INVALID_SIGNATURE = 5;
|
|
59
|
+
MESSAGEFAULT_ERROR_INVALID_TOKEN_OR_COUNTER = 6;
|
|
60
|
+
MESSAGEFAULT_ERROR_INSUFFICIENT_PRIVILEGES = 7;
|
|
61
|
+
MESSAGEFAULT_ERROR_INVALID_DOMAINS = 8;
|
|
62
|
+
MESSAGEFAULT_ERROR_INVALID_COMMAND = 9;
|
|
63
|
+
MESSAGEFAULT_ERROR_DECODING = 10;
|
|
64
|
+
MESSAGEFAULT_ERROR_INTERNAL = 11;
|
|
65
|
+
MESSAGEFAULT_ERROR_WRONG_PERSONALIZATION = 12;
|
|
66
|
+
MESSAGEFAULT_ERROR_BAD_PARAMETER = 13;
|
|
67
|
+
MESSAGEFAULT_ERROR_KEYCHAIN_IS_FULL = 14;
|
|
68
|
+
MESSAGEFAULT_ERROR_INCORRECT_EPOCH = 15;
|
|
69
|
+
MESSAGEFAULT_ERROR_IV_INCORRECT_LENGTH = 16;
|
|
70
|
+
MESSAGEFAULT_ERROR_TIME_EXPIRED = 17;
|
|
71
|
+
MESSAGEFAULT_ERROR_NOT_PROVISIONED_WITH_IDENTITY = 18;
|
|
72
|
+
MESSAGEFAULT_ERROR_COULD_NOT_HASH_METADATA = 19;
|
|
73
|
+
MESSAGEFAULT_ERROR_TIME_TO_LIVE_TOO_LONG = 20;
|
|
74
|
+
MESSAGEFAULT_ERROR_REMOTE_ACCESS_DISABLED = 21;
|
|
75
|
+
MESSAGEFAULT_ERROR_REMOTE_SERVICE_REQUEST_NOT_SUPPORTED = 22;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message MessageStatus {
|
|
79
|
+
MessageFault_E message_fault = 1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
message KeyIdentity {
|
|
83
|
+
oneof identity_type {
|
|
84
|
+
bytes public_key = 1;
|
|
85
|
+
uint32 handle = 3;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
message RsaSignatureData {
|
|
90
|
+
fixed32 expires_at = 1;
|
|
91
|
+
bytes signature = 2;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
message SignatureData {
|
|
95
|
+
KeyIdentity signer_identity = 1;
|
|
96
|
+
|
|
97
|
+
oneof sig_type {
|
|
98
|
+
RsaSignatureData rsa_data = 7;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
enum SignatureType {
|
|
103
|
+
SIGNATURE_TYPE_AES_GCM = 0;
|
|
104
|
+
SIGNATURE_TYPE_ECDSA = 1;
|
|
105
|
+
SIGNATURE_TYPE_PRESENT_KEY = 2;
|
|
106
|
+
SIGNATURE_TYPE_AES_GCM_TOKEN = 3;
|
|
107
|
+
SIGNATURE_TYPE_ECDSA_PERSONALIZED = 4;
|
|
108
|
+
SIGNATURE_TYPE_AES_GCM_PERSONALIZED = 5;
|
|
109
|
+
SIGNATURE_TYPE_HMAC = 6;
|
|
110
|
+
SIGNATURE_TYPE_RSA = 7;
|
|
111
|
+
SIGNATURE_TYPE_HMAC_PERSONALIZED = 8;
|
|
112
|
+
SIGNATURE_TYPE_AES_GCM_RESPONSE = 9;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
enum Tag {
|
|
116
|
+
TAG_SIGNATURE_TYPE = 0;
|
|
117
|
+
TAG_DOMAIN = 1;
|
|
118
|
+
TAG_PERSONALIZATION = 2;
|
|
119
|
+
TAG_EPOCH = 3;
|
|
120
|
+
TAG_EXPIRES_AT = 4;
|
|
121
|
+
TAG_COUNTER = 5;
|
|
122
|
+
TAG_CHALLENGE = 6;
|
|
123
|
+
TAG_FLAGS = 7;
|
|
124
|
+
TAG_REQUEST_HASH = 8;
|
|
125
|
+
TAG_FAULT = 9;
|
|
126
|
+
TAG_END = 255;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
message RoutableMessage {
|
|
130
|
+
Destination to_destination = 6;
|
|
131
|
+
Destination from_destination = 7;
|
|
132
|
+
|
|
133
|
+
oneof payload {
|
|
134
|
+
bytes protobuf_message_as_bytes = 10;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
SignatureData signature_data = 13;
|
|
138
|
+
|
|
139
|
+
MessageStatus signed_message_status = 12;
|
|
140
|
+
bytes request_uuid = 50;
|
|
141
|
+
bytes uuid = 51;
|
|
142
|
+
Flags flags = 52;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ===================================================================
|
|
146
|
+
// PART 2: TEDAPI Message Protocol
|
|
147
|
+
// (originally from tedapi_nexarian package)
|
|
148
|
+
// ===================================================================
|
|
149
|
+
|
|
150
|
+
message AuthEnvelope {
|
|
151
|
+
bytes payload = 1;
|
|
152
|
+
oneof auth {
|
|
153
|
+
ExternalAuth externalAuth = 2;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
message ExternalAuth {
|
|
158
|
+
ExternalAuthType type = 1;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
enum ExternalAuthType {
|
|
162
|
+
EXTERNAL_AUTH_TYPE_INVALID = 0;
|
|
163
|
+
EXTERNAL_AUTH_TYPE_PRESENCE = 1;
|
|
164
|
+
EXTERNAL_AUTH_TYPE_MTLS = 2;
|
|
165
|
+
EXTERNAL_AUTH_TYPE_HERMES_COMMAND = 4;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
enum DeliveryChannel {
|
|
169
|
+
DELIVERY_CHANNEL_INVALID = 0;
|
|
170
|
+
DELIVERY_CHANNEL_LOCAL_HTTPS = 1;
|
|
171
|
+
DELIVERY_CHANNEL_HERMES_COMMAND = 2;
|
|
172
|
+
DELIVERY_CHANNEL_BLE = 3;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
enum LocalParticipant {
|
|
176
|
+
LOCAL_PARTICIPANT_INVALID = 0;
|
|
177
|
+
LOCAL_PARTICIPANT_INSTALLER = 1;
|
|
178
|
+
LOCAL_PARTICIPANT_CUSTOMER = 2;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
enum TeslaService {
|
|
182
|
+
TESLA_SERVICE_INVALID = 0;
|
|
183
|
+
TESLA_SERVICE_COMMAND = 1;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
enum AuthorizedClientType {
|
|
187
|
+
AUTHORIZED_CLIENT_TYPE_INVALID = 0;
|
|
188
|
+
AUTHORIZED_CLIENT_TYPE_CUSTOMER_MOBILE_APP = 1;
|
|
189
|
+
AUTHORIZED_CLIENT_TYPE_VEHICLE = 2;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
message Message {
|
|
193
|
+
MessageEnvelope message = 1;
|
|
194
|
+
Tail tail = 2;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
message MessageEnvelope {
|
|
198
|
+
DeliveryChannel deliveryChannel = 1;
|
|
199
|
+
Participant sender = 2;
|
|
200
|
+
Participant recipient = 3;
|
|
201
|
+
|
|
202
|
+
oneof payload {
|
|
203
|
+
CommonMessages common = 4;
|
|
204
|
+
TEGMessages teg = 5;
|
|
205
|
+
WCMessages wc = 6;
|
|
206
|
+
NeurioMeterMessages neuriometer = 9;
|
|
207
|
+
EnergySiteNetMessages energysitenet = 10;
|
|
208
|
+
AuthorizationMessages authorization = 12;
|
|
209
|
+
FileStoreMessages filestore = 15;
|
|
210
|
+
GraphQLMessages graphql = 16;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
message Participant {
|
|
215
|
+
oneof id {
|
|
216
|
+
string din = 1;
|
|
217
|
+
int32 teslaService = 2;
|
|
218
|
+
int32 local = 3;
|
|
219
|
+
int32 authorizedClient = 4;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
message Tail {
|
|
224
|
+
int32 value = 1;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
message CommonMessages {
|
|
228
|
+
// Tesla's schema models these as one oneof (tesla-protocol common_api.proto);
|
|
229
|
+
// only the members aiopytedapi uses are listed.
|
|
230
|
+
oneof message {
|
|
231
|
+
// common.error_response (field 1), per tesla-protocol common.proto.
|
|
232
|
+
CommonAPIErrorResponse error_response = 1;
|
|
233
|
+
// Networking status (read-only). See "Networking status" below.
|
|
234
|
+
CommonAPIGetNetworkingStatusRequest get_networking_status_request = 22;
|
|
235
|
+
CommonAPIGetNetworkingStatusResponse get_networking_status_response = 23;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
message CommonAPIErrorResponse {
|
|
240
|
+
// google.rpc.Status wire fields; details (field 3) are not needed here.
|
|
241
|
+
CommandStatus status = 1;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
message CommandStatus {
|
|
245
|
+
int32 code = 1;
|
|
246
|
+
string message = 2;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// -------------------------------------------------------------------
|
|
250
|
+
// Networking status (CommonMessages fields 22/23) -- read-only.
|
|
251
|
+
//
|
|
252
|
+
// Reports, per gateway interface (Wi-Fi, Ethernet, cellular), whether it is
|
|
253
|
+
// enabled, whether it carries the active route, link / internet / Tesla
|
|
254
|
+
// connectivity and signal strength.
|
|
255
|
+
//
|
|
256
|
+
// Provenance: field numbers, names and enums are from Teslemetry/tesla-protocol
|
|
257
|
+
// (common_api.proto / networking.proto); the same messages appear in camelCase
|
|
258
|
+
// in the generated V2026_06 set. They are added here, in the legacy file, so the
|
|
259
|
+
// request works on the default V2024_06 path with the protobuf>=4.25.1 floor.
|
|
260
|
+
//
|
|
261
|
+
// Hardware validation: Powerwall 3, firmware 26.34.3, 2026-11-14, over both the
|
|
262
|
+
// signed v1r LAN transport and Gateway Wi-Fi basic auth -- the gateway answered
|
|
263
|
+
// with all three interfaces populated -- and Powerwall 2, firmware 26.42.0,
|
|
264
|
+
// over Gateway Wi-Fi basic auth. The request is sent with deliveryChannel
|
|
265
|
+
// LOCAL_HTTPS, sender.local INSTALLER on every transport. Over signed v1r the
|
|
266
|
+
// Powerwall 3 answers that envelope and also deliveryChannel HERMES_COMMAND,
|
|
267
|
+
// sender.authorizedClient (2026-11-15); the Powerwall 2 answers neither
|
|
268
|
+
// (MESSAGEFAULT_ERROR_TIMEOUT), so on a Powerwall 2 the request needs Gateway
|
|
269
|
+
// Wi-Fi. Not validated on the bearer transport or on Powerwall+. Firmware that
|
|
270
|
+
// does not implement the request answers common.error_response instead.
|
|
271
|
+
// -------------------------------------------------------------------
|
|
272
|
+
|
|
273
|
+
enum WifiNetworkSecurityType {
|
|
274
|
+
WIFI_NETWORK_SECURITY_TYPE_INVALID = 0;
|
|
275
|
+
WIFI_NETWORK_SECURITY_TYPE_NONE = 1;
|
|
276
|
+
WIFI_NETWORK_SECURITY_TYPE_DYNAMIC_WEP = 2;
|
|
277
|
+
WIFI_NETWORK_SECURITY_TYPE_WPA2_PERSONAL = 3;
|
|
278
|
+
WIFI_NETWORK_SECURITY_TYPE_WPA2_ENTERPRISE = 4;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
enum NetworkDeviceState {
|
|
282
|
+
NETWORK_DEVICE_STATE_INVALID = 0;
|
|
283
|
+
NETWORK_DEVICE_STATE_UNMANAGED = 1;
|
|
284
|
+
NETWORK_DEVICE_STATE_UNAVAILABLE = 2;
|
|
285
|
+
NETWORK_DEVICE_STATE_IDLE = 3;
|
|
286
|
+
NETWORK_DEVICE_STATE_ASSOCIATION = 4;
|
|
287
|
+
NETWORK_DEVICE_STATE_CONFIGURATION = 5;
|
|
288
|
+
NETWORK_DEVICE_STATE_READY = 6;
|
|
289
|
+
NETWORK_DEVICE_STATE_DISCONNECT = 7;
|
|
290
|
+
NETWORK_DEVICE_STATE_FAILURE = 8;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
enum NetworkDeviceStateReason {
|
|
294
|
+
NETWORK_DEVICE_STATE_REASON_INVALID = 0;
|
|
295
|
+
NETWORK_DEVICE_STATE_REASON_NONE = 1;
|
|
296
|
+
NETWORK_DEVICE_STATE_REASON_CONFIG_FAILED = 2;
|
|
297
|
+
NETWORK_DEVICE_STATE_REASON_DHCP_FAILED = 3;
|
|
298
|
+
NETWORK_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE = 4;
|
|
299
|
+
NETWORK_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED = 5;
|
|
300
|
+
NETWORK_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE = 6;
|
|
301
|
+
NETWORK_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED = 7;
|
|
302
|
+
NETWORK_DEVICE_STATE_REASON_NEW_ACTIVATION = 8;
|
|
303
|
+
NETWORK_DEVICE_STATE_REASON_NO_SECRETS = 9;
|
|
304
|
+
NETWORK_DEVICE_STATE_REASON_PPP_FAILED = 10;
|
|
305
|
+
NETWORK_DEVICE_STATE_REASON_SSID_NOT_FOUND = 11;
|
|
306
|
+
NETWORK_DEVICE_STATE_REASON_SIM_PIN_INCORRECT = 12;
|
|
307
|
+
NETWORK_DEVICE_STATE_REASON_SUPPLICANT_FAILED = 13;
|
|
308
|
+
NETWORK_DEVICE_STATE_REASON_REMOVED = 14;
|
|
309
|
+
NETWORK_DEVICE_STATE_REASON_MODEM_FAILED = 15;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
message CommonAPIGetNetworkingStatusRequest {}
|
|
313
|
+
|
|
314
|
+
message CommonAPIGetNetworkingStatusResponse {
|
|
315
|
+
WifiConfig wifi_config = 1;
|
|
316
|
+
NetworkInterface wifi = 2;
|
|
317
|
+
NetworkInterface eth = 3;
|
|
318
|
+
NetworkInterface gsm = 4;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
message WifiConfig {
|
|
322
|
+
string ssid = 1;
|
|
323
|
+
// Field 2 is the Wi-Fi password (WifiPassword) in Tesla's schema. It is
|
|
324
|
+
// deliberately NOT modelled: reserving it keeps the secret an opaque unknown
|
|
325
|
+
// field, so aiopytedapi can never parse, log or return it.
|
|
326
|
+
reserved 2;
|
|
327
|
+
WifiNetworkSecurityType security_type = 3;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
message NetworkInterface {
|
|
331
|
+
bytes mac_address = 1;
|
|
332
|
+
bool enabled = 2;
|
|
333
|
+
bool active_route = 3;
|
|
334
|
+
NetworkInterfaceIPv4Config ipv4_config = 4;
|
|
335
|
+
NetworkConnectivityStatus connectivity_status = 5;
|
|
336
|
+
NetworkDeviceState device_state = 6;
|
|
337
|
+
NetworkDeviceStateReason device_state_reason = 7;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
message NetworkInterfaceIPv4Config {
|
|
341
|
+
reserved 1;
|
|
342
|
+
bool dhcp_enabled = 2;
|
|
343
|
+
// IPv4 values are fixed32 in host order: 192.168.1.2 == 0xC0A80102.
|
|
344
|
+
fixed32 address = 3;
|
|
345
|
+
fixed32 subnet_mask = 4;
|
|
346
|
+
fixed32 gateway = 5;
|
|
347
|
+
repeated fixed32 dns = 6;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
message NetworkConnectivityStatus {
|
|
351
|
+
bool connected_physical = 1;
|
|
352
|
+
bool connected_internet = 2;
|
|
353
|
+
bool connected_tesla = 3;
|
|
354
|
+
Rssi rssi = 4;
|
|
355
|
+
google.protobuf.Int32Value snr = 5;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
message Rssi {
|
|
359
|
+
sint32 value = 1;
|
|
360
|
+
google.protobuf.UInt32Value signal_strength_percent = 2;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
message ControlEventSchedulingInfo {
|
|
364
|
+
google.protobuf.Timestamp start_time = 1;
|
|
365
|
+
uint32 duration_seconds = 2;
|
|
366
|
+
uint64 priority = 3;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Intentional islanding (open/close the grid contactor). These are legacy
|
|
370
|
+
// TEG fields (3/4) from Tesla's older TEG schema — the field numbers and
|
|
371
|
+
// types are hardware-validated on PW3 (see PR #379): mode 6 + force=true
|
|
372
|
+
// opens the contactor (off-grid), mode 1 closes it (reconnect). result=1
|
|
373
|
+
// was the observed success value; other values are undocumented.
|
|
374
|
+
message TEGAPISetIslandModeRequest {
|
|
375
|
+
int32 mode = 1;
|
|
376
|
+
bool force = 2;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
message TEGAPISetIslandModeResponse {
|
|
380
|
+
int32 result = 1;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Timed battery dispatch schema documented by Teslemetry/tesla-protocol:
|
|
384
|
+
// https://github.com/Teslemetry/tesla-protocol/blob/main/proto/energy_device/teg_api.proto
|
|
385
|
+
// TEG fields 37/38.
|
|
386
|
+
// These are independent fields, NOT a oneof. Send exactly one per request.
|
|
387
|
+
message TEGAPIDispatchBatteryPowerRequest {
|
|
388
|
+
message ResumeDeviceOperatingMode {}
|
|
389
|
+
message RealPowerCommand {
|
|
390
|
+
double power_watts = 1;
|
|
391
|
+
uint32 duration_seconds = 2;
|
|
392
|
+
}
|
|
393
|
+
ResumeDeviceOperatingMode resume_device_mode = 1;
|
|
394
|
+
RealPowerCommand real_power = 2;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
message TEGAPIDispatchBatteryPowerResponse {}
|
|
398
|
+
|
|
399
|
+
message TEGAPIScheduleManualBackupEventRequest {
|
|
400
|
+
ControlEventSchedulingInfo scheduling_info = 1;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
message TEGAPIScheduleManualBackupEventResponse {}
|
|
404
|
+
|
|
405
|
+
message TEGAPICancelManualBackupEventRequest {}
|
|
406
|
+
|
|
407
|
+
message TEGAPICancelManualBackupEventResponse {}
|
|
408
|
+
|
|
409
|
+
message TEGAPIGetBackupEventsRequest {}
|
|
410
|
+
|
|
411
|
+
message TEGAPIGetBackupEventsResponse {
|
|
412
|
+
ManualBackupEvent manual_backup_event = 1;
|
|
413
|
+
repeated BackupEvent backup_events = 2;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
message ManualBackupEvent {
|
|
417
|
+
ControlEventSchedulingInfo scheduling_info = 1;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
message BackupEvent {
|
|
421
|
+
string id = 1;
|
|
422
|
+
string name = 2;
|
|
423
|
+
ControlEventSchedulingInfo scheduling_info = 3;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Battery calibration delay: postpone the gateway's next battery calibration
|
|
427
|
+
// and read how many delays are left. Schema documented by
|
|
428
|
+
// Teslemetry/tesla-protocol:
|
|
429
|
+
// https://github.com/Teslemetry/tesla-protocol/blob/main/proto/energy_device/teg_api.proto
|
|
430
|
+
// TEG fields 75-78. There is no local command that starts a calibration.
|
|
431
|
+
//
|
|
432
|
+
// Powerwall 3, firmware 26.34.3 (2026-11-16, signed v1r): the status request
|
|
433
|
+
// (77) is answered with common.error_response code 12 ("not implemented").
|
|
434
|
+
// The delay request (75) has not been sent to hardware by pypowerwall.
|
|
435
|
+
message TEGAPIDelayBatteryCalibrationRequest {
|
|
436
|
+
uint32 delay_hours = 1;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
message TEGAPIDelayBatteryCalibrationResponse {}
|
|
440
|
+
|
|
441
|
+
message TEGAPIGetDelayBatteryCalibrationStatusRequest {}
|
|
442
|
+
|
|
443
|
+
message TEGAPIGetDelayBatteryCalibrationStatusResponse {
|
|
444
|
+
uint32 calibration_delays_left = 1;
|
|
445
|
+
uint32 calibration_delay_remaining_seconds = 2;
|
|
446
|
+
uint32 max_calibration_delays = 3;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
message TEGMessages {
|
|
450
|
+
oneof message {
|
|
451
|
+
TEGAPISetIslandModeRequest setIslandModeRequest = 3;
|
|
452
|
+
TEGAPISetIslandModeResponse setIslandModeResponse = 4;
|
|
453
|
+
TEGAPIDispatchBatteryPowerRequest dispatch_battery_power_request = 37;
|
|
454
|
+
TEGAPIDispatchBatteryPowerResponse dispatch_battery_power_response = 38;
|
|
455
|
+
TEGAPIScheduleManualBackupEventRequest schedule_manual_backup_event_request = 45;
|
|
456
|
+
TEGAPIScheduleManualBackupEventResponse schedule_manual_backup_event_response = 46;
|
|
457
|
+
TEGAPICancelManualBackupEventRequest cancel_manual_backup_event_request = 47;
|
|
458
|
+
TEGAPICancelManualBackupEventResponse cancel_manual_backup_event_response = 48;
|
|
459
|
+
TEGAPIGetBackupEventsRequest get_backup_events_request = 49;
|
|
460
|
+
TEGAPIGetBackupEventsResponse get_backup_events_response = 50;
|
|
461
|
+
TEGAPIDelayBatteryCalibrationRequest delay_battery_calibration_request = 75;
|
|
462
|
+
TEGAPIDelayBatteryCalibrationResponse delay_battery_calibration_response = 76;
|
|
463
|
+
TEGAPIGetDelayBatteryCalibrationStatusRequest get_delay_battery_calibration_status_request = 77;
|
|
464
|
+
TEGAPIGetDelayBatteryCalibrationStatusResponse get_delay_battery_calibration_status_response = 78;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
message WCMessages {
|
|
469
|
+
bytes placeholder = 1;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
message NeurioMeterMessages {
|
|
473
|
+
bytes placeholder = 1;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
message EnergySiteNetMessages {
|
|
477
|
+
bytes placeholder = 1;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Authorized clients (the gateway's paired keys). Message and field numbers
|
|
481
|
+
// from Tesla's energy_device.v1 AuthorizationAPI (tesla-protocol; the same
|
|
482
|
+
// numbers as V2026_06 tedapi_v2_energy_device.proto).
|
|
483
|
+
//
|
|
484
|
+
// Validated on Powerwall 3, firmware 26.34.3 (2026-11-14):
|
|
485
|
+
// * list_authorized_clients_request answers over signed v1r and over Gateway
|
|
486
|
+
// Wi-Fi basic auth (LOCAL_HTTPS envelope, sender local INSTALLER; sender
|
|
487
|
+
// CUSTOMER is rejected with "unexpected MessageEnvelope.Sender").
|
|
488
|
+
// * add_authorized_client_request over Gateway Wi-Fi basic auth (firmware
|
|
489
|
+
// 26.34.1, 2026-10-29) is accepted and the key enters
|
|
490
|
+
// PENDING_VERIFICATION, but a key added that way never verified: toggling
|
|
491
|
+
// the Powerwall On/Off switch inside the window did not verify it and it
|
|
492
|
+
// timed out (verification type HERMES_COMMAND).
|
|
493
|
+
// * add / remove over signed v1r (HERMES_COMMAND envelope, sender
|
|
494
|
+
// authorizedClient, as the TEG writes), signed by a VERIFIED key, work
|
|
495
|
+
// (firmware 26.34.3, 2026-11-14): the added key is listed as
|
|
496
|
+
// PENDING_VERIFICATION with verification HERMES_COMMAND and no
|
|
497
|
+
// authorized_by_public_key (the signing key does not vouch for it), and a
|
|
498
|
+
// removed key disappears from the list (no REMOVED record is kept).
|
|
499
|
+
// Keys are DER; RSA keys are PKCS#1 (the encoding v1r_register.py registers
|
|
500
|
+
// and the gateway lists back).
|
|
501
|
+
message AuthorizationMessages {
|
|
502
|
+
oneof message {
|
|
503
|
+
AuthorizationAPIAddAuthorizedClientRequest add_authorized_client_request = 1;
|
|
504
|
+
AuthorizationAPIAddAuthorizedClientResponse add_authorized_client_response = 2;
|
|
505
|
+
AuthorizationAPIRemoveAuthorizedClientRequest remove_authorized_client_request = 3;
|
|
506
|
+
AuthorizationAPIRemoveAuthorizedClientResponse remove_authorized_client_response = 4;
|
|
507
|
+
AuthorizationAPIListAuthorizedClientsRequest list_authorized_clients_request = 5;
|
|
508
|
+
AuthorizationAPIListAuthorizedClientsResponse list_authorized_clients_response = 6;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
enum AuthorizedKeyType {
|
|
513
|
+
AUTHORIZED_KEY_TYPE_INVALID = 0;
|
|
514
|
+
AUTHORIZED_KEY_TYPE_RSA = 1;
|
|
515
|
+
AUTHORIZED_KEY_TYPE_ECC = 2;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
enum AuthorizationRole {
|
|
519
|
+
AUTHORIZATION_ROLE_INVALID = 0;
|
|
520
|
+
AUTHORIZATION_ROLE_CUSTOMER = 1;
|
|
521
|
+
AUTHORIZATION_ROLE_VEHICLE = 2;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
enum AuthorizedState {
|
|
525
|
+
AUTHORIZED_STATE_INVALID = 0;
|
|
526
|
+
AUTHORIZED_STATE_PENDING_VERIFICATION = 1;
|
|
527
|
+
AUTHORIZED_STATE_PENDING_VERIFICATION_TIMEOUT = 2;
|
|
528
|
+
AUTHORIZED_STATE_VERIFIED = 3;
|
|
529
|
+
AUTHORIZED_STATE_REMOVED = 4;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
enum AuthorizedVerificationType {
|
|
533
|
+
AUTHORIZED_VERIFICATION_TYPE_INVALID = 0;
|
|
534
|
+
AUTHORIZED_VERIFICATION_TYPE_PRESENCE_PROOF = 1;
|
|
535
|
+
AUTHORIZED_VERIFICATION_TYPE_BLE = 2;
|
|
536
|
+
AUTHORIZED_VERIFICATION_TYPE_SIGNED = 3;
|
|
537
|
+
AUTHORIZED_VERIFICATION_TYPE_HERMES_COMMAND = 4;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
message AuthorizationRecord {
|
|
541
|
+
AuthorizedClientType type = 1;
|
|
542
|
+
string description = 2;
|
|
543
|
+
AuthorizedKeyType key_type = 3;
|
|
544
|
+
bytes public_key = 4;
|
|
545
|
+
repeated AuthorizationRole roles = 5;
|
|
546
|
+
AuthorizedState state = 6;
|
|
547
|
+
AuthorizedVerificationType verification = 7;
|
|
548
|
+
google.protobuf.Timestamp added_time = 8;
|
|
549
|
+
string identifier = 9;
|
|
550
|
+
bytes authorized_by_public_key = 10;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
message AuthorizationAPIAddAuthorizedClientRequest {
|
|
554
|
+
AuthorizedClientType type = 1;
|
|
555
|
+
string description = 2;
|
|
556
|
+
AuthorizedKeyType key_type = 3;
|
|
557
|
+
bytes public_key = 4;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
message AuthorizationAPIAddAuthorizedClientResponse {
|
|
561
|
+
AuthorizationRecord client = 1;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
message AuthorizationAPIRemoveAuthorizedClientRequest {
|
|
565
|
+
bytes public_key = 1;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
message AuthorizationAPIRemoveAuthorizedClientResponse {
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
message AuthorizationAPIListAuthorizedClientsRequest {
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
message AuthorizationAPIListAuthorizedClientsResponse {
|
|
575
|
+
repeated AuthorizationRecord clients = 1;
|
|
576
|
+
bool enable_line_switch_off = 2;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
message GraphQLMessages {
|
|
580
|
+
bytes placeholder = 1;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
message FileStoreMessages {
|
|
584
|
+
oneof message {
|
|
585
|
+
FileStoreAPIReadFileRequest readFileRequest = 1;
|
|
586
|
+
FileStoreAPIReadFileResponse readFileResponse = 2;
|
|
587
|
+
FileStoreAPIForceWriteFileRequest forceWriteFileRequest = 3;
|
|
588
|
+
FileStoreAPIForceWriteFileResponse forceWriteFileResponse = 4;
|
|
589
|
+
FileStoreAPIUpdateFileRequest updateFileRequest = 5;
|
|
590
|
+
FileStoreAPIUpdateFileResponse updateFileResponse = 6;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
enum FileStoreAPIDomain {
|
|
595
|
+
FILE_STORE_API_DOMAIN_INVALID = 0;
|
|
596
|
+
FILE_STORE_API_DOMAIN_CONFIG_JSON = 1;
|
|
597
|
+
FILE_STORE_API_DOMAIN_GRID_CODE_REGIONS_CSV = 2;
|
|
598
|
+
FILE_STORE_API_DOMAIN_CERTIFIED_INSTALLERS_CSV = 3;
|
|
599
|
+
FILE_STORE_API_DOMAIN_SUPERCHARGER_FILES = 4;
|
|
600
|
+
FILE_STORE_API_DOMAIN_OPTICASTER_FILES = 5;
|
|
601
|
+
FILE_STORE_API_DOMAIN_WALLBOX_CONFIG = 6;
|
|
602
|
+
FILE_STORE_API_DOMAIN_OCPP_CSMS_ROOT_CA = 7;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
message FileStoreAPIFile {
|
|
606
|
+
string name = 1;
|
|
607
|
+
oneof content {
|
|
608
|
+
bytes blob = 100;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
message FileStoreAPIReadFileRequest {
|
|
613
|
+
FileStoreAPIDomain domain = 1;
|
|
614
|
+
string name = 2;
|
|
615
|
+
bytes ifDifferentHash = 3;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
message FileStoreAPIReadFileResponse {
|
|
619
|
+
FileStoreAPIFile file = 1;
|
|
620
|
+
bytes hash = 2;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
message FileStoreAPIUpdateFileRequest {
|
|
624
|
+
FileStoreAPIDomain domain = 1;
|
|
625
|
+
FileStoreAPIFile file = 2;
|
|
626
|
+
bytes hash = 3;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
message FileStoreAPIUpdateFileResponse {
|
|
630
|
+
FileStoreAPIFile file = 1;
|
|
631
|
+
bytes hash = 2;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
message FileStoreAPIForceWriteFileRequest {
|
|
635
|
+
FileStoreAPIDomain domain = 1;
|
|
636
|
+
FileStoreAPIFile file = 2;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
message FileStoreAPIForceWriteFileResponse {
|
|
640
|
+
bytes hash = 1;
|
|
641
|
+
}
|