tescmd 0.1.2__py3-none-any.whl → 0.3.1__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.
Files changed (90) hide show
  1. tescmd/__init__.py +1 -1
  2. tescmd/api/client.py +49 -5
  3. tescmd/api/command.py +1 -1
  4. tescmd/api/errors.py +13 -0
  5. tescmd/api/signed_command.py +19 -14
  6. tescmd/api/vehicle.py +19 -1
  7. tescmd/auth/oauth.py +5 -1
  8. tescmd/auth/server.py +6 -1
  9. tescmd/auth/token_store.py +8 -1
  10. tescmd/cache/response_cache.py +11 -3
  11. tescmd/cli/_client.py +142 -20
  12. tescmd/cli/_options.py +2 -4
  13. tescmd/cli/auth.py +121 -11
  14. tescmd/cli/energy.py +2 -0
  15. tescmd/cli/key.py +149 -14
  16. tescmd/cli/main.py +70 -7
  17. tescmd/cli/mcp_cmd.py +153 -0
  18. tescmd/cli/nav.py +3 -1
  19. tescmd/cli/openclaw.py +169 -0
  20. tescmd/cli/security.py +7 -1
  21. tescmd/cli/serve.py +923 -0
  22. tescmd/cli/setup.py +244 -25
  23. tescmd/cli/sharing.py +2 -0
  24. tescmd/cli/status.py +1 -1
  25. tescmd/cli/trunk.py +8 -17
  26. tescmd/cli/user.py +16 -1
  27. tescmd/cli/vehicle.py +156 -20
  28. tescmd/crypto/__init__.py +3 -1
  29. tescmd/crypto/ecdh.py +9 -0
  30. tescmd/crypto/schnorr.py +191 -0
  31. tescmd/deploy/github_pages.py +8 -0
  32. tescmd/deploy/tailscale_serve.py +154 -0
  33. tescmd/mcp/__init__.py +7 -0
  34. tescmd/mcp/server.py +648 -0
  35. tescmd/models/__init__.py +0 -2
  36. tescmd/models/auth.py +24 -2
  37. tescmd/models/config.py +1 -0
  38. tescmd/models/energy.py +0 -9
  39. tescmd/openclaw/__init__.py +23 -0
  40. tescmd/openclaw/bridge.py +330 -0
  41. tescmd/openclaw/config.py +167 -0
  42. tescmd/openclaw/dispatcher.py +522 -0
  43. tescmd/openclaw/emitter.py +175 -0
  44. tescmd/openclaw/filters.py +123 -0
  45. tescmd/openclaw/gateway.py +687 -0
  46. tescmd/openclaw/telemetry_store.py +53 -0
  47. tescmd/output/rich_output.py +46 -14
  48. tescmd/protocol/commands.py +2 -2
  49. tescmd/protocol/encoder.py +16 -13
  50. tescmd/protocol/payloads.py +132 -11
  51. tescmd/protocol/session.py +18 -8
  52. tescmd/protocol/signer.py +3 -17
  53. tescmd/telemetry/__init__.py +28 -0
  54. tescmd/telemetry/cache_sink.py +154 -0
  55. tescmd/telemetry/csv_sink.py +180 -0
  56. tescmd/telemetry/dashboard.py +227 -0
  57. tescmd/telemetry/decoder.py +284 -0
  58. tescmd/telemetry/fanout.py +49 -0
  59. tescmd/telemetry/fields.py +427 -0
  60. tescmd/telemetry/flatbuf.py +162 -0
  61. tescmd/telemetry/mapper.py +239 -0
  62. tescmd/telemetry/protos/__init__.py +4 -0
  63. tescmd/telemetry/protos/vehicle_alert.proto +31 -0
  64. tescmd/telemetry/protos/vehicle_alert_pb2.py +42 -0
  65. tescmd/telemetry/protos/vehicle_alert_pb2.pyi +44 -0
  66. tescmd/telemetry/protos/vehicle_connectivity.proto +23 -0
  67. tescmd/telemetry/protos/vehicle_connectivity_pb2.py +40 -0
  68. tescmd/telemetry/protos/vehicle_connectivity_pb2.pyi +33 -0
  69. tescmd/telemetry/protos/vehicle_data.proto +768 -0
  70. tescmd/telemetry/protos/vehicle_data_pb2.py +136 -0
  71. tescmd/telemetry/protos/vehicle_data_pb2.pyi +1336 -0
  72. tescmd/telemetry/protos/vehicle_error.proto +23 -0
  73. tescmd/telemetry/protos/vehicle_error_pb2.py +44 -0
  74. tescmd/telemetry/protos/vehicle_error_pb2.pyi +39 -0
  75. tescmd/telemetry/protos/vehicle_metric.proto +22 -0
  76. tescmd/telemetry/protos/vehicle_metric_pb2.py +44 -0
  77. tescmd/telemetry/protos/vehicle_metric_pb2.pyi +37 -0
  78. tescmd/telemetry/server.py +300 -0
  79. tescmd/telemetry/setup.py +468 -0
  80. tescmd/telemetry/tailscale.py +300 -0
  81. tescmd/telemetry/tui.py +1716 -0
  82. tescmd/triggers/__init__.py +18 -0
  83. tescmd/triggers/manager.py +264 -0
  84. tescmd/triggers/models.py +93 -0
  85. {tescmd-0.1.2.dist-info → tescmd-0.3.1.dist-info}/METADATA +125 -40
  86. tescmd-0.3.1.dist-info/RECORD +128 -0
  87. tescmd-0.1.2.dist-info/RECORD +0 -81
  88. {tescmd-0.1.2.dist-info → tescmd-0.3.1.dist-info}/WHEEL +0 -0
  89. {tescmd-0.1.2.dist-info → tescmd-0.3.1.dist-info}/entry_points.txt +0 -0
  90. {tescmd-0.1.2.dist-info → tescmd-0.3.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,239 @@
1
+ """Shared telemetry field -> VehicleData path mapping.
2
+
3
+ Translates Fleet Telemetry proto field names (e.g. ``"Soc"``, ``"Location"``)
4
+ into structured VehicleData paths (e.g. ``"charge_state.usable_battery_level"``).
5
+ Used by :class:`~tescmd.telemetry.cache_sink.CacheSink` for cache warming
6
+ and available for any consumer that needs to map telemetry into the
7
+ VehicleData JSON structure.
8
+
9
+ Keys match the ``vehicle_data.proto`` Field enum names exactly.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import logging
15
+ from dataclasses import dataclass
16
+ from typing import Any
17
+
18
+ logger = logging.getLogger(__name__)
19
+
20
+
21
+ def _extract_lat(value: Any) -> float | None:
22
+ """Extract latitude from a Location value dict."""
23
+ try:
24
+ return float(value["latitude"])
25
+ except (TypeError, KeyError, ValueError):
26
+ return None
27
+
28
+
29
+ def _extract_lon(value: Any) -> float | None:
30
+ """Extract longitude from a Location value dict."""
31
+ try:
32
+ return float(value["longitude"])
33
+ except (TypeError, KeyError, ValueError):
34
+ return None
35
+
36
+
37
+ def _to_int(value: Any) -> int | None:
38
+ try:
39
+ return int(value)
40
+ except (TypeError, ValueError):
41
+ return None
42
+
43
+
44
+ def _to_float(value: Any) -> float | None:
45
+ try:
46
+ return float(value)
47
+ except (TypeError, ValueError):
48
+ return None
49
+
50
+
51
+ def _to_bool(value: Any) -> bool | None:
52
+ if isinstance(value, bool):
53
+ return value
54
+ if isinstance(value, (int, float)):
55
+ return bool(value)
56
+ if isinstance(value, str):
57
+ return value.lower() in ("true", "1", "yes")
58
+ return None
59
+
60
+
61
+ def _to_str(value: Any) -> str | None:
62
+ if value is None:
63
+ return None
64
+ return str(value)
65
+
66
+
67
+ def _gear_str(value: Any) -> str | None:
68
+ """Map gear enum values to the API's shift_state strings."""
69
+ s = str(value) if value is not None else ""
70
+ mapping = {
71
+ "P": "P",
72
+ "Park": "P",
73
+ "R": "R",
74
+ "Reverse": "R",
75
+ "N": "N",
76
+ "Neutral": "N",
77
+ "D": "D",
78
+ "Drive": "D",
79
+ "DriveSport": "D",
80
+ }
81
+ return mapping.get(s, s or None)
82
+
83
+
84
+ @dataclass(frozen=True)
85
+ class FieldMapping:
86
+ """Maps a telemetry field to a VehicleData JSON path."""
87
+
88
+ path: str
89
+ """Dotted path into VehicleData (e.g. ``"charge_state.battery_level"``)."""
90
+
91
+ transform: Any
92
+ """Callable ``(value) -> transformed_value``. Returns ``None`` to skip."""
93
+
94
+
95
+ # ---------------------------------------------------------------------------
96
+ # Master field map: proto field name -> list of VehicleData path mappings
97
+ #
98
+ # Keys are vehicle_data.proto Field enum names.
99
+ # ---------------------------------------------------------------------------
100
+
101
+ TELEMETRY_FIELD_MAP: dict[str, list[FieldMapping]] = {
102
+ # -- charge_state --
103
+ "Soc": [FieldMapping("charge_state.usable_battery_level", _to_int)],
104
+ "BatteryLevel": [FieldMapping("charge_state.battery_level", _to_int)],
105
+ "ChargeState": [FieldMapping("charge_state.charging_state", _to_str)],
106
+ "DetailedChargeState": [FieldMapping("charge_state.charge_port_latch", _to_str)],
107
+ "EstBatteryRange": [FieldMapping("charge_state.est_battery_range", _to_float)],
108
+ "IdealBatteryRange": [FieldMapping("charge_state.ideal_battery_range", _to_float)],
109
+ "RatedRange": [FieldMapping("charge_state.battery_range", _to_float)],
110
+ "ChargerVoltage": [FieldMapping("charge_state.charger_voltage", _to_int)],
111
+ "ChargeAmps": [FieldMapping("charge_state.charge_amps", _to_int)],
112
+ "ChargerPhases": [FieldMapping("charge_state.charger_phases", _to_int)],
113
+ "ChargeLimitSoc": [FieldMapping("charge_state.charge_limit_soc", _to_int)],
114
+ "ChargeCurrentRequest": [FieldMapping("charge_state.charge_current_request", _to_int)],
115
+ "ChargeCurrentRequestMax": [
116
+ FieldMapping("charge_state.charge_current_request_max", _to_int),
117
+ ],
118
+ "ChargePortDoorOpen": [FieldMapping("charge_state.charge_port_door_open", _to_bool)],
119
+ "ChargePortLatch": [FieldMapping("charge_state.charge_port_latch", _to_str)],
120
+ "TimeToFullCharge": [FieldMapping("charge_state.time_to_full_charge", _to_float)],
121
+ "ACChargingPower": [FieldMapping("charge_state.charger_power", _to_float)],
122
+ "ACChargingEnergyIn": [FieldMapping("charge_state.charge_energy_added", _to_float)],
123
+ "FastChargerPresent": [FieldMapping("charge_state.fast_charger_present", _to_bool)],
124
+ "ScheduledChargingMode": [
125
+ FieldMapping("charge_state.scheduled_charging_mode", _to_str),
126
+ ],
127
+ "ScheduledChargingPending": [
128
+ FieldMapping("charge_state.scheduled_charging_pending", _to_bool),
129
+ ],
130
+ "ScheduledChargingStartTime": [
131
+ FieldMapping("charge_state.scheduled_charging_start_time", _to_float),
132
+ ],
133
+ "ScheduledDepartureTime": [
134
+ FieldMapping("charge_state.scheduled_departure_time_minutes", _to_int),
135
+ ],
136
+ "EnergyRemaining": [FieldMapping("charge_state.energy_remaining", _to_float)],
137
+ "PackVoltage": [FieldMapping("charge_state.pack_voltage", _to_float)],
138
+ "PackCurrent": [FieldMapping("charge_state.pack_current", _to_float)],
139
+ "ChargingCableType": [FieldMapping("charge_state.conn_charge_cable", _to_str)],
140
+ # -- climate_state --
141
+ "InsideTemp": [FieldMapping("climate_state.inside_temp", _to_float)],
142
+ "OutsideTemp": [FieldMapping("climate_state.outside_temp", _to_float)],
143
+ "HvacLeftTemperatureRequest": [
144
+ FieldMapping("climate_state.driver_temp_setting", _to_float),
145
+ ],
146
+ "HvacRightTemperatureRequest": [
147
+ FieldMapping("climate_state.passenger_temp_setting", _to_float),
148
+ ],
149
+ "HvacPower": [FieldMapping("climate_state.is_climate_on", _to_bool)],
150
+ "HvacFanStatus": [FieldMapping("climate_state.fan_status", _to_int)],
151
+ "SeatHeaterLeft": [FieldMapping("climate_state.seat_heater_left", _to_int)],
152
+ "SeatHeaterRight": [FieldMapping("climate_state.seat_heater_right", _to_int)],
153
+ "SeatHeaterRearLeft": [FieldMapping("climate_state.seat_heater_rear_left", _to_int)],
154
+ "SeatHeaterRearCenter": [
155
+ FieldMapping("climate_state.seat_heater_rear_center", _to_int),
156
+ ],
157
+ "SeatHeaterRearRight": [FieldMapping("climate_state.seat_heater_rear_right", _to_int)],
158
+ "HvacSteeringWheelHeatLevel": [
159
+ FieldMapping("climate_state.steering_wheel_heater", _to_bool),
160
+ ],
161
+ "DefrostMode": [FieldMapping("climate_state.defrost_mode", _to_int)],
162
+ "CabinOverheatProtectionMode": [
163
+ FieldMapping("climate_state.cabin_overheat_protection", _to_str),
164
+ ],
165
+ "PreconditioningEnabled": [
166
+ FieldMapping("climate_state.is_preconditioning", _to_bool),
167
+ ],
168
+ # -- drive_state --
169
+ "Location": [
170
+ FieldMapping("drive_state.latitude", _extract_lat),
171
+ FieldMapping("drive_state.longitude", _extract_lon),
172
+ ],
173
+ "VehicleSpeed": [FieldMapping("drive_state.speed", _to_int)],
174
+ "GpsHeading": [FieldMapping("drive_state.heading", _to_int)],
175
+ "Gear": [FieldMapping("drive_state.shift_state", _gear_str)],
176
+ # -- vehicle_state --
177
+ "Locked": [FieldMapping("vehicle_state.locked", _to_bool)],
178
+ "SentryMode": [FieldMapping("vehicle_state.sentry_mode", _to_bool)],
179
+ "Odometer": [FieldMapping("vehicle_state.odometer", _to_float)],
180
+ "Version": [FieldMapping("vehicle_state.car_version", _to_str)],
181
+ "ValetModeEnabled": [FieldMapping("vehicle_state.valet_mode", _to_bool)],
182
+ "TpmsPressureFl": [FieldMapping("vehicle_state.tpms_pressure_fl", _to_float)],
183
+ "TpmsPressureFr": [FieldMapping("vehicle_state.tpms_pressure_fr", _to_float)],
184
+ "TpmsPressureRl": [FieldMapping("vehicle_state.tpms_pressure_rl", _to_float)],
185
+ "TpmsPressureRr": [FieldMapping("vehicle_state.tpms_pressure_rr", _to_float)],
186
+ "CenterDisplay": [FieldMapping("vehicle_state.center_display_state", _to_int)],
187
+ "HomelinkNearby": [FieldMapping("vehicle_state.homelink_nearby", _to_bool)],
188
+ "DriverSeatOccupied": [FieldMapping("vehicle_state.is_user_present", _to_bool)],
189
+ "RemoteStartEnabled": [FieldMapping("vehicle_state.remote_start", _to_bool)],
190
+ }
191
+
192
+
193
+ class TelemetryMapper:
194
+ """Maps telemetry field names to VehicleData paths.
195
+
196
+ Usage::
197
+
198
+ mapper = TelemetryMapper()
199
+ for path, value in mapper.map("Soc", 80):
200
+ # path = "charge_state.usable_battery_level", value = 80
201
+ ...
202
+ """
203
+
204
+ def __init__(
205
+ self,
206
+ field_map: dict[str, list[FieldMapping]] | None = None,
207
+ ) -> None:
208
+ self._field_map = field_map or TELEMETRY_FIELD_MAP
209
+
210
+ def map(self, field_name: str, value: Any) -> list[tuple[str, Any]]:
211
+ """Map a telemetry field to zero or more ``(path, transformed_value)`` pairs.
212
+
213
+ Returns an empty list if the field is unmapped or all transforms
214
+ return ``None``.
215
+ """
216
+ mappings = self._field_map.get(field_name)
217
+ if mappings is None:
218
+ return []
219
+
220
+ results: list[tuple[str, Any]] = []
221
+ for mapping in mappings:
222
+ try:
223
+ transformed = mapping.transform(value)
224
+ except Exception:
225
+ logger.debug(
226
+ "Transform failed for %s -> %s",
227
+ field_name,
228
+ mapping.path,
229
+ exc_info=True,
230
+ )
231
+ continue
232
+ if transformed is not None:
233
+ results.append((mapping.path, transformed))
234
+ return results
235
+
236
+ @property
237
+ def mapped_fields(self) -> frozenset[str]:
238
+ """Return the set of telemetry field names that have mappings."""
239
+ return frozenset(self._field_map.keys())
@@ -0,0 +1,4 @@
1
+ """Generated protobuf bindings for Tesla Fleet Telemetry messages.
2
+
3
+ Proto source: https://github.com/teslamotors/fleet-telemetry/tree/main/protos
4
+ """
@@ -0,0 +1,31 @@
1
+ syntax = "proto3";
2
+
3
+ package telemetry.vehicle_alerts;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+
7
+ option go_package = "github.com/teslamotors/fleet-telemetry/protos";
8
+
9
+
10
+ // VehicleAlerts is a collection of recent alerts.
11
+ message VehicleAlerts {
12
+ repeated VehicleAlert alerts = 1;
13
+ google.protobuf.Timestamp created_at = 2;
14
+ string vin = 3;
15
+ }
16
+
17
+ // Audience the target audience for the alert.
18
+ enum Audience {
19
+ Unknown = 0;
20
+ Customer = 1;
21
+ Service = 2;
22
+ ServiceFix = 3;
23
+ }
24
+
25
+ // VehicleAlert is a single alert and is active if ended_at is nil.
26
+ message VehicleAlert {
27
+ string name = 1;
28
+ repeated Audience audiences = 2;
29
+ google.protobuf.Timestamp started_at = 3;
30
+ google.protobuf.Timestamp ended_at = 4;
31
+ }
@@ -0,0 +1,42 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: vehicle_alert.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'vehicle_alert.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
26
+
27
+
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13vehicle_alert.proto\x12\x18telemetry.vehicle_alerts\x1a\x1fgoogle/protobuf/timestamp.proto\"\x84\x01\n\rVehicleAlerts\x12\x36\n\x06\x61lerts\x18\x01 \x03(\x0b\x32&.telemetry.vehicle_alerts.VehicleAlert\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\xb1\x01\n\x0cVehicleAlert\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x35\n\taudiences\x18\x02 \x03(\x0e\x32\".telemetry.vehicle_alerts.Audience\x12.\n\nstarted_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nded_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp*B\n\x08\x41udience\x12\x0b\n\x07Unknown\x10\x00\x12\x0c\n\x08\x43ustomer\x10\x01\x12\x0b\n\x07Service\x10\x02\x12\x0e\n\nServiceFix\x10\x03\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3')
29
+
30
+ _globals = globals()
31
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
32
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'vehicle_alert_pb2', _globals)
33
+ if not _descriptor._USE_C_DESCRIPTORS:
34
+ _globals['DESCRIPTOR']._loaded_options = None
35
+ _globals['DESCRIPTOR']._serialized_options = b'Z-github.com/teslamotors/fleet-telemetry/protos'
36
+ _globals['_AUDIENCE']._serialized_start=397
37
+ _globals['_AUDIENCE']._serialized_end=463
38
+ _globals['_VEHICLEALERTS']._serialized_start=83
39
+ _globals['_VEHICLEALERTS']._serialized_end=215
40
+ _globals['_VEHICLEALERT']._serialized_start=218
41
+ _globals['_VEHICLEALERT']._serialized_end=395
42
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,44 @@
1
+ import datetime
2
+
3
+ from google.protobuf import timestamp_pb2 as _timestamp_pb2
4
+ from google.protobuf.internal import containers as _containers
5
+ from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import message as _message
8
+ from collections.abc import Iterable as _Iterable, Mapping as _Mapping
9
+ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
10
+
11
+ DESCRIPTOR: _descriptor.FileDescriptor
12
+
13
+ class Audience(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
14
+ __slots__ = ()
15
+ Unknown: _ClassVar[Audience]
16
+ Customer: _ClassVar[Audience]
17
+ Service: _ClassVar[Audience]
18
+ ServiceFix: _ClassVar[Audience]
19
+ Unknown: Audience
20
+ Customer: Audience
21
+ Service: Audience
22
+ ServiceFix: Audience
23
+
24
+ class VehicleAlerts(_message.Message):
25
+ __slots__ = ("alerts", "created_at", "vin")
26
+ ALERTS_FIELD_NUMBER: _ClassVar[int]
27
+ CREATED_AT_FIELD_NUMBER: _ClassVar[int]
28
+ VIN_FIELD_NUMBER: _ClassVar[int]
29
+ alerts: _containers.RepeatedCompositeFieldContainer[VehicleAlert]
30
+ created_at: _timestamp_pb2.Timestamp
31
+ vin: str
32
+ def __init__(self, alerts: _Optional[_Iterable[_Union[VehicleAlert, _Mapping]]] = ..., created_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., vin: _Optional[str] = ...) -> None: ...
33
+
34
+ class VehicleAlert(_message.Message):
35
+ __slots__ = ("name", "audiences", "started_at", "ended_at")
36
+ NAME_FIELD_NUMBER: _ClassVar[int]
37
+ AUDIENCES_FIELD_NUMBER: _ClassVar[int]
38
+ STARTED_AT_FIELD_NUMBER: _ClassVar[int]
39
+ ENDED_AT_FIELD_NUMBER: _ClassVar[int]
40
+ name: str
41
+ audiences: _containers.RepeatedScalarFieldContainer[Audience]
42
+ started_at: _timestamp_pb2.Timestamp
43
+ ended_at: _timestamp_pb2.Timestamp
44
+ def __init__(self, name: _Optional[str] = ..., audiences: _Optional[_Iterable[_Union[Audience, str]]] = ..., started_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., ended_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ...
@@ -0,0 +1,23 @@
1
+ syntax = "proto3";
2
+
3
+ package telemetry.vehicle_connectivity;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+
7
+ option go_package = "github.com/teslamotors/fleet-telemetry/protos";
8
+
9
+ // VehicleConnectivity represents connection status change for the vehicle
10
+ message VehicleConnectivity {
11
+ string vin = 1;
12
+ string connection_id = 2;
13
+ ConnectivityEvent status = 3;
14
+ google.protobuf.Timestamp created_at = 4;
15
+ string network_interface = 5;
16
+ }
17
+
18
+ // ConnectivityEvent represents connection state of the vehicle
19
+ enum ConnectivityEvent {
20
+ UNKNOWN = 0;
21
+ CONNECTED = 1;
22
+ DISCONNECTED = 2;
23
+ }
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: vehicle_connectivity.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'vehicle_connectivity.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
26
+
27
+
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1avehicle_connectivity.proto\x12\x1etelemetry.vehicle_connectivity\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc7\x01\n\x13VehicleConnectivity\x12\x0b\n\x03vin\x18\x01 \x01(\t\x12\x15\n\rconnection_id\x18\x02 \x01(\t\x12\x41\n\x06status\x18\x03 \x01(\x0e\x32\x31.telemetry.vehicle_connectivity.ConnectivityEvent\x12.\n\ncreated_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x19\n\x11network_interface\x18\x05 \x01(\t*A\n\x11\x43onnectivityEvent\x12\x0b\n\x07UNKNOWN\x10\x00\x12\r\n\tCONNECTED\x10\x01\x12\x10\n\x0c\x44ISCONNECTED\x10\x02\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3')
29
+
30
+ _globals = globals()
31
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
32
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'vehicle_connectivity_pb2', _globals)
33
+ if not _descriptor._USE_C_DESCRIPTORS:
34
+ _globals['DESCRIPTOR']._loaded_options = None
35
+ _globals['DESCRIPTOR']._serialized_options = b'Z-github.com/teslamotors/fleet-telemetry/protos'
36
+ _globals['_CONNECTIVITYEVENT']._serialized_start=297
37
+ _globals['_CONNECTIVITYEVENT']._serialized_end=362
38
+ _globals['_VEHICLECONNECTIVITY']._serialized_start=96
39
+ _globals['_VEHICLECONNECTIVITY']._serialized_end=295
40
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,33 @@
1
+ import datetime
2
+
3
+ from google.protobuf import timestamp_pb2 as _timestamp_pb2
4
+ from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
5
+ from google.protobuf import descriptor as _descriptor
6
+ from google.protobuf import message as _message
7
+ from collections.abc import Mapping as _Mapping
8
+ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
9
+
10
+ DESCRIPTOR: _descriptor.FileDescriptor
11
+
12
+ class ConnectivityEvent(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
13
+ __slots__ = ()
14
+ UNKNOWN: _ClassVar[ConnectivityEvent]
15
+ CONNECTED: _ClassVar[ConnectivityEvent]
16
+ DISCONNECTED: _ClassVar[ConnectivityEvent]
17
+ UNKNOWN: ConnectivityEvent
18
+ CONNECTED: ConnectivityEvent
19
+ DISCONNECTED: ConnectivityEvent
20
+
21
+ class VehicleConnectivity(_message.Message):
22
+ __slots__ = ("vin", "connection_id", "status", "created_at", "network_interface")
23
+ VIN_FIELD_NUMBER: _ClassVar[int]
24
+ CONNECTION_ID_FIELD_NUMBER: _ClassVar[int]
25
+ STATUS_FIELD_NUMBER: _ClassVar[int]
26
+ CREATED_AT_FIELD_NUMBER: _ClassVar[int]
27
+ NETWORK_INTERFACE_FIELD_NUMBER: _ClassVar[int]
28
+ vin: str
29
+ connection_id: str
30
+ status: ConnectivityEvent
31
+ created_at: _timestamp_pb2.Timestamp
32
+ network_interface: str
33
+ def __init__(self, vin: _Optional[str] = ..., connection_id: _Optional[str] = ..., status: _Optional[_Union[ConnectivityEvent, str]] = ..., created_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., network_interface: _Optional[str] = ...) -> None: ...