-
Notifications
You must be signed in to change notification settings - Fork 5
/
tesla.proto
527 lines (426 loc) · 13.2 KB
/
tesla.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
// Tesla Protocol Buffer definition (tesla.proto)
//
// Create tesla.pb.go for use in Go programs using the protoc compiler:
//
// protoc --proto_path=.. --go_out=. --go_opt=paths=source_relative tesla.proto
//
// Credit and thanks to @brianhealey and @jasonacox for providing the
// python version of this file in github.com/jasonacox/pypowerwall.
syntax = "proto3";
package teslapower;
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/bmah888/gotesla/teslapowerpb";
message ExternalAuth {
ExternalAuthType type = 1;
}
enum ExternalAuthType {
EXTERNAL_AUTH_TYPE_INVALID = 0;
EXTERNAL_AUTH_TYPE_PRESENCE = 1;
EXTERNAL_AUTH_TYPE_MTLS = 2;
EXTERNAL_AUTH_TYPE_HERMES_COMMAND = 4;
}
enum DeliveryChannel {
DELIVERY_CHANNEL_INVALID = 0;
DELIVERY_CHANNEL_LOCAL_HTTPS = 1;
DELIVERY_CHANNEL_HERMES_COMMAND = 2;
DELIVERY_CHANNEL_BLE = 3;
}
enum TeslaService {
TESLA_SERVICE_INVALID = 0;
TESLA_SERVICE_COMMAND = 1;
}
message Participant {
oneof id {
string din = 1;
int32 teslaService = 2;
int32 local = 3;
int32 authorizedClient = 4;
}
}
message EcuId {
string partNumber = 1;
string serialNumber = 2;
}
message Din {
string value = 1;
}
message FirmwareVersion {
string version = 1;
string githash = 2;
}
message AccumulatedEnergy {
float energyWh = 1;
int32 accumulationType = 2;
optional UInt64Value periodS = 3;
}
message InstACMeasurement {
float voltageVrms = 1;
float frequencyHz = 2;
optional FloatValue currentArms = 3;
optional FloatValue realPowerW = 4;
optional FloatValue reactivePowerVar = 5;
optional FloatValue apparentPowerVa = 6;
}
message InstDCMeasurement {
float voltageV = 1;
optional FloatValue currentA = 2;
}
message GridComplianceStatus {
int32 gridState = 1;
optional UInt32Value qualifyingTimeRemainingS = 2;
}
message NetworkInterfaceIPv4Config {
reserved 1;
bool dhcpEnabled = 2;
fixed32 address = 3;
fixed32 subnetMask = 4;
fixed32 gateway = 5;
repeated fixed32 dns = 6;
}
message Rssi {
sint32 value = 1;
optional UInt32Value signalStrengthPercent = 2;
}
message NetworkConnectivityStatus {
bool connectedPhysical = 1;
bool connectedInternet = 2;
bool connectedTesla = 3;
optional Rssi rssi = 4;
optional Int32Value snr = 5;
}
message NetworkInterface {
bytes macAddress = 1;
bool enabled = 2;
bool activeRoute = 3;
optional NetworkInterfaceIPv4Config ipv4Config = 4;
optional NetworkConnectivityStatus connectivityStatus = 5;
}
message WifiPassword {
string value = 1;
}
message EncryptedMessage {
int32 cipher = 1;
bytes ciphertext = 2;
}
message WifiConfig {
string ssid = 1;
optional string password = 2;
optional int32 securityType = 3;
}
message WifiNetwork {
string ssid = 1;
sint32 rssiValue = 2;
optional Rssi rssi = 3;
optional int32 securityType = 4;
}
message SystemUpdate {
int32 handshakeResult = 1;
int32 updateStatus = 2;
optional FirmwareVersion serverStagedVersion = 3;
uint64 totalBytes = 4;
uint64 bytesOffset = 5;
uint64 estimatedBytesPerSecond = 6;
uint64 lastHandshakeTimestamp = 7;
uint32 lastUpdateResult = 8;
}
message ErrorResponse {
optional Status status = 1;
}
message CommonAPIGetSystemInfoRequest {
}
message CommonAPIGetSystemInfoResponse {
optional EcuId deviceId = 1;
string din = 2;
optional FirmwareVersion firmwareVersion = 3;
reserved 4;
optional SystemUpdate systemUpdate = 5;
}
message CommonAPISetLocalSiteConfigRequest {}
message CommonAPISetLocalSiteConfigResponse {}
message CommonAPICheckForUpdateRequest {}
message CommonAPICheckForUpdateResponse {}
message CommonAPIClearUpdateRequest {}
message CommonAPIClearUpdateResponse {}
message CommonAPIPerformUpdateRequest {}
message CommonAPIPerformUpdateResponse {}
message CommonAPIFactoryResetRequest {}
message CommonAPIFactoryResetResponse {}
message CommonAPIGetNetworkingStatusRequest {}
message CommonAPIGetNetworkingStatusResponse {
optional WifiConfig wifiConfig = 1;
optional NetworkInterface wifi = 2;
optional NetworkInterface eth = 3;
optional NetworkInterface gsm = 4;
}
message CommonAPIWifiScanRequest {
uint32 maxScanDurationS = 1;
repeated int32 desiredSecurityTypes = 2;
uint32 maximumTotalAps = 3;
}
message CommonAPIWifiScanResponse {
repeated WifiNetwork wifiNetworks = 1;
}
message CommonAPIConfigureWifiRequest {
bool enabled = 1;
optional WifiConfig wifiConfig = 2;
}
message CommonAPIConfigureWifiResponse {
optional WifiConfig wifiConfig = 1;
optional NetworkInterface wifi = 2;
}
message CommonAPIConfigureWifiWithEncryptedPasswordRequest {
bool enabled = 1;
optional WifiConfig wifiConfig = 2;
optional EncryptedMessage encryptedPassword = 3;
}
message CommonAPIConfigureWifiWithEncryptedPasswordResponse {
optional WifiConfig wifiConfig = 1;
optional NetworkInterface wifi = 2;
int32 result = 3;
}
message CommonAPIDeviceCertRequest {}
message CommonAPIDeviceCertResponse {
int32 format = 1;
bytes deviceCert = 2;
}
message AlertLog {
fixed64 data = 1;
}
message AlertMatrix {
fixed64 data = 1;
}
message EnergySiteNetDevice {
optional Din din = 1;
optional WifiConfig wifiApConfig = 2;
}
message EnergySiteNetRecentlyAddedDevice {
optional Din din = 1;
int32 status = 2;
}
message EnergySiteNetRecentlyRemovedDevice {
optional Din din = 1;
int32 status = 2;
}
message EnergySiteNetConfig {
repeated EnergySiteNetDevice devices = 1;
repeated EnergySiteNetRecentlyAddedDevice recentlyAdded = 2;
repeated EnergySiteNetRecentlyRemovedDevice recentlyRemoved = 3;
}
message EnergySiteNetAPIAddDeviceRequest {
EnergySiteNetDevice device = 1;
}
message EnergySiteNetAPIAddDeviceResponse {
EnergySiteNetRecentlyAddedDevice recentlyAdded = 1;
}
message EnergySiteNetAPIRemoveDeviceRequest {
Din din = 1;
}
message EnergySiteNetAPIRemoveDeviceResponse {
EnergySiteNetRecentlyRemovedDevice recentlyRemoved = 1;
}
message EnergySiteNetAPIGetConfigRequest {}
message EnergySiteNetAPIGetConfigResponse {
EnergySiteNetConfig config = 1;
}
message DeviceVital {
optional string name = 1;
oneof value {
int64 intValue = 3;
double floatValue = 4;
string stringValue = 5;
bool boolValue = 6;
}
}
message StringValue {
string value = 1;
}
message UInt32Value {
uint32 value = 1;
}
message Int32Value {
int32 value = 1;
}
message UInt64Value {
uint64 value = 1;
}
message FloatValue {
float value = 1;
}
message ConnectionParameters {
optional StringValue ipAddress = 1;
optional StringValue serialPort = 2;
optional int64 serialBaud = 3;
optional uint32 modbusId = 4;
}
message TeslaHardwareId {
optional UInt32Value pcbaId = 1;
optional UInt32Value assemblyId = 2;
optional UInt32Value usageId = 3;
}
message TeslaEnergyEcuAttributes {
int32 ecuType = 1;
optional TeslaHardwareId hardwareId = 2;
optional PVInverterAttributes pvInverterAttributes = 3;
optional MeterAttributes meterAttributes = 4;
}
message GeneratorAttributes {
uint64 nameplateRealPowerW = 1;
uint64 nameplateApparentPowerVa = 2;
}
message PVInverterAttributes {
uint64 nameplateRealPowerW = 1;
}
message MeterAttributes {
repeated uint32 meterLocation = 1;
}
message DeviceAttributes {
oneof deviceAttributes {
TeslaEnergyEcuAttributes teslaEnergyEcuAttributes = 1;
GeneratorAttributes generatorAttributes = 2;
PVInverterAttributes pvInverterAttributes = 3;
MeterAttributes meterAttributes = 4;
};
}
message Device {
optional StringValue din = 1;
optional StringValue partNumber = 2;
optional StringValue serialNumber = 3;
optional StringValue manufacturer = 4;
optional StringValue siteLabel = 5;
optional StringValue componentParentDin = 6;
optional StringValue firmwareVersion = 7;
optional google.protobuf.Timestamp firstCommunicationTime = 8;
optional google.protobuf.Timestamp lastCommunicationTime = 9;
optional ConnectionParameters connectionParameters = 10;
optional DeviceAttributes deviceAttributes = 11;
}
message SiteControllerConnectedDevice {
optional Device device = 1;
}
message SiteControllerConnectedDeviceWithVitals {
SiteControllerConnectedDevice device = 1;
repeated DeviceVital vitals = 2;
repeated string alerts = 3;
}
message DevicesWithVitals {
repeated SiteControllerConnectedDeviceWithVitals devices = 1;
}
message SiteControllerConnectedDeviceStore {
repeated SiteControllerConnectedDevice siteControllerConnectedDevice = 1;
}
message BatterySystemCapabilities {
uint64 nominalEnergyWh = 1;
uint64 nominalPowerW = 2;
}
message Status {
int32 code = 1;
string message = 2;
repeated google.protobuf.Any details = 3;
}
message Manifest {
string gatewayDin = 1;
int32 trigger = 2;
google.protobuf.Timestamp generatedTime = 3;
repeated Device device = 4;
optional BatterySystemCapabilities batterySystemCapabilities = 5;
optional StringValue gatewayFirmwareVersion = 6;
}
message MessageEnvelope {
int32 deliveryChannel = 1;
Participant sender = 2;
Participant recipient = 3;
oneof payload {
CommonMessages common = 4;
TEGMessages teg = 5;
EnergySiteNetMessages energysitenet = 6;
}
}
message CommonMessages {
int32 errorResponse = 1;
oneof message {
CommonAPIGetSystemInfoRequest getSystemInfoRequest = 2;
CommonAPIGetSystemInfoResponse getSystemInfoResponse = 3;
CommonAPISetLocalSiteConfigRequest setLocalSiteConfigRequest = 4;
CommonAPISetLocalSiteConfigResponse setLocalSiteConfigResponse = 5;
CommonAPIPerformUpdateRequest performUpdateRequest = 6;
CommonAPIPerformUpdateResponse performUpdateResponse = 7;
CommonAPIFactoryResetRequest factoryResetRequest = 8;
CommonAPIFactoryResetResponse factoryResetResponse = 9;
CommonAPIWifiScanRequest wifiScanRequest = 10;
CommonAPIWifiScanResponse wifiScanResponse = 11;
CommonAPIConfigureWifiRequest configureWifiRequest = 12;
CommonAPIConfigureWifiResponse configureWifiResponse = 13;
CommonAPICheckForUpdateRequest checkForUpdateRequest = 14;
CommonAPICheckForUpdateResponse checkForUpdateResponse = 15;
CommonAPIClearUpdateRequest clearUpdateRequest = 16;
CommonAPIClearUpdateResponse clearUpdateResponse = 17;
CommonAPIDeviceCertRequest deviceCertRequest = 18;
CommonAPIDeviceCertResponse deviceCertResponse = 19;
CommonAPIConfigureWifiWithEncryptedPasswordRequest configureWifiWithEncryptedPasswordRequest = 20;
CommonAPIConfigureWifiWithEncryptedPasswordResponse configureWifiWithEncryptedPasswordResponse = 21;
CommonAPIGetNetworkingStatusRequest getNetworkingStatusRequest = 22;
CommonAPIGetNetworkingStatusResponse getNetworkingStatusResponse = 23;
}
}
message TEGMessages {
oneof message {
TEGAPIGetConfigRequest getConfigRequest = 1;
TEGAPIGetConfigResponse getConfigResponse = 2;
TEGAPISetIslandModeRequest setIslandModeRequest = 3;
TEGAPISetIslandModeResponse setIslandModeResponse = 4;
TEGAPITriggerIslandingBlackStartRequest triggerIslandingBlackStartRequest = 5;
TEGAPITriggerIslandingBlackStartResponse triggerIslandingBlackStartResponse = 6;
TEGAPITriggerAssetManifestUploadRequest triggerAssetManifestUploadRequest = 7;
TEGAPITriggerAssetManifestUploadResponse triggerAssetManifestUploadResponse = 8;
}
}
message TEGSettings {}
message TEGAPIGetConfigRequest {}
message TEGAPIGetConfigResponse {
optional TEGSettings settings = 1;
optional WifiConfig wifiConfig = 2;
optional NetworkInterface wifi = 3;
optional NetworkInterface eth = 4;
optional NetworkInterface gsm = 5;
}
message TEGAPITriggerIslandingBlackStartRequest {}
message TEGAPITriggerIslandingBlackStartResponse {}
message TEGAPISetIslandModeRequest {
int32 mode = 1;
bool force = 2;
}
message TEGAPISetIslandModeResponse {
int32 result = 1;
}
message TEGAPITriggerAssetManifestUploadRequest {}
message TEGAPITriggerAssetManifestUploadResponse {}
message EnergySiteNetMessages {
oneof message {
EnergySiteNetAPIAddDeviceRequest addDeviceRequest = 1;
EnergySiteNetAPIAddDeviceResponse addDeviceResponse = 2;
EnergySiteNetAPIRemoveDeviceRequest removeDeviceRequest = 3;
EnergySiteNetAPIRemoveDeviceResponse removeDeviceResponse = 4;
EnergySiteNetAPIGetConfigRequest getConfigRequest = 5;
EnergySiteNetAPIGetConfigResponse getConfigResponse = 6;
}
}
message LocalAuthAPIRequiredFactorsRequest {}
message LocalAuthAPIRequiredFactorsResponse {
bool password = 1;
bool presence = 2;
}
message LocalAuthAPILoginRequest {
int32 Participant = 1;
string email = 2;
WifiPassword password = 3;
}
message LocalAuthAPILoginResponse {
int32 result = 1;
}
message LocalAuthAPILogoutRequest {}
message LocalAuthAPILogoutResponse {}
message LocalAuthAPICheckAuthStatusRequest {}
message LocalAuthAPICheckAuthStatusResponse {
int32 result = 1;
}