tesla-fleet-api 0.4.0 → 0.5.0

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 (219) hide show
  1. package/README.md +284 -1
  2. package/dist/_virtual/_rolldown/runtime.cjs +10 -0
  3. package/dist/bluetooth/adapters/shared.cjs +38 -0
  4. package/dist/bluetooth/adapters/shared.mjs +36 -0
  5. package/dist/bluetooth/async.cjs +121 -0
  6. package/dist/bluetooth/async.d.cts +10 -0
  7. package/dist/bluetooth/async.d.mts +10 -0
  8. package/dist/bluetooth/async.mjs +116 -0
  9. package/dist/bluetooth/broadcast.cjs +153 -0
  10. package/dist/bluetooth/broadcast.d.cts +59 -0
  11. package/dist/bluetooth/broadcast.d.mts +59 -0
  12. package/dist/bluetooth/broadcast.mjs +151 -0
  13. package/dist/bluetooth/constants.cjs +99 -0
  14. package/dist/bluetooth/constants.d.cts +70 -0
  15. package/dist/bluetooth/constants.d.mts +70 -0
  16. package/dist/bluetooth/constants.mjs +72 -0
  17. package/dist/bluetooth/esphome.cjs +292 -0
  18. package/dist/bluetooth/esphome.d.cts +83 -0
  19. package/dist/bluetooth/esphome.d.mts +83 -0
  20. package/dist/bluetooth/esphome.mjs +291 -0
  21. package/dist/bluetooth/framing.cjs +125 -0
  22. package/dist/bluetooth/framing.d.cts +45 -0
  23. package/dist/bluetooth/framing.d.mts +45 -0
  24. package/dist/bluetooth/framing.mjs +122 -0
  25. package/dist/bluetooth/homey.cjs +155 -0
  26. package/dist/bluetooth/homey.d.cts +75 -0
  27. package/dist/bluetooth/homey.d.mts +75 -0
  28. package/dist/bluetooth/homey.mjs +150 -0
  29. package/dist/bluetooth/names.cjs +24 -0
  30. package/dist/bluetooth/names.d.cts +10 -0
  31. package/dist/bluetooth/names.d.mts +10 -0
  32. package/dist/bluetooth/names.mjs +20 -0
  33. package/dist/bluetooth/noble.cjs +178 -0
  34. package/dist/bluetooth/noble.d.cts +58 -0
  35. package/dist/bluetooth/noble.d.mts +58 -0
  36. package/dist/bluetooth/noble.mjs +177 -0
  37. package/dist/bluetooth/streamglue.cjs +157 -0
  38. package/dist/bluetooth/streamglue.d.cts +37 -0
  39. package/dist/bluetooth/streamglue.d.mts +37 -0
  40. package/dist/bluetooth/streamglue.mjs +154 -0
  41. package/dist/bluetooth/teslabluetooth.cjs +67 -0
  42. package/dist/bluetooth/teslabluetooth.d.cts +41 -0
  43. package/dist/bluetooth/teslabluetooth.d.mts +41 -0
  44. package/dist/bluetooth/teslabluetooth.mjs +66 -0
  45. package/dist/bluetooth/transport.cjs +10 -0
  46. package/dist/bluetooth/transport.d.cts +95 -0
  47. package/dist/bluetooth/transport.d.mts +95 -0
  48. package/dist/bluetooth/transport.mjs +10 -0
  49. package/dist/bluetooth/vehiclebluetooth.cjs +1272 -0
  50. package/dist/bluetooth/vehiclebluetooth.d.cts +495 -0
  51. package/dist/bluetooth/vehiclebluetooth.d.mts +495 -0
  52. package/dist/bluetooth/vehiclebluetooth.mjs +1270 -0
  53. package/dist/bluetooth/verify.cjs +93 -0
  54. package/dist/bluetooth/verify.d.cts +35 -0
  55. package/dist/bluetooth/verify.d.mts +35 -0
  56. package/dist/bluetooth/verify.mjs +91 -0
  57. package/dist/bluetooth.cjs +53 -0
  58. package/dist/bluetooth.d.cts +10 -0
  59. package/dist/bluetooth.d.mts +10 -0
  60. package/dist/bluetooth.mjs +9 -0
  61. package/dist/commands.cjs +1080 -85
  62. package/dist/commands.d.cts +585 -54
  63. package/dist/commands.d.mts +583 -51
  64. package/dist/commands.mjs +1084 -93
  65. package/dist/const.cjs +22 -0
  66. package/dist/const.d.cts +21 -0
  67. package/dist/const.d.mts +21 -0
  68. package/dist/const.mjs +20 -1
  69. package/dist/energy.cjs +24 -19
  70. package/dist/energy.d.cts +21 -15
  71. package/dist/energy.d.mts +21 -15
  72. package/dist/energy.mjs +24 -19
  73. package/dist/energyisland.cjs +38 -0
  74. package/dist/energyisland.mjs +37 -0
  75. package/dist/energyparsers.cjs +118 -0
  76. package/dist/energyparsers.d.cts +39 -0
  77. package/dist/energyparsers.d.mts +39 -0
  78. package/dist/energyparsers.mjs +116 -0
  79. package/dist/energyspecific.cjs +375 -17
  80. package/dist/energyspecific.d.cts +199 -19
  81. package/dist/energyspecific.d.mts +197 -16
  82. package/dist/energyspecific.mjs +370 -18
  83. package/dist/exceptions.cjs +3 -2
  84. package/dist/exceptions.d.cts +3 -2
  85. package/dist/exceptions.d.mts +3 -2
  86. package/dist/exceptions.mjs +3 -2
  87. package/dist/funnel.cjs +297 -0
  88. package/dist/funnel.d.cts +118 -0
  89. package/dist/funnel.d.mts +118 -0
  90. package/dist/funnel.mjs +292 -0
  91. package/dist/index.cjs +61 -0
  92. package/dist/index.d.cts +22 -8
  93. package/dist/index.d.mts +22 -8
  94. package/dist/index.mjs +19 -6
  95. package/dist/log.cjs +75 -0
  96. package/dist/log.d.cts +4 -0
  97. package/dist/log.d.mts +4 -0
  98. package/dist/log.mjs +71 -0
  99. package/dist/oauth.cjs +143 -0
  100. package/dist/oauth.d.cts +69 -0
  101. package/dist/oauth.d.mts +69 -0
  102. package/dist/oauth.mjs +143 -0
  103. package/dist/powerwall/client.cjs +818 -0
  104. package/dist/powerwall/client.d.cts +297 -0
  105. package/dist/powerwall/client.d.mts +297 -0
  106. package/dist/powerwall/client.mjs +807 -0
  107. package/dist/powerwall/components.cjs +188 -0
  108. package/dist/powerwall/components.d.cts +45 -0
  109. package/dist/powerwall/components.d.mts +45 -0
  110. package/dist/powerwall/components.mjs +182 -0
  111. package/dist/powerwall/energysite.cjs +216 -0
  112. package/dist/powerwall/energysite.d.cts +104 -0
  113. package/dist/powerwall/energysite.d.mts +104 -0
  114. package/dist/powerwall/energysite.mjs +214 -0
  115. package/dist/powerwall/exceptions.cjs +59 -0
  116. package/dist/powerwall/exceptions.d.cts +38 -0
  117. package/dist/powerwall/exceptions.d.mts +38 -0
  118. package/dist/powerwall/exceptions.mjs +51 -0
  119. package/dist/powerwall/gateway.cjs +102 -0
  120. package/dist/powerwall/gateway.d.cts +57 -0
  121. package/dist/powerwall/gateway.d.mts +57 -0
  122. package/dist/powerwall/gateway.mjs +101 -0
  123. package/dist/powerwall/merge.cjs +163 -0
  124. package/dist/powerwall/merge.d.cts +63 -0
  125. package/dist/powerwall/merge.d.mts +63 -0
  126. package/dist/powerwall/merge.mjs +159 -0
  127. package/dist/powerwall/models.d.cts +95 -0
  128. package/dist/powerwall/models.d.mts +95 -0
  129. package/dist/powerwall/queries.cjs +17 -0
  130. package/dist/powerwall/queries.mjs +10 -0
  131. package/dist/powerwall/transport.cjs +232 -0
  132. package/dist/powerwall/transport.mjs +227 -0
  133. package/dist/powerwall.cjs +47 -0
  134. package/dist/powerwall.d.cts +9 -0
  135. package/dist/powerwall.d.mts +9 -0
  136. package/dist/powerwall.mjs +8 -0
  137. package/dist/router/base.cjs +203 -0
  138. package/dist/router/base.d.cts +112 -0
  139. package/dist/router/base.d.mts +112 -0
  140. package/dist/router/base.mjs +200 -0
  141. package/dist/router/energysite.cjs +65 -0
  142. package/dist/router/energysite.d.cts +47 -0
  143. package/dist/router/energysite.d.mts +47 -0
  144. package/dist/router/energysite.mjs +60 -0
  145. package/dist/router.cjs +13 -0
  146. package/dist/router.d.cts +3 -1
  147. package/dist/router.d.mts +3 -1
  148. package/dist/router.mjs +3 -1
  149. package/dist/signing/crypto.cjs +28 -0
  150. package/dist/signing/crypto.mjs +26 -1
  151. package/dist/signing/energy.cjs +123 -0
  152. package/dist/signing/energy.d.cts +45 -0
  153. package/dist/signing/energy.d.mts +45 -0
  154. package/dist/signing/energy.mjs +120 -0
  155. package/dist/signing/jws.cjs +229 -0
  156. package/dist/signing/jws.d.cts +45 -0
  157. package/dist/signing/jws.d.mts +45 -0
  158. package/dist/signing/jws.mjs +211 -0
  159. package/dist/signing/keys.cjs +191 -0
  160. package/dist/signing/keys.d.cts +21 -0
  161. package/dist/signing/keys.d.mts +21 -0
  162. package/dist/signing/keys.mjs +182 -0
  163. package/dist/signing/session.cjs +104 -30
  164. package/dist/signing/session.d.cts +60 -23
  165. package/dist/signing/session.d.mts +60 -23
  166. package/dist/signing/session.mjs +105 -31
  167. package/dist/tariff.cjs +27 -0
  168. package/dist/tariff.d.cts +11 -0
  169. package/dist/tariff.d.mts +11 -0
  170. package/dist/tariff.mjs +27 -1
  171. package/dist/teslafleetapi.cjs +256 -55
  172. package/dist/teslafleetapi.d.cts +110 -14
  173. package/dist/teslafleetapi.d.mts +110 -14
  174. package/dist/teslafleetapi.mjs +258 -57
  175. package/dist/teslemetry.cjs +152 -5
  176. package/dist/teslemetry.d.cts +95 -5
  177. package/dist/teslemetry.d.mts +93 -3
  178. package/dist/teslemetry.mjs +151 -6
  179. package/dist/teslemetryenergy.cjs +287 -0
  180. package/dist/teslemetryenergy.d.cts +154 -0
  181. package/dist/teslemetryenergy.d.mts +154 -0
  182. package/dist/teslemetryenergy.mjs +282 -0
  183. package/dist/teslemetryvehicle.cjs +407 -0
  184. package/dist/teslemetryvehicle.d.cts +238 -0
  185. package/dist/teslemetryvehicle.d.mts +238 -0
  186. package/dist/teslemetryvehicle.mjs +405 -0
  187. package/dist/tessie.cjs +42 -5
  188. package/dist/tessie.d.cts +51 -5
  189. package/dist/tessie.d.mts +49 -3
  190. package/dist/tessie.mjs +42 -5
  191. package/dist/tessievehicle.cjs +514 -0
  192. package/dist/tessievehicle.d.cts +333 -0
  193. package/dist/tessievehicle.d.mts +333 -0
  194. package/dist/tessievehicle.mjs +513 -0
  195. package/dist/types/live_status.d.cts +16 -16
  196. package/dist/types/live_status.d.mts +16 -16
  197. package/dist/types/responses.d.cts +5 -1
  198. package/dist/types/responses.d.mts +5 -1
  199. package/dist/types/vehicle.d.cts +7 -1
  200. package/dist/types/vehicle.d.mts +7 -1
  201. package/dist/types.d.cts +3 -3
  202. package/dist/types.d.mts +3 -3
  203. package/dist/util.cjs +41 -0
  204. package/dist/util.d.cts +18 -0
  205. package/dist/util.d.mts +18 -0
  206. package/dist/util.mjs +40 -0
  207. package/dist/vehicle.cjs +79 -36
  208. package/dist/vehicle.d.cts +42 -26
  209. package/dist/vehicle.d.mts +42 -26
  210. package/dist/vehicle.mjs +80 -37
  211. package/dist/vehiclesigned.cjs +20 -5
  212. package/dist/vehiclesigned.d.cts +14 -5
  213. package/dist/vehiclesigned.d.mts +14 -5
  214. package/dist/vehiclesigned.mjs +20 -5
  215. package/dist/vehiclespecific.cjs +126 -15
  216. package/dist/vehiclespecific.d.cts +82 -18
  217. package/dist/vehiclespecific.d.mts +82 -18
  218. package/dist/vehiclespecific.mjs +126 -15
  219. package/package.json +70 -3
@@ -0,0 +1,93 @@
1
+ let _teslemetry_tesla_protocol_command_vcsec = require("@teslemetry/tesla-protocol/command/vcsec");
2
+ // src/bluetooth/verify.ts
3
+ /**
4
+ * These are float32 on the wire, so a double set by the caller only equals the
5
+ * value the car reports back once it is narrowed the same way: 21.7 would
6
+ * otherwise compare unequal and prove a command that ran did not.
7
+ */
8
+ function sameFloat(sent, reported) {
9
+ return reported === void 0 ? void 0 : Math.fround(sent) === Math.fround(reported);
10
+ }
11
+ function same(sent, reported) {
12
+ return reported === void 0 ? void 0 : sent === reported;
13
+ }
14
+ /**
15
+ * Whether a charge cable is plugged in, from positive evidence only. An absent or
16
+ * `SNA` cable field is not an unplugged cable, so `null` means unknown, and that
17
+ * includes a known cable reported as `Disconnected`. A `null` here must stop a
18
+ * charge-port opening: the two answers have different proofs of success.
19
+ */
20
+ function chargePortConnected(state) {
21
+ const cable = state.connChargeCable;
22
+ const disconnected = state.chargingState?.Disconnected !== void 0;
23
+ if (cable?.IEC ?? cable?.SAE ?? cable?.gbAc ?? cable?.gbDc) return disconnected ? null : true;
24
+ return disconnected ? false : null;
25
+ }
26
+ /**
27
+ * The plan for a VCSEC actuation. Only lock and unlock have one.
28
+ *
29
+ * `UNLOCKED` is the proto3 zero value, so it is never on the wire: a status that
30
+ * says nothing about the lock decodes to it, as a sleep-only broadcast does. It
31
+ * proves nothing either way, which Python's comparison misses. So a status can
32
+ * never confirm an unlock, which needs its ack, and it can only rule one out.
33
+ */
34
+ function vcsecVerifyPlan(command) {
35
+ const { VEHICLELOCKSTATE_INTERNAL_LOCKED, VEHICLELOCKSTATE_LOCKED, VEHICLELOCKSTATE_UNLOCKED } = _teslemetry_tesla_protocol_command_vcsec.VehicleLockStateE;
36
+ if (command.RKEAction === _teslemetry_tesla_protocol_command_vcsec.RKEActionE.RKE_ACTION_LOCK) return {
37
+ reader: "vehicle_state",
38
+ executed: ({ vehicleLockState: state }) => state === VEHICLELOCKSTATE_UNLOCKED ? void 0 : state === VEHICLELOCKSTATE_LOCKED
39
+ };
40
+ if (command.RKEAction === _teslemetry_tesla_protocol_command_vcsec.RKEActionE.RKE_ACTION_UNLOCK) return {
41
+ reader: "vehicle_state",
42
+ executed: ({ vehicleLockState: state }) => state === VEHICLELOCKSTATE_LOCKED || state === VEHICLELOCKSTATE_INTERNAL_LOCKED ? false : void 0
43
+ };
44
+ return null;
45
+ }
46
+ /**
47
+ * The plan for an infotainment command. Only clearly derivable absolute
48
+ * commands have one. Never add a toggle, a relative step or an ack-only action:
49
+ * nothing about their outcome can be read back.
50
+ */
51
+ function infotainmentVerifyPlan(action) {
52
+ if (action?.chargingSetLimitAction) {
53
+ const { percent } = action.chargingSetLimitAction;
54
+ return {
55
+ reader: "charge_state",
56
+ executed: (state) => same(percent, state.chargeLimitSoc)
57
+ };
58
+ }
59
+ if (action?.setChargingAmpsAction) {
60
+ const { chargingAmps } = action.setChargingAmpsAction;
61
+ return {
62
+ reader: "charge_state",
63
+ executed: (state) => same(chargingAmps, state.chargingAmps)
64
+ };
65
+ }
66
+ const target = action?.mediaUpdateVolume?.volumeAbsoluteFloat;
67
+ if (target !== void 0) return {
68
+ reader: "media_state",
69
+ executed: (state) => sameFloat(target, state.audioVolume)
70
+ };
71
+ if (action?.hvacTemperatureAdjustmentAction) {
72
+ const { driverTempCelsius, passengerTempCelsius } = action.hvacTemperatureAdjustmentAction;
73
+ return {
74
+ reader: "climate_state",
75
+ executed: (state) => {
76
+ const driver = sameFloat(driverTempCelsius, state.driverTempSetting);
77
+ const passenger = sameFloat(passengerTempCelsius, state.passengerTempSetting);
78
+ return driver === void 0 || passenger === void 0 ? void 0 : driver && passenger;
79
+ }
80
+ };
81
+ }
82
+ if (action?.hvacAutoAction) {
83
+ const { powerOn } = action.hvacAutoAction;
84
+ return {
85
+ reader: "climate_state",
86
+ executed: (state) => same(powerOn, state.isClimateOn)
87
+ };
88
+ }
89
+ return null;
90
+ }
91
+ exports.chargePortConnected = chargePortConnected;
92
+ exports.infotainmentVerifyPlan = infotainmentVerifyPlan;
93
+ exports.vcsecVerifyPlan = vcsecVerifyPlan;
@@ -0,0 +1,35 @@
1
+ import { UnsignedMessage, VehicleStatus } from "@teslemetry/tesla-protocol/command/vcsec";
2
+ import { VehicleAction } from "@teslemetry/tesla-protocol/command/car_server";
3
+ import { ChargeState, ClimateState, MediaState } from "@teslemetry/tesla-protocol/command/vehicle";
4
+ /**
5
+ * How hard a mutating command tries to confirm itself before returning.
6
+ *
7
+ * - `"optimistic"`: success once the write completes.
8
+ * - `"ack"`: wait for the addressed ack. Lock and unlock also race a matching
9
+ * status broadcast, because the car keeps broadcasting when an ack is lost.
10
+ * - `"verify"`: as `"ack"`, then read state back after a timeout.
11
+ */
12
+ export type BluetoothConfirmation = "optimistic" | "ack" | "verify";
13
+ /**
14
+ * Whether state shows a command ran. `undefined` means the reply left the field
15
+ * out: that proves nothing, so it is treated as a read that could not complete,
16
+ * and never as proof the command did not run.
17
+ */
18
+ type Executed<State> = (state: State) => boolean | undefined;
19
+ /** A lock or unlock's check, which a status broadcast can also answer. */
20
+ export interface VcsecVerifyPlan {
21
+ reader: "vehicle_state";
22
+ executed: Executed<VehicleStatus>;
23
+ }
24
+ /** Which reader proves a timed-out command, and how. */
25
+ export type VerifyPlan = VcsecVerifyPlan | {
26
+ reader: "charge_state";
27
+ executed: Executed<ChargeState>;
28
+ } | {
29
+ reader: "media_state";
30
+ executed: Executed<MediaState>;
31
+ } | {
32
+ reader: "climate_state";
33
+ executed: Executed<ClimateState>;
34
+ };
35
+ export {};
@@ -0,0 +1,35 @@
1
+ import { UnsignedMessage, VehicleStatus } from "@teslemetry/tesla-protocol/command/vcsec";
2
+ import { VehicleAction } from "@teslemetry/tesla-protocol/command/car_server";
3
+ import { ChargeState, ClimateState, MediaState } from "@teslemetry/tesla-protocol/command/vehicle";
4
+ /**
5
+ * How hard a mutating command tries to confirm itself before returning.
6
+ *
7
+ * - `"optimistic"`: success once the write completes.
8
+ * - `"ack"`: wait for the addressed ack. Lock and unlock also race a matching
9
+ * status broadcast, because the car keeps broadcasting when an ack is lost.
10
+ * - `"verify"`: as `"ack"`, then read state back after a timeout.
11
+ */
12
+ export type BluetoothConfirmation = "optimistic" | "ack" | "verify";
13
+ /**
14
+ * Whether state shows a command ran. `undefined` means the reply left the field
15
+ * out: that proves nothing, so it is treated as a read that could not complete,
16
+ * and never as proof the command did not run.
17
+ */
18
+ type Executed<State> = (state: State) => boolean | undefined;
19
+ /** A lock or unlock's check, which a status broadcast can also answer. */
20
+ export interface VcsecVerifyPlan {
21
+ reader: "vehicle_state";
22
+ executed: Executed<VehicleStatus>;
23
+ }
24
+ /** Which reader proves a timed-out command, and how. */
25
+ export type VerifyPlan = VcsecVerifyPlan | {
26
+ reader: "charge_state";
27
+ executed: Executed<ChargeState>;
28
+ } | {
29
+ reader: "media_state";
30
+ executed: Executed<MediaState>;
31
+ } | {
32
+ reader: "climate_state";
33
+ executed: Executed<ClimateState>;
34
+ };
35
+ export {};
@@ -0,0 +1,91 @@
1
+ import { RKEActionE, VehicleLockStateE } from "@teslemetry/tesla-protocol/command/vcsec";
2
+ // src/bluetooth/verify.ts
3
+ /**
4
+ * These are float32 on the wire, so a double set by the caller only equals the
5
+ * value the car reports back once it is narrowed the same way: 21.7 would
6
+ * otherwise compare unequal and prove a command that ran did not.
7
+ */
8
+ function sameFloat(sent, reported) {
9
+ return reported === void 0 ? void 0 : Math.fround(sent) === Math.fround(reported);
10
+ }
11
+ function same(sent, reported) {
12
+ return reported === void 0 ? void 0 : sent === reported;
13
+ }
14
+ /**
15
+ * Whether a charge cable is plugged in, from positive evidence only. An absent or
16
+ * `SNA` cable field is not an unplugged cable, so `null` means unknown, and that
17
+ * includes a known cable reported as `Disconnected`. A `null` here must stop a
18
+ * charge-port opening: the two answers have different proofs of success.
19
+ */
20
+ function chargePortConnected(state) {
21
+ const cable = state.connChargeCable;
22
+ const disconnected = state.chargingState?.Disconnected !== void 0;
23
+ if (cable?.IEC ?? cable?.SAE ?? cable?.gbAc ?? cable?.gbDc) return disconnected ? null : true;
24
+ return disconnected ? false : null;
25
+ }
26
+ /**
27
+ * The plan for a VCSEC actuation. Only lock and unlock have one.
28
+ *
29
+ * `UNLOCKED` is the proto3 zero value, so it is never on the wire: a status that
30
+ * says nothing about the lock decodes to it, as a sleep-only broadcast does. It
31
+ * proves nothing either way, which Python's comparison misses. So a status can
32
+ * never confirm an unlock, which needs its ack, and it can only rule one out.
33
+ */
34
+ function vcsecVerifyPlan(command) {
35
+ const { VEHICLELOCKSTATE_INTERNAL_LOCKED, VEHICLELOCKSTATE_LOCKED, VEHICLELOCKSTATE_UNLOCKED } = VehicleLockStateE;
36
+ if (command.RKEAction === RKEActionE.RKE_ACTION_LOCK) return {
37
+ reader: "vehicle_state",
38
+ executed: ({ vehicleLockState: state }) => state === VEHICLELOCKSTATE_UNLOCKED ? void 0 : state === VEHICLELOCKSTATE_LOCKED
39
+ };
40
+ if (command.RKEAction === RKEActionE.RKE_ACTION_UNLOCK) return {
41
+ reader: "vehicle_state",
42
+ executed: ({ vehicleLockState: state }) => state === VEHICLELOCKSTATE_LOCKED || state === VEHICLELOCKSTATE_INTERNAL_LOCKED ? false : void 0
43
+ };
44
+ return null;
45
+ }
46
+ /**
47
+ * The plan for an infotainment command. Only clearly derivable absolute
48
+ * commands have one. Never add a toggle, a relative step or an ack-only action:
49
+ * nothing about their outcome can be read back.
50
+ */
51
+ function infotainmentVerifyPlan(action) {
52
+ if (action?.chargingSetLimitAction) {
53
+ const { percent } = action.chargingSetLimitAction;
54
+ return {
55
+ reader: "charge_state",
56
+ executed: (state) => same(percent, state.chargeLimitSoc)
57
+ };
58
+ }
59
+ if (action?.setChargingAmpsAction) {
60
+ const { chargingAmps } = action.setChargingAmpsAction;
61
+ return {
62
+ reader: "charge_state",
63
+ executed: (state) => same(chargingAmps, state.chargingAmps)
64
+ };
65
+ }
66
+ const target = action?.mediaUpdateVolume?.volumeAbsoluteFloat;
67
+ if (target !== void 0) return {
68
+ reader: "media_state",
69
+ executed: (state) => sameFloat(target, state.audioVolume)
70
+ };
71
+ if (action?.hvacTemperatureAdjustmentAction) {
72
+ const { driverTempCelsius, passengerTempCelsius } = action.hvacTemperatureAdjustmentAction;
73
+ return {
74
+ reader: "climate_state",
75
+ executed: (state) => {
76
+ const driver = sameFloat(driverTempCelsius, state.driverTempSetting);
77
+ const passenger = sameFloat(passengerTempCelsius, state.passengerTempSetting);
78
+ return driver === void 0 || passenger === void 0 ? void 0 : driver && passenger;
79
+ }
80
+ };
81
+ }
82
+ if (action?.hvacAutoAction) {
83
+ const { powerOn } = action.hvacAutoAction;
84
+ return {
85
+ reader: "climate_state",
86
+ executed: (state) => same(powerOn, state.isClimateOn)
87
+ };
88
+ }
89
+ return null;
90
+ }
91
+ export { chargePortConnected, infotainmentVerifyPlan, vcsecVerifyPlan };
@@ -0,0 +1,53 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_broadcast = require("./bluetooth/broadcast.cjs");
3
+ const require_constants = require("./bluetooth/constants.cjs");
4
+ const require_framing = require("./bluetooth/framing.cjs");
5
+ const require_names = require("./bluetooth/names.cjs");
6
+ const require_teslabluetooth = require("./bluetooth/teslabluetooth.cjs");
7
+ const require_streamglue = require("./bluetooth/streamglue.cjs");
8
+ const require_transport = require("./bluetooth/transport.cjs");
9
+ const require_vehiclebluetooth = require("./bluetooth/vehiclebluetooth.cjs");
10
+ exports.APPEARANCE_UUID = require_constants.APPEARANCE_UUID;
11
+ exports.BleBroadcastPublisher = require_streamglue.BleBroadcastPublisher;
12
+ exports.BleBroadcastStreamGlue = require_streamglue.BleBroadcastStreamGlue;
13
+ exports.BleNotSubmittedError = require_transport.BleNotSubmittedError;
14
+ exports.BroadcastListeners = require_broadcast.BroadcastListeners;
15
+ exports.CCCD_UUID = require_constants.CCCD_UUID;
16
+ exports.CHARGE_PORT_VERIFY_INTERVAL_MS = require_constants.CHARGE_PORT_VERIFY_INTERVAL_MS;
17
+ exports.CHARGE_PORT_VERIFY_TIMEOUT_MS = require_constants.CHARGE_PORT_VERIFY_TIMEOUT_MS;
18
+ exports.DEFAULT_CONNECT_ATTEMPTS = require_constants.DEFAULT_CONNECT_ATTEMPTS;
19
+ exports.DEFAULT_CONNECT_TIMEOUT_MS = require_constants.DEFAULT_CONNECT_TIMEOUT_MS;
20
+ exports.DEFAULT_KEEPALIVE_INTERVAL_MS = require_constants.DEFAULT_KEEPALIVE_INTERVAL_MS;
21
+ exports.DEFAULT_MAX_WRITE_SIZE = require_constants.DEFAULT_MAX_WRITE_SIZE;
22
+ exports.DEFAULT_PAIR_POLL_INTERVAL_MS = require_constants.DEFAULT_PAIR_POLL_INTERVAL_MS;
23
+ exports.DEFAULT_PAIR_TIMEOUT_MS = require_constants.DEFAULT_PAIR_TIMEOUT_MS;
24
+ exports.DEFAULT_SCAN_TIMEOUT_MS = require_constants.DEFAULT_SCAN_TIMEOUT_MS;
25
+ exports.DEFAULT_WAKE_PROBE_TIMEOUT_MS = require_constants.DEFAULT_WAKE_PROBE_TIMEOUT_MS;
26
+ exports.DEFAULT_WAKE_TIMEOUT_MS = require_constants.DEFAULT_WAKE_TIMEOUT_MS;
27
+ exports.GATT_READ_TIMEOUT_MS = require_constants.GATT_READ_TIMEOUT_MS;
28
+ exports.GATT_WRITE_TIMEOUT_MS = require_constants.GATT_WRITE_TIMEOUT_MS;
29
+ exports.GEAR_STATES = require_streamglue.GEAR_STATES;
30
+ exports.GENERIC_ACCESS_UUID = require_constants.GENERIC_ACCESS_UUID;
31
+ exports.INFOTAINMENT_BOOT_TIMEOUT_MS = require_constants.INFOTAINMENT_BOOT_TIMEOUT_MS;
32
+ exports.LINK_TEARDOWN_TIMEOUT_MS = require_constants.LINK_TEARDOWN_TIMEOUT_MS;
33
+ exports.MAX_FRAME_SIZE = require_constants.MAX_FRAME_SIZE;
34
+ exports.NAME_UUID = require_constants.NAME_UUID;
35
+ exports.READ_UUID = require_constants.READ_UUID;
36
+ exports.ReassemblingBuffer = require_framing.ReassemblingBuffer;
37
+ exports.SERVICE_UUID = require_constants.SERVICE_UUID;
38
+ exports.STALE_CHUNK_TIMEOUT_MS = require_constants.STALE_CHUNK_TIMEOUT_MS;
39
+ exports.TONNEAU_POSITION_STATES = require_streamglue.TONNEAU_POSITION_STATES;
40
+ exports.TeslaBluetooth = require_teslabluetooth.default;
41
+ exports.VEHICLE_NOTIFY_UUID = require_constants.VEHICLE_NOTIFY_UUID;
42
+ exports.VEHICLE_WRITE_UUID = require_constants.VEHICLE_WRITE_UUID;
43
+ exports.VERSION_UUID = require_constants.VERSION_UUID;
44
+ exports.VehicleBluetooth = require_vehiclebluetooth.default;
45
+ exports.VehiclesBluetooth = require_teslabluetooth.VehiclesBluetooth;
46
+ exports.WAKE_RESEND_INTERVAL_MS = require_constants.WAKE_RESEND_INTERVAL_MS;
47
+ exports.WRITE_UUID = require_constants.WRITE_UUID;
48
+ exports.get_name = require_names.get_name;
49
+ exports.name_matches_vin = require_names.name_matches_vin;
50
+ exports.parseFrame = require_framing.parseFrame;
51
+ exports.prependLength = require_framing.prependLength;
52
+ exports.splitFrame = require_framing.splitFrame;
53
+ exports.valid_name = require_names.valid_name;
@@ -0,0 +1,10 @@
1
+ import { BroadcastListeners, Unsubscribe } from "./bluetooth/broadcast.cjs";
2
+ import { APPEARANCE_UUID, CCCD_UUID, CHARGE_PORT_VERIFY_INTERVAL_MS, CHARGE_PORT_VERIFY_TIMEOUT_MS, DEFAULT_CONNECT_ATTEMPTS, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_KEEPALIVE_INTERVAL_MS, DEFAULT_MAX_WRITE_SIZE, DEFAULT_PAIR_POLL_INTERVAL_MS, DEFAULT_PAIR_TIMEOUT_MS, DEFAULT_SCAN_TIMEOUT_MS, DEFAULT_WAKE_PROBE_TIMEOUT_MS, DEFAULT_WAKE_TIMEOUT_MS, GATT_READ_TIMEOUT_MS, GATT_WRITE_TIMEOUT_MS, GENERIC_ACCESS_UUID, INFOTAINMENT_BOOT_TIMEOUT_MS, LINK_TEARDOWN_TIMEOUT_MS, MAX_FRAME_SIZE, NAME_UUID, READ_UUID, SERVICE_UUID, STALE_CHUNK_TIMEOUT_MS, VEHICLE_NOTIFY_UUID, VEHICLE_WRITE_UUID, VERSION_UUID, WAKE_RESEND_INTERVAL_MS, WRITE_UUID } from "./bluetooth/constants.cjs";
3
+ import { ReassemblingBuffer, parseFrame, prependLength, splitFrame } from "./bluetooth/framing.cjs";
4
+ import { get_name, name_matches_vin, valid_name } from "./bluetooth/names.cjs";
5
+ import TeslaBluetooth, { VehiclesBluetooth } from "./bluetooth/teslabluetooth.cjs";
6
+ import { BleBroadcastPublisher, BleBroadcastStreamGlue, GEAR_STATES, StreamSink, TONNEAU_POSITION_STATES } from "./bluetooth/streamglue.cjs";
7
+ import { BleCharacteristic, BleConnection, BleDeviceRef, BleLinkHandlers, BleNotSubmittedError, BleScanOptions, BleTransport } from "./bluetooth/transport.cjs";
8
+ import { BluetoothConfirmation, VerifyPlan } from "./bluetooth/verify.cjs";
9
+ import VehicleBluetooth, { FindVehicleOptions, PairOptions, VehicleBluetoothOptions } from "./bluetooth/vehiclebluetooth.cjs";
10
+ export { APPEARANCE_UUID, BleBroadcastPublisher, BleBroadcastStreamGlue, type BleCharacteristic, type BleConnection, type BleDeviceRef, type BleLinkHandlers, BleNotSubmittedError, type BleScanOptions, type BleTransport, type BluetoothConfirmation, BroadcastListeners, CCCD_UUID, CHARGE_PORT_VERIFY_INTERVAL_MS, CHARGE_PORT_VERIFY_TIMEOUT_MS, DEFAULT_CONNECT_ATTEMPTS, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_KEEPALIVE_INTERVAL_MS, DEFAULT_MAX_WRITE_SIZE, DEFAULT_PAIR_POLL_INTERVAL_MS, DEFAULT_PAIR_TIMEOUT_MS, DEFAULT_SCAN_TIMEOUT_MS, DEFAULT_WAKE_PROBE_TIMEOUT_MS, DEFAULT_WAKE_TIMEOUT_MS, type FindVehicleOptions, GATT_READ_TIMEOUT_MS, GATT_WRITE_TIMEOUT_MS, GEAR_STATES, GENERIC_ACCESS_UUID, INFOTAINMENT_BOOT_TIMEOUT_MS, LINK_TEARDOWN_TIMEOUT_MS, MAX_FRAME_SIZE, NAME_UUID, type PairOptions, READ_UUID, ReassemblingBuffer, SERVICE_UUID, STALE_CHUNK_TIMEOUT_MS, type StreamSink, TONNEAU_POSITION_STATES, TeslaBluetooth, type Unsubscribe, VEHICLE_NOTIFY_UUID, VEHICLE_WRITE_UUID, VERSION_UUID, VehicleBluetooth, type VehicleBluetoothOptions, VehiclesBluetooth, type VerifyPlan, WAKE_RESEND_INTERVAL_MS, WRITE_UUID, get_name, name_matches_vin, parseFrame, prependLength, splitFrame, valid_name };
@@ -0,0 +1,10 @@
1
+ import { BroadcastListeners, Unsubscribe } from "./bluetooth/broadcast.mjs";
2
+ import { APPEARANCE_UUID, CCCD_UUID, CHARGE_PORT_VERIFY_INTERVAL_MS, CHARGE_PORT_VERIFY_TIMEOUT_MS, DEFAULT_CONNECT_ATTEMPTS, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_KEEPALIVE_INTERVAL_MS, DEFAULT_MAX_WRITE_SIZE, DEFAULT_PAIR_POLL_INTERVAL_MS, DEFAULT_PAIR_TIMEOUT_MS, DEFAULT_SCAN_TIMEOUT_MS, DEFAULT_WAKE_PROBE_TIMEOUT_MS, DEFAULT_WAKE_TIMEOUT_MS, GATT_READ_TIMEOUT_MS, GATT_WRITE_TIMEOUT_MS, GENERIC_ACCESS_UUID, INFOTAINMENT_BOOT_TIMEOUT_MS, LINK_TEARDOWN_TIMEOUT_MS, MAX_FRAME_SIZE, NAME_UUID, READ_UUID, SERVICE_UUID, STALE_CHUNK_TIMEOUT_MS, VEHICLE_NOTIFY_UUID, VEHICLE_WRITE_UUID, VERSION_UUID, WAKE_RESEND_INTERVAL_MS, WRITE_UUID } from "./bluetooth/constants.mjs";
3
+ import { ReassemblingBuffer, parseFrame, prependLength, splitFrame } from "./bluetooth/framing.mjs";
4
+ import { get_name, name_matches_vin, valid_name } from "./bluetooth/names.mjs";
5
+ import TeslaBluetooth, { VehiclesBluetooth } from "./bluetooth/teslabluetooth.mjs";
6
+ import { BleBroadcastPublisher, BleBroadcastStreamGlue, GEAR_STATES, StreamSink, TONNEAU_POSITION_STATES } from "./bluetooth/streamglue.mjs";
7
+ import { BleCharacteristic, BleConnection, BleDeviceRef, BleLinkHandlers, BleNotSubmittedError, BleScanOptions, BleTransport } from "./bluetooth/transport.mjs";
8
+ import { BluetoothConfirmation, VerifyPlan } from "./bluetooth/verify.mjs";
9
+ import VehicleBluetooth, { FindVehicleOptions, PairOptions, VehicleBluetoothOptions } from "./bluetooth/vehiclebluetooth.mjs";
10
+ export { APPEARANCE_UUID, BleBroadcastPublisher, BleBroadcastStreamGlue, type BleCharacteristic, type BleConnection, type BleDeviceRef, type BleLinkHandlers, BleNotSubmittedError, type BleScanOptions, type BleTransport, type BluetoothConfirmation, BroadcastListeners, CCCD_UUID, CHARGE_PORT_VERIFY_INTERVAL_MS, CHARGE_PORT_VERIFY_TIMEOUT_MS, DEFAULT_CONNECT_ATTEMPTS, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_KEEPALIVE_INTERVAL_MS, DEFAULT_MAX_WRITE_SIZE, DEFAULT_PAIR_POLL_INTERVAL_MS, DEFAULT_PAIR_TIMEOUT_MS, DEFAULT_SCAN_TIMEOUT_MS, DEFAULT_WAKE_PROBE_TIMEOUT_MS, DEFAULT_WAKE_TIMEOUT_MS, type FindVehicleOptions, GATT_READ_TIMEOUT_MS, GATT_WRITE_TIMEOUT_MS, GEAR_STATES, GENERIC_ACCESS_UUID, INFOTAINMENT_BOOT_TIMEOUT_MS, LINK_TEARDOWN_TIMEOUT_MS, MAX_FRAME_SIZE, NAME_UUID, type PairOptions, READ_UUID, ReassemblingBuffer, SERVICE_UUID, STALE_CHUNK_TIMEOUT_MS, type StreamSink, TONNEAU_POSITION_STATES, TeslaBluetooth, type Unsubscribe, VEHICLE_NOTIFY_UUID, VEHICLE_WRITE_UUID, VERSION_UUID, VehicleBluetooth, type VehicleBluetoothOptions, VehiclesBluetooth, type VerifyPlan, WAKE_RESEND_INTERVAL_MS, WRITE_UUID, get_name, name_matches_vin, parseFrame, prependLength, splitFrame, valid_name };
@@ -0,0 +1,9 @@
1
+ import { BroadcastListeners } from "./bluetooth/broadcast.mjs";
2
+ import { APPEARANCE_UUID, CCCD_UUID, CHARGE_PORT_VERIFY_INTERVAL_MS, CHARGE_PORT_VERIFY_TIMEOUT_MS, DEFAULT_CONNECT_ATTEMPTS, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_KEEPALIVE_INTERVAL_MS, DEFAULT_MAX_WRITE_SIZE, DEFAULT_PAIR_POLL_INTERVAL_MS, DEFAULT_PAIR_TIMEOUT_MS, DEFAULT_SCAN_TIMEOUT_MS, DEFAULT_WAKE_PROBE_TIMEOUT_MS, DEFAULT_WAKE_TIMEOUT_MS, GATT_READ_TIMEOUT_MS, GATT_WRITE_TIMEOUT_MS, GENERIC_ACCESS_UUID, INFOTAINMENT_BOOT_TIMEOUT_MS, LINK_TEARDOWN_TIMEOUT_MS, MAX_FRAME_SIZE, NAME_UUID, READ_UUID, SERVICE_UUID, STALE_CHUNK_TIMEOUT_MS, VEHICLE_NOTIFY_UUID, VEHICLE_WRITE_UUID, VERSION_UUID, WAKE_RESEND_INTERVAL_MS, WRITE_UUID } from "./bluetooth/constants.mjs";
3
+ import { ReassemblingBuffer, parseFrame, prependLength, splitFrame } from "./bluetooth/framing.mjs";
4
+ import { get_name, name_matches_vin, valid_name } from "./bluetooth/names.mjs";
5
+ import TeslaBluetooth, { VehiclesBluetooth } from "./bluetooth/teslabluetooth.mjs";
6
+ import { BleBroadcastPublisher, BleBroadcastStreamGlue, GEAR_STATES, TONNEAU_POSITION_STATES } from "./bluetooth/streamglue.mjs";
7
+ import { BleNotSubmittedError } from "./bluetooth/transport.mjs";
8
+ import VehicleBluetooth from "./bluetooth/vehiclebluetooth.mjs";
9
+ export { APPEARANCE_UUID, BleBroadcastPublisher, BleBroadcastStreamGlue, BleNotSubmittedError, BroadcastListeners, CCCD_UUID, CHARGE_PORT_VERIFY_INTERVAL_MS, CHARGE_PORT_VERIFY_TIMEOUT_MS, DEFAULT_CONNECT_ATTEMPTS, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_KEEPALIVE_INTERVAL_MS, DEFAULT_MAX_WRITE_SIZE, DEFAULT_PAIR_POLL_INTERVAL_MS, DEFAULT_PAIR_TIMEOUT_MS, DEFAULT_SCAN_TIMEOUT_MS, DEFAULT_WAKE_PROBE_TIMEOUT_MS, DEFAULT_WAKE_TIMEOUT_MS, GATT_READ_TIMEOUT_MS, GATT_WRITE_TIMEOUT_MS, GEAR_STATES, GENERIC_ACCESS_UUID, INFOTAINMENT_BOOT_TIMEOUT_MS, LINK_TEARDOWN_TIMEOUT_MS, MAX_FRAME_SIZE, NAME_UUID, READ_UUID, ReassemblingBuffer, SERVICE_UUID, STALE_CHUNK_TIMEOUT_MS, TONNEAU_POSITION_STATES, TeslaBluetooth, VEHICLE_NOTIFY_UUID, VEHICLE_WRITE_UUID, VERSION_UUID, VehicleBluetooth, VehiclesBluetooth, WAKE_RESEND_INTERVAL_MS, WRITE_UUID, get_name, name_matches_vin, parseFrame, prependLength, splitFrame, valid_name };