tesla-fleet-api 0.4.0 → 0.6.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.
- package/README.md +269 -1
- package/dist/_virtual/_rolldown/runtime.cjs +10 -0
- package/dist/bluetooth/adapters/shared.cjs +38 -0
- package/dist/bluetooth/adapters/shared.mjs +36 -0
- package/dist/bluetooth/async.cjs +121 -0
- package/dist/bluetooth/async.d.cts +10 -0
- package/dist/bluetooth/async.d.mts +10 -0
- package/dist/bluetooth/async.mjs +116 -0
- package/dist/bluetooth/broadcast.cjs +153 -0
- package/dist/bluetooth/broadcast.d.cts +59 -0
- package/dist/bluetooth/broadcast.d.mts +59 -0
- package/dist/bluetooth/broadcast.mjs +151 -0
- package/dist/bluetooth/constants.cjs +96 -0
- package/dist/bluetooth/constants.d.cts +68 -0
- package/dist/bluetooth/constants.d.mts +68 -0
- package/dist/bluetooth/constants.mjs +70 -0
- package/dist/bluetooth/framing.cjs +125 -0
- package/dist/bluetooth/framing.d.cts +45 -0
- package/dist/bluetooth/framing.d.mts +45 -0
- package/dist/bluetooth/framing.mjs +122 -0
- package/dist/bluetooth/homey.cjs +165 -0
- package/dist/bluetooth/homey.d.cts +84 -0
- package/dist/bluetooth/homey.d.mts +84 -0
- package/dist/bluetooth/homey.mjs +159 -0
- package/dist/bluetooth/names.cjs +24 -0
- package/dist/bluetooth/names.d.cts +10 -0
- package/dist/bluetooth/names.d.mts +10 -0
- package/dist/bluetooth/names.mjs +20 -0
- package/dist/bluetooth/noble.cjs +178 -0
- package/dist/bluetooth/noble.d.cts +58 -0
- package/dist/bluetooth/noble.d.mts +58 -0
- package/dist/bluetooth/noble.mjs +177 -0
- package/dist/bluetooth/streamglue.cjs +157 -0
- package/dist/bluetooth/streamglue.d.cts +37 -0
- package/dist/bluetooth/streamglue.d.mts +37 -0
- package/dist/bluetooth/streamglue.mjs +154 -0
- package/dist/bluetooth/teslabluetooth.cjs +67 -0
- package/dist/bluetooth/teslabluetooth.d.cts +41 -0
- package/dist/bluetooth/teslabluetooth.d.mts +41 -0
- package/dist/bluetooth/teslabluetooth.mjs +66 -0
- package/dist/bluetooth/transport.cjs +10 -0
- package/dist/bluetooth/transport.d.cts +97 -0
- package/dist/bluetooth/transport.d.mts +97 -0
- package/dist/bluetooth/transport.mjs +10 -0
- package/dist/bluetooth/vehiclebluetooth.cjs +1272 -0
- package/dist/bluetooth/vehiclebluetooth.d.cts +495 -0
- package/dist/bluetooth/vehiclebluetooth.d.mts +495 -0
- package/dist/bluetooth/vehiclebluetooth.mjs +1270 -0
- package/dist/bluetooth/verify.cjs +93 -0
- package/dist/bluetooth/verify.d.cts +35 -0
- package/dist/bluetooth/verify.d.mts +35 -0
- package/dist/bluetooth/verify.mjs +91 -0
- package/dist/bluetooth.cjs +52 -0
- package/dist/bluetooth.d.cts +10 -0
- package/dist/bluetooth.d.mts +10 -0
- package/dist/bluetooth.mjs +9 -0
- package/dist/commands.cjs +1080 -85
- package/dist/commands.d.cts +585 -54
- package/dist/commands.d.mts +583 -51
- package/dist/commands.mjs +1084 -93
- package/dist/const.cjs +22 -0
- package/dist/const.d.cts +21 -0
- package/dist/const.d.mts +21 -0
- package/dist/const.mjs +20 -1
- package/dist/energy.cjs +24 -19
- package/dist/energy.d.cts +21 -15
- package/dist/energy.d.mts +21 -15
- package/dist/energy.mjs +24 -19
- package/dist/energyisland.cjs +38 -0
- package/dist/energyisland.mjs +37 -0
- package/dist/energyparsers.cjs +118 -0
- package/dist/energyparsers.d.cts +39 -0
- package/dist/energyparsers.d.mts +39 -0
- package/dist/energyparsers.mjs +116 -0
- package/dist/energyspecific.cjs +375 -17
- package/dist/energyspecific.d.cts +199 -19
- package/dist/energyspecific.d.mts +197 -16
- package/dist/energyspecific.mjs +370 -18
- package/dist/exceptions.cjs +3 -2
- package/dist/exceptions.d.cts +3 -2
- package/dist/exceptions.d.mts +3 -2
- package/dist/exceptions.mjs +3 -2
- package/dist/funnel.cjs +297 -0
- package/dist/funnel.d.cts +118 -0
- package/dist/funnel.d.mts +118 -0
- package/dist/funnel.mjs +292 -0
- package/dist/index.cjs +61 -0
- package/dist/index.d.cts +22 -8
- package/dist/index.d.mts +22 -8
- package/dist/index.mjs +19 -6
- package/dist/log.cjs +75 -0
- package/dist/log.d.cts +4 -0
- package/dist/log.d.mts +4 -0
- package/dist/log.mjs +71 -0
- package/dist/oauth.cjs +143 -0
- package/dist/oauth.d.cts +69 -0
- package/dist/oauth.d.mts +69 -0
- package/dist/oauth.mjs +143 -0
- package/dist/powerwall/client.cjs +818 -0
- package/dist/powerwall/client.d.cts +297 -0
- package/dist/powerwall/client.d.mts +297 -0
- package/dist/powerwall/client.mjs +807 -0
- package/dist/powerwall/components.cjs +188 -0
- package/dist/powerwall/components.d.cts +45 -0
- package/dist/powerwall/components.d.mts +45 -0
- package/dist/powerwall/components.mjs +182 -0
- package/dist/powerwall/energysite.cjs +216 -0
- package/dist/powerwall/energysite.d.cts +104 -0
- package/dist/powerwall/energysite.d.mts +104 -0
- package/dist/powerwall/energysite.mjs +214 -0
- package/dist/powerwall/exceptions.cjs +59 -0
- package/dist/powerwall/exceptions.d.cts +38 -0
- package/dist/powerwall/exceptions.d.mts +38 -0
- package/dist/powerwall/exceptions.mjs +51 -0
- package/dist/powerwall/gateway.cjs +102 -0
- package/dist/powerwall/gateway.d.cts +57 -0
- package/dist/powerwall/gateway.d.mts +57 -0
- package/dist/powerwall/gateway.mjs +101 -0
- package/dist/powerwall/merge.cjs +163 -0
- package/dist/powerwall/merge.d.cts +63 -0
- package/dist/powerwall/merge.d.mts +63 -0
- package/dist/powerwall/merge.mjs +159 -0
- package/dist/powerwall/models.d.cts +95 -0
- package/dist/powerwall/models.d.mts +95 -0
- package/dist/powerwall/queries.cjs +17 -0
- package/dist/powerwall/queries.mjs +10 -0
- package/dist/powerwall/transport.cjs +232 -0
- package/dist/powerwall/transport.mjs +227 -0
- package/dist/powerwall.cjs +47 -0
- package/dist/powerwall.d.cts +9 -0
- package/dist/powerwall.d.mts +9 -0
- package/dist/powerwall.mjs +8 -0
- package/dist/router/base.cjs +203 -0
- package/dist/router/base.d.cts +112 -0
- package/dist/router/base.d.mts +112 -0
- package/dist/router/base.mjs +200 -0
- package/dist/router/energysite.cjs +65 -0
- package/dist/router/energysite.d.cts +47 -0
- package/dist/router/energysite.d.mts +47 -0
- package/dist/router/energysite.mjs +60 -0
- package/dist/router.cjs +13 -0
- package/dist/router.d.cts +3 -1
- package/dist/router.d.mts +3 -1
- package/dist/router.mjs +3 -1
- package/dist/signing/crypto.cjs +28 -0
- package/dist/signing/crypto.mjs +26 -1
- package/dist/signing/energy.cjs +123 -0
- package/dist/signing/energy.d.cts +45 -0
- package/dist/signing/energy.d.mts +45 -0
- package/dist/signing/energy.mjs +120 -0
- package/dist/signing/jws.cjs +229 -0
- package/dist/signing/jws.d.cts +45 -0
- package/dist/signing/jws.d.mts +45 -0
- package/dist/signing/jws.mjs +211 -0
- package/dist/signing/keys.cjs +191 -0
- package/dist/signing/keys.d.cts +21 -0
- package/dist/signing/keys.d.mts +21 -0
- package/dist/signing/keys.mjs +182 -0
- package/dist/signing/session.cjs +104 -30
- package/dist/signing/session.d.cts +60 -23
- package/dist/signing/session.d.mts +60 -23
- package/dist/signing/session.mjs +105 -31
- package/dist/tariff.cjs +27 -0
- package/dist/tariff.d.cts +11 -0
- package/dist/tariff.d.mts +11 -0
- package/dist/tariff.mjs +27 -1
- package/dist/teslafleetapi.cjs +256 -55
- package/dist/teslafleetapi.d.cts +110 -14
- package/dist/teslafleetapi.d.mts +110 -14
- package/dist/teslafleetapi.mjs +258 -57
- package/dist/teslemetry.cjs +152 -5
- package/dist/teslemetry.d.cts +95 -5
- package/dist/teslemetry.d.mts +93 -3
- package/dist/teslemetry.mjs +151 -6
- package/dist/teslemetryenergy.cjs +287 -0
- package/dist/teslemetryenergy.d.cts +154 -0
- package/dist/teslemetryenergy.d.mts +154 -0
- package/dist/teslemetryenergy.mjs +282 -0
- package/dist/teslemetryvehicle.cjs +407 -0
- package/dist/teslemetryvehicle.d.cts +238 -0
- package/dist/teslemetryvehicle.d.mts +238 -0
- package/dist/teslemetryvehicle.mjs +405 -0
- package/dist/tessie.cjs +42 -5
- package/dist/tessie.d.cts +51 -5
- package/dist/tessie.d.mts +49 -3
- package/dist/tessie.mjs +42 -5
- package/dist/tessievehicle.cjs +514 -0
- package/dist/tessievehicle.d.cts +333 -0
- package/dist/tessievehicle.d.mts +333 -0
- package/dist/tessievehicle.mjs +513 -0
- package/dist/types/live_status.d.cts +16 -16
- package/dist/types/live_status.d.mts +16 -16
- package/dist/types/responses.d.cts +5 -1
- package/dist/types/responses.d.mts +5 -1
- package/dist/types/vehicle.d.cts +7 -1
- package/dist/types/vehicle.d.mts +7 -1
- package/dist/types.d.cts +3 -3
- package/dist/types.d.mts +3 -3
- package/dist/util.cjs +41 -0
- package/dist/util.d.cts +18 -0
- package/dist/util.d.mts +18 -0
- package/dist/util.mjs +40 -0
- package/dist/vehicle.cjs +79 -36
- package/dist/vehicle.d.cts +42 -26
- package/dist/vehicle.d.mts +42 -26
- package/dist/vehicle.mjs +80 -37
- package/dist/vehiclesigned.cjs +20 -5
- package/dist/vehiclesigned.d.cts +14 -5
- package/dist/vehiclesigned.d.mts +14 -5
- package/dist/vehiclesigned.mjs +20 -5
- package/dist/vehiclespecific.cjs +126 -15
- package/dist/vehiclespecific.d.cts +82 -18
- package/dist/vehiclespecific.d.mts +82 -18
- package/dist/vehiclespecific.mjs +126 -15
- package/package.json +56 -3
|
@@ -1,10 +1,188 @@
|
|
|
1
|
+
import { AuthorizedClientKeyType, AuthorizedClientType, EnergyDeviceIdentifierType, EnergyIslandMode, TeslaEnergyPeriod } from "./const.cjs";
|
|
1
2
|
import Energy from "./energy.cjs";
|
|
2
3
|
import { LiveStatusResponse } from "./types/live_status.cjs";
|
|
4
|
+
import { ResponseEnvelope } from "./types/responses.cjs";
|
|
3
5
|
import { SiteInfoResponse } from "./types/site_info.cjs";
|
|
4
|
-
|
|
6
|
+
import { KeyObject } from "crypto";
|
|
7
|
+
/**
|
|
8
|
+
* The only device commands Tesla's cloud accepts unsigned, as
|
|
9
|
+
* `category.command`: the reads a gateway answers before any key is paired.
|
|
10
|
+
* Unsigned, every other command was refused with HTTP 400 live on a Powerwall 3
|
|
11
|
+
* (2026-10-29), and signed, each one reached the gateway. A site with a signing
|
|
12
|
+
* key signs everything else.
|
|
13
|
+
*/
|
|
14
|
+
export declare const UNSIGNED_DEVICE_COMMANDS: ReadonlySet<string>;
|
|
15
|
+
/** Upper bound on a `dispatch_battery_power` setpoint duration (one day). */
|
|
16
|
+
export declare const MAX_DISPATCH_DURATION_SECONDS = 86400;
|
|
17
|
+
/**
|
|
18
|
+
* Check `dispatch_battery_power` arguments before any request.
|
|
19
|
+
* @throws TypeError unless both are numbers.
|
|
20
|
+
* @throws RangeError on a non-finite power or a duration that is not a whole number from 1 to `MAX_DISPATCH_DURATION_SECONDS`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validate_dispatch_battery_power(power_watts: number, duration_seconds: number): void;
|
|
23
|
+
export default class EnergySpecific {
|
|
24
|
+
#private;
|
|
5
25
|
parent: Energy;
|
|
6
26
|
energy_site_id: number;
|
|
7
|
-
|
|
27
|
+
/** Gateway DIN (the energy site's `gateway_id` in `products`), the target of device commands. */
|
|
28
|
+
din?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Pass `private_key` and `din` to send client-signed device commands through
|
|
31
|
+
* the cloud `device_command` endpoint. With a signer, every device command is
|
|
32
|
+
* signed except the four pre-pairing reads in `UNSIGNED_DEVICE_COMMANDS`.
|
|
33
|
+
* Without one, device commands are sent unsigned, and Tesla's cloud refuses
|
|
34
|
+
* most of them with 400.
|
|
35
|
+
* @param parent
|
|
36
|
+
* @param energy_site_id
|
|
37
|
+
* @param private_key RSA key `VERIFIED` on this gateway. Without one the site is unsigned: unlike vehicles, there is no fallback to the parent's key.
|
|
38
|
+
* @param din Gateway DIN (the energy site's `gateway_id` in `products`). Required with `private_key`.
|
|
39
|
+
* @throws TypeError for a key that is not RSA.
|
|
40
|
+
*/
|
|
41
|
+
constructor(parent: Energy, energy_site_id: number, private_key?: KeyObject, din?: string);
|
|
42
|
+
/** Whether device commands are signed with a client key. */
|
|
43
|
+
get signing(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Send a gRPC command to the energy device gateway.
|
|
46
|
+
*
|
|
47
|
+
* With a signing key, this signs every command except the ones in
|
|
48
|
+
* `UNSIGNED_DEVICE_COMMANDS`. Otherwise it sends the unsigned `grpc_command`.
|
|
49
|
+
* Energy device gRPC commands are based on research from
|
|
50
|
+
* https://github.com/jasonacox/pypowerwall (MIT licensed).
|
|
51
|
+
*/
|
|
52
|
+
_command(category: string, command: string, params?: Record<string, any> | null, identifier_type?: EnergyDeviceIdentifierType): Promise<Record<string, any>>;
|
|
53
|
+
/** Send an unsigned `grpc_command` to the energy device gateway. */
|
|
54
|
+
_unsigned_command(category: string, command: string, params?: Record<string, any> | null, identifier_type?: EnergyDeviceIdentifierType): Promise<Record<string, any>>;
|
|
55
|
+
/** Build the flat `device_command` body around a signed message. */
|
|
56
|
+
protected _device_command_body(routable_message: Uint8Array, target_id: string, identifier_type: EnergyDeviceIdentifierType): Record<string, any>;
|
|
57
|
+
/**
|
|
58
|
+
* Send a signed `RoutableMessage` to the energy device. Tesla requires the
|
|
59
|
+
* body wrapped in `data` and `identifier_type` as an integer. The reply is
|
|
60
|
+
* returned unchanged; `_signed_command` checks it for a gateway error.
|
|
61
|
+
*/
|
|
62
|
+
_device_command(routable_message: Uint8Array, target_id: string, identifier_type?: EnergyDeviceIdentifierType): Promise<Record<string, any>>;
|
|
63
|
+
/**
|
|
64
|
+
* Sign a gRPC command with the site's key and send it to the gateway.
|
|
65
|
+
*
|
|
66
|
+
* A resend of the same signed bytes inside the TTL executes again, so this
|
|
67
|
+
* never retries.
|
|
68
|
+
* @throws SignedCommandRequired when the site has no signing key.
|
|
69
|
+
* @throws InvalidCommand when the gateway firmware has no handler for the command.
|
|
70
|
+
* @throws DeviceUnexpectedResponse when the gateway refuses the command.
|
|
71
|
+
*/
|
|
72
|
+
_signed_command(category: string, command: string, params?: Record<string, any> | null): Promise<Record<string, any>>;
|
|
73
|
+
/** Get energy device system information including firmware version, device type, part number, serial number, and DIN. */
|
|
74
|
+
get_system_info(): Promise<Record<string, any>>;
|
|
75
|
+
/** Get raw energy device networking status including WiFi, Ethernet, and cellular connectivity. */
|
|
76
|
+
raw_networking_status(): Promise<Record<string, any>>;
|
|
77
|
+
/** Get energy device networking status including WiFi, Ethernet, and cellular connectivity. */
|
|
78
|
+
get_networking_status(): Promise<Record<string, any>>;
|
|
79
|
+
/** Scan for available WiFi networks from the energy gateway. */
|
|
80
|
+
wifi_scan(): Promise<Record<string, any>>;
|
|
81
|
+
/** Get the energy device certificate including subject, issuer, and validity. */
|
|
82
|
+
get_device_cert(): Promise<Record<string, any>>;
|
|
83
|
+
/** Get cellular modem information from the energy gateway including the embedded SIM identifier (EID) and supported cellular profiles. */
|
|
84
|
+
get_cellular_info(): Promise<Record<string, any>>;
|
|
85
|
+
/** Check if a firmware update is available for the energy gateway. */
|
|
86
|
+
check_for_update(): Promise<Record<string, any>>;
|
|
87
|
+
/** Check the urgency level of any available firmware update for the energy gateway. */
|
|
88
|
+
check_for_update_urgency(): Promise<Record<string, any>>;
|
|
89
|
+
/** Test internet connectivity on the energy gateway across all network interfaces (WiFi, Ethernet, GSM). */
|
|
90
|
+
check_internet(): Promise<Record<string, any>>;
|
|
91
|
+
/**
|
|
92
|
+
* Update local site configuration on the energy gateway. This writes gateway
|
|
93
|
+
* configuration and is an undocumented energy device gRPC command.
|
|
94
|
+
* @param params Raw protobuf request fields.
|
|
95
|
+
*/
|
|
96
|
+
set_local_site_config(params?: Record<string, any> | null): Promise<Record<string, any>>;
|
|
97
|
+
/** List authorized clients (paired keys) on the energy gateway including their roles and state. */
|
|
98
|
+
list_authorized_clients(): Promise<Record<string, any>>;
|
|
99
|
+
/**
|
|
100
|
+
* Register an authorized client (public key) with the energy gateway, to
|
|
101
|
+
* pair a local key with a Powerwall for the LAN TEDapi v1r protocol. The
|
|
102
|
+
* encoding follows `key_type`: RSA is raw PKCS#1 `RSAPublicKey` DER
|
|
103
|
+
* (`rsa_public_der_pkcs1`), and ECC is DER SubjectPublicKeyInfo
|
|
104
|
+
* (`ec_public_der_spki`), not a raw point, which the gateway rejects. A
|
|
105
|
+
* VERIFIED ECC key still cannot sign v1r: `SignatureData` has no ECDSA member.
|
|
106
|
+
*
|
|
107
|
+
* The key stays PENDING_VERIFICATION until a physical breaker toggle confirms
|
|
108
|
+
* it inside a window of about 9 minutes. A missed window is the terminal
|
|
109
|
+
* PENDING_VERIFICATION_TIMEOUT; registering the same key again resets it
|
|
110
|
+
* without a second record.
|
|
111
|
+
* @param public_key Raw DER bytes, which are base64-encoded, or an already base64-encoded string.
|
|
112
|
+
* @param description Human-readable description of the client.
|
|
113
|
+
* @param key_type The type of key being registered.
|
|
114
|
+
* @param authorized_client_type The authorized client type.
|
|
115
|
+
*/
|
|
116
|
+
add_authorized_client(public_key: Uint8Array | string, description?: string, key_type?: AuthorizedClientKeyType, authorized_client_type?: AuthorizedClientType): Promise<Record<string, any>>;
|
|
117
|
+
/**
|
|
118
|
+
* Remove an authorized client (public key) from the energy gateway. Removal
|
|
119
|
+
* needs no physical presence proof, so any paired key can revoke every other
|
|
120
|
+
* key, including the owner's. The reply is empty, and some firmware may
|
|
121
|
+
* return no body at all. This cloud route is inferred from
|
|
122
|
+
* `add_authorized_client`; removal was only live-verified over local v1r.
|
|
123
|
+
* @param public_key Raw DER bytes, which are base64-encoded, or an already base64-encoded string as `list_authorized_clients` reports it.
|
|
124
|
+
*/
|
|
125
|
+
remove_authorized_client(public_key: Uint8Array | string): Promise<Record<string, any>>;
|
|
126
|
+
/** Get the energy gateway's public key for signed commands. */
|
|
127
|
+
get_signed_commands_public_key(): Promise<Record<string, any>>;
|
|
128
|
+
/** Get backup events from the energy gateway. May time out on some firmware versions. */
|
|
129
|
+
get_backup_events(): Promise<Record<string, any>>;
|
|
130
|
+
/**
|
|
131
|
+
* Schedule a manual backup event on the energy gateway.
|
|
132
|
+
* @param start_time ISO 8601 timestamp for when the backup event should start.
|
|
133
|
+
* @param duration_seconds Duration of the backup event in seconds.
|
|
134
|
+
* @param priority Priority level for the backup event. A string carries values beyond 2^53.
|
|
135
|
+
*/
|
|
136
|
+
schedule_backup_event(start_time?: string | null, duration_seconds?: number | null, priority?: number | string | null): Promise<Record<string, any>>;
|
|
137
|
+
/** Cancel a scheduled manual backup event on the energy gateway. */
|
|
138
|
+
cancel_backup_event(): Promise<Record<string, any>>;
|
|
139
|
+
/** Get Tesla Energy Gateway configuration from the TEG service. */
|
|
140
|
+
get_teg_config(): Promise<Record<string, any>>;
|
|
141
|
+
/**
|
|
142
|
+
* Request a timed battery power setpoint on the energy gateway.
|
|
143
|
+
*
|
|
144
|
+
* The gateway holds the setpoint for `duration_seconds`, then returns to its
|
|
145
|
+
* configured operating mode by itself. A new call replaces an active
|
|
146
|
+
* setpoint. Keep durations short and re-send to renew, so a caller that stops
|
|
147
|
+
* cannot leave the battery on a stale setpoint.
|
|
148
|
+
*
|
|
149
|
+
* The reply is an empty acknowledgement, not readback. A setpoint was seen to
|
|
150
|
+
* discharge below the backup reserve and to export with export set to
|
|
151
|
+
* `pv_only` or `never`. The gateway refuses a request above its power limit
|
|
152
|
+
* rather than clamping it: the signed path raises `DeviceUnexpectedResponse`
|
|
153
|
+
* with code 11.
|
|
154
|
+
*
|
|
155
|
+
* Tesla's cloud refuses this command unsigned (HTTP 400), so it acts only on
|
|
156
|
+
* a site with a signing key.
|
|
157
|
+
* @param power_watts Battery power in watts: positive discharges, negative charges.
|
|
158
|
+
* @param duration_seconds Whole seconds from 1 to 86400.
|
|
159
|
+
* @throws RangeError or TypeError before any request on invalid arguments.
|
|
160
|
+
*/
|
|
161
|
+
dispatch_battery_power(power_watts: number, duration_seconds: number): Promise<Record<string, any>>;
|
|
162
|
+
/**
|
|
163
|
+
* Release a `dispatch_battery_power` setpoint, returning the gateway to its
|
|
164
|
+
* configured operating mode. The gateway also acknowledges this when no
|
|
165
|
+
* setpoint is active. It acts only on a site with a signing key.
|
|
166
|
+
*/
|
|
167
|
+
resume_battery_operation(): Promise<Record<string, any>>;
|
|
168
|
+
/**
|
|
169
|
+
* Set the island mode on the energy gateway.
|
|
170
|
+
*
|
|
171
|
+
* Signed only: gateways acknowledge the unsigned `grpc_command` without
|
|
172
|
+
* operating the grid contactor, so this never sends one. A success-shaped
|
|
173
|
+
* reply still does not prove the contactor moved: confirm `island_status`
|
|
174
|
+
* with a status read before relying on it.
|
|
175
|
+
* @param mode `EnergyIslandMode.OFF_GRID` (6) or `ON_GRID` (1).
|
|
176
|
+
* @param force Sent when given. Some gateways need `true` to open the contactor.
|
|
177
|
+
* @throws TypeError on any other mode, before signing.
|
|
178
|
+
* @throws SignedCommandRequired without a signing key, before any request.
|
|
179
|
+
* @throws DeviceUnexpectedResponse when the gateway refuses, as `REJECTED_LOW_ENERGY` and the like.
|
|
180
|
+
*/
|
|
181
|
+
set_island_mode(mode: EnergyIslandMode | number, force?: boolean | null): Promise<Record<string, any>>;
|
|
182
|
+
/** Request off-grid mode, with `force`. Signed only: see `set_island_mode`. */
|
|
183
|
+
go_off_grid(): Promise<Record<string, any>>;
|
|
184
|
+
/** Request on-grid mode. Signed only: see `set_island_mode`. */
|
|
185
|
+
reconnect_grid(): Promise<Record<string, any>>;
|
|
8
186
|
/**
|
|
9
187
|
* Adjust the site's backup reserve.
|
|
10
188
|
* @param backup_reserve_percent The desired backup reserve percent.
|
|
@@ -13,33 +191,30 @@ declare class EnergySpecific {
|
|
|
13
191
|
backup(backup_reserve_percent: number): Promise<Record<string, any>>;
|
|
14
192
|
/**
|
|
15
193
|
* Returns the backup (off-grid) event history of the site in duration of seconds.
|
|
16
|
-
* @param
|
|
194
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
17
195
|
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
18
196
|
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
19
|
-
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
20
197
|
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
21
198
|
* @returns
|
|
22
199
|
*/
|
|
23
|
-
backup_history(
|
|
200
|
+
backup_history(period: TeslaEnergyPeriod | string | null, start_date?: string | null, end_date?: string | null, time_zone?: string | null): Promise<Record<string, any>>;
|
|
24
201
|
/**
|
|
25
202
|
* Returns the charging history of a wall connector.
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
203
|
+
* @param start_date Start date of the window to retrieve charging events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
204
|
+
* @param end_date End date of the window to retrieve charging events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
29
205
|
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
30
206
|
* @returns
|
|
31
207
|
*/
|
|
32
|
-
charge_history(
|
|
208
|
+
charge_history(start_date: string, end_date: string, time_zone?: string | null): Promise<Record<string, any>>;
|
|
33
209
|
/**
|
|
34
|
-
* Returns the energy
|
|
35
|
-
* @param
|
|
36
|
-
* @param start_date Start date of the window to retrieve
|
|
37
|
-
* @param end_date End date of the window to retrieve
|
|
38
|
-
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
210
|
+
* Returns the energy measurements of the site, aggregated to the requested period.
|
|
211
|
+
* @param period Period of the window to retrieve energy measurements. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
212
|
+
* @param start_date Start date of the window to retrieve energy measurements in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
213
|
+
* @param end_date End date of the window to retrieve energy measurements in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
39
214
|
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
40
215
|
* @returns
|
|
41
216
|
*/
|
|
42
|
-
energy_history(
|
|
217
|
+
energy_history(period: TeslaEnergyPeriod | string | null, start_date?: string | null, end_date?: string | null, time_zone?: string | null): Promise<Record<string, any>>;
|
|
43
218
|
/**
|
|
44
219
|
* Allow/disallow charging from the grid and exporting energy to the grid.
|
|
45
220
|
* @param disallow_charge_from_grid_with_solar_installed The desired behavior towards importing from the grid. Charging from the grid is disabled when set to true and enabled when set to false.
|
|
@@ -51,7 +226,7 @@ declare class EnergySpecific {
|
|
|
51
226
|
* Returns the live status of the site.
|
|
52
227
|
* @returns
|
|
53
228
|
*/
|
|
54
|
-
live_status(): Promise<LiveStatusResponse
|
|
229
|
+
live_status(): Promise<ResponseEnvelope<LiveStatusResponse>>;
|
|
55
230
|
/**
|
|
56
231
|
* Adjust the site's off-grid vehicle charging backup reserve.
|
|
57
232
|
* @param off_grid_vehicle_charging_reserve_percent The desired off grid vehicle charging reserve percent.
|
|
@@ -67,12 +242,17 @@ declare class EnergySpecific {
|
|
|
67
242
|
/**
|
|
68
243
|
* Returns information about the site. Things like assets (has solar, etc), settings (backup reserve, etc), and features (storm_mode_capable, etc).
|
|
69
244
|
*/
|
|
70
|
-
site_info(): Promise<SiteInfoResponse
|
|
245
|
+
site_info(): Promise<ResponseEnvelope<SiteInfoResponse>>;
|
|
71
246
|
/**
|
|
72
247
|
* Update storm watch participation.
|
|
73
248
|
* @param enabled The storm mode participation value to set.
|
|
74
249
|
* @returns
|
|
75
250
|
*/
|
|
76
251
|
storm_mode(enabled: boolean): Promise<Record<string, any>>;
|
|
77
|
-
|
|
78
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Update the time of use settings for the energy site.
|
|
254
|
+
* @param settings The `tariff_content_v2` document.
|
|
255
|
+
* @returns
|
|
256
|
+
*/
|
|
257
|
+
time_of_use_settings(settings: Record<string, any>): Promise<Record<string, any>>;
|
|
258
|
+
}
|
|
@@ -1,10 +1,188 @@
|
|
|
1
|
+
import { AuthorizedClientKeyType, AuthorizedClientType, EnergyDeviceIdentifierType, EnergyIslandMode, TeslaEnergyPeriod } from "./const.mjs";
|
|
1
2
|
import Energy from "./energy.mjs";
|
|
2
3
|
import { LiveStatusResponse } from "./types/live_status.mjs";
|
|
4
|
+
import { ResponseEnvelope } from "./types/responses.mjs";
|
|
3
5
|
import { SiteInfoResponse } from "./types/site_info.mjs";
|
|
6
|
+
import { KeyObject } from "crypto";
|
|
7
|
+
/**
|
|
8
|
+
* The only device commands Tesla's cloud accepts unsigned, as
|
|
9
|
+
* `category.command`: the reads a gateway answers before any key is paired.
|
|
10
|
+
* Unsigned, every other command was refused with HTTP 400 live on a Powerwall 3
|
|
11
|
+
* (2026-10-29), and signed, each one reached the gateway. A site with a signing
|
|
12
|
+
* key signs everything else.
|
|
13
|
+
*/
|
|
14
|
+
export declare const UNSIGNED_DEVICE_COMMANDS: ReadonlySet<string>;
|
|
15
|
+
/** Upper bound on a `dispatch_battery_power` setpoint duration (one day). */
|
|
16
|
+
export declare const MAX_DISPATCH_DURATION_SECONDS = 86400;
|
|
17
|
+
/**
|
|
18
|
+
* Check `dispatch_battery_power` arguments before any request.
|
|
19
|
+
* @throws TypeError unless both are numbers.
|
|
20
|
+
* @throws RangeError on a non-finite power or a duration that is not a whole number from 1 to `MAX_DISPATCH_DURATION_SECONDS`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validate_dispatch_battery_power(power_watts: number, duration_seconds: number): void;
|
|
4
23
|
export default class EnergySpecific {
|
|
24
|
+
#private;
|
|
5
25
|
parent: Energy;
|
|
6
26
|
energy_site_id: number;
|
|
7
|
-
|
|
27
|
+
/** Gateway DIN (the energy site's `gateway_id` in `products`), the target of device commands. */
|
|
28
|
+
din?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Pass `private_key` and `din` to send client-signed device commands through
|
|
31
|
+
* the cloud `device_command` endpoint. With a signer, every device command is
|
|
32
|
+
* signed except the four pre-pairing reads in `UNSIGNED_DEVICE_COMMANDS`.
|
|
33
|
+
* Without one, device commands are sent unsigned, and Tesla's cloud refuses
|
|
34
|
+
* most of them with 400.
|
|
35
|
+
* @param parent
|
|
36
|
+
* @param energy_site_id
|
|
37
|
+
* @param private_key RSA key `VERIFIED` on this gateway. Without one the site is unsigned: unlike vehicles, there is no fallback to the parent's key.
|
|
38
|
+
* @param din Gateway DIN (the energy site's `gateway_id` in `products`). Required with `private_key`.
|
|
39
|
+
* @throws TypeError for a key that is not RSA.
|
|
40
|
+
*/
|
|
41
|
+
constructor(parent: Energy, energy_site_id: number, private_key?: KeyObject, din?: string);
|
|
42
|
+
/** Whether device commands are signed with a client key. */
|
|
43
|
+
get signing(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Send a gRPC command to the energy device gateway.
|
|
46
|
+
*
|
|
47
|
+
* With a signing key, this signs every command except the ones in
|
|
48
|
+
* `UNSIGNED_DEVICE_COMMANDS`. Otherwise it sends the unsigned `grpc_command`.
|
|
49
|
+
* Energy device gRPC commands are based on research from
|
|
50
|
+
* https://github.com/jasonacox/pypowerwall (MIT licensed).
|
|
51
|
+
*/
|
|
52
|
+
_command(category: string, command: string, params?: Record<string, any> | null, identifier_type?: EnergyDeviceIdentifierType): Promise<Record<string, any>>;
|
|
53
|
+
/** Send an unsigned `grpc_command` to the energy device gateway. */
|
|
54
|
+
_unsigned_command(category: string, command: string, params?: Record<string, any> | null, identifier_type?: EnergyDeviceIdentifierType): Promise<Record<string, any>>;
|
|
55
|
+
/** Build the flat `device_command` body around a signed message. */
|
|
56
|
+
protected _device_command_body(routable_message: Uint8Array, target_id: string, identifier_type: EnergyDeviceIdentifierType): Record<string, any>;
|
|
57
|
+
/**
|
|
58
|
+
* Send a signed `RoutableMessage` to the energy device. Tesla requires the
|
|
59
|
+
* body wrapped in `data` and `identifier_type` as an integer. The reply is
|
|
60
|
+
* returned unchanged; `_signed_command` checks it for a gateway error.
|
|
61
|
+
*/
|
|
62
|
+
_device_command(routable_message: Uint8Array, target_id: string, identifier_type?: EnergyDeviceIdentifierType): Promise<Record<string, any>>;
|
|
63
|
+
/**
|
|
64
|
+
* Sign a gRPC command with the site's key and send it to the gateway.
|
|
65
|
+
*
|
|
66
|
+
* A resend of the same signed bytes inside the TTL executes again, so this
|
|
67
|
+
* never retries.
|
|
68
|
+
* @throws SignedCommandRequired when the site has no signing key.
|
|
69
|
+
* @throws InvalidCommand when the gateway firmware has no handler for the command.
|
|
70
|
+
* @throws DeviceUnexpectedResponse when the gateway refuses the command.
|
|
71
|
+
*/
|
|
72
|
+
_signed_command(category: string, command: string, params?: Record<string, any> | null): Promise<Record<string, any>>;
|
|
73
|
+
/** Get energy device system information including firmware version, device type, part number, serial number, and DIN. */
|
|
74
|
+
get_system_info(): Promise<Record<string, any>>;
|
|
75
|
+
/** Get raw energy device networking status including WiFi, Ethernet, and cellular connectivity. */
|
|
76
|
+
raw_networking_status(): Promise<Record<string, any>>;
|
|
77
|
+
/** Get energy device networking status including WiFi, Ethernet, and cellular connectivity. */
|
|
78
|
+
get_networking_status(): Promise<Record<string, any>>;
|
|
79
|
+
/** Scan for available WiFi networks from the energy gateway. */
|
|
80
|
+
wifi_scan(): Promise<Record<string, any>>;
|
|
81
|
+
/** Get the energy device certificate including subject, issuer, and validity. */
|
|
82
|
+
get_device_cert(): Promise<Record<string, any>>;
|
|
83
|
+
/** Get cellular modem information from the energy gateway including the embedded SIM identifier (EID) and supported cellular profiles. */
|
|
84
|
+
get_cellular_info(): Promise<Record<string, any>>;
|
|
85
|
+
/** Check if a firmware update is available for the energy gateway. */
|
|
86
|
+
check_for_update(): Promise<Record<string, any>>;
|
|
87
|
+
/** Check the urgency level of any available firmware update for the energy gateway. */
|
|
88
|
+
check_for_update_urgency(): Promise<Record<string, any>>;
|
|
89
|
+
/** Test internet connectivity on the energy gateway across all network interfaces (WiFi, Ethernet, GSM). */
|
|
90
|
+
check_internet(): Promise<Record<string, any>>;
|
|
91
|
+
/**
|
|
92
|
+
* Update local site configuration on the energy gateway. This writes gateway
|
|
93
|
+
* configuration and is an undocumented energy device gRPC command.
|
|
94
|
+
* @param params Raw protobuf request fields.
|
|
95
|
+
*/
|
|
96
|
+
set_local_site_config(params?: Record<string, any> | null): Promise<Record<string, any>>;
|
|
97
|
+
/** List authorized clients (paired keys) on the energy gateway including their roles and state. */
|
|
98
|
+
list_authorized_clients(): Promise<Record<string, any>>;
|
|
99
|
+
/**
|
|
100
|
+
* Register an authorized client (public key) with the energy gateway, to
|
|
101
|
+
* pair a local key with a Powerwall for the LAN TEDapi v1r protocol. The
|
|
102
|
+
* encoding follows `key_type`: RSA is raw PKCS#1 `RSAPublicKey` DER
|
|
103
|
+
* (`rsa_public_der_pkcs1`), and ECC is DER SubjectPublicKeyInfo
|
|
104
|
+
* (`ec_public_der_spki`), not a raw point, which the gateway rejects. A
|
|
105
|
+
* VERIFIED ECC key still cannot sign v1r: `SignatureData` has no ECDSA member.
|
|
106
|
+
*
|
|
107
|
+
* The key stays PENDING_VERIFICATION until a physical breaker toggle confirms
|
|
108
|
+
* it inside a window of about 9 minutes. A missed window is the terminal
|
|
109
|
+
* PENDING_VERIFICATION_TIMEOUT; registering the same key again resets it
|
|
110
|
+
* without a second record.
|
|
111
|
+
* @param public_key Raw DER bytes, which are base64-encoded, or an already base64-encoded string.
|
|
112
|
+
* @param description Human-readable description of the client.
|
|
113
|
+
* @param key_type The type of key being registered.
|
|
114
|
+
* @param authorized_client_type The authorized client type.
|
|
115
|
+
*/
|
|
116
|
+
add_authorized_client(public_key: Uint8Array | string, description?: string, key_type?: AuthorizedClientKeyType, authorized_client_type?: AuthorizedClientType): Promise<Record<string, any>>;
|
|
117
|
+
/**
|
|
118
|
+
* Remove an authorized client (public key) from the energy gateway. Removal
|
|
119
|
+
* needs no physical presence proof, so any paired key can revoke every other
|
|
120
|
+
* key, including the owner's. The reply is empty, and some firmware may
|
|
121
|
+
* return no body at all. This cloud route is inferred from
|
|
122
|
+
* `add_authorized_client`; removal was only live-verified over local v1r.
|
|
123
|
+
* @param public_key Raw DER bytes, which are base64-encoded, or an already base64-encoded string as `list_authorized_clients` reports it.
|
|
124
|
+
*/
|
|
125
|
+
remove_authorized_client(public_key: Uint8Array | string): Promise<Record<string, any>>;
|
|
126
|
+
/** Get the energy gateway's public key for signed commands. */
|
|
127
|
+
get_signed_commands_public_key(): Promise<Record<string, any>>;
|
|
128
|
+
/** Get backup events from the energy gateway. May time out on some firmware versions. */
|
|
129
|
+
get_backup_events(): Promise<Record<string, any>>;
|
|
130
|
+
/**
|
|
131
|
+
* Schedule a manual backup event on the energy gateway.
|
|
132
|
+
* @param start_time ISO 8601 timestamp for when the backup event should start.
|
|
133
|
+
* @param duration_seconds Duration of the backup event in seconds.
|
|
134
|
+
* @param priority Priority level for the backup event. A string carries values beyond 2^53.
|
|
135
|
+
*/
|
|
136
|
+
schedule_backup_event(start_time?: string | null, duration_seconds?: number | null, priority?: number | string | null): Promise<Record<string, any>>;
|
|
137
|
+
/** Cancel a scheduled manual backup event on the energy gateway. */
|
|
138
|
+
cancel_backup_event(): Promise<Record<string, any>>;
|
|
139
|
+
/** Get Tesla Energy Gateway configuration from the TEG service. */
|
|
140
|
+
get_teg_config(): Promise<Record<string, any>>;
|
|
141
|
+
/**
|
|
142
|
+
* Request a timed battery power setpoint on the energy gateway.
|
|
143
|
+
*
|
|
144
|
+
* The gateway holds the setpoint for `duration_seconds`, then returns to its
|
|
145
|
+
* configured operating mode by itself. A new call replaces an active
|
|
146
|
+
* setpoint. Keep durations short and re-send to renew, so a caller that stops
|
|
147
|
+
* cannot leave the battery on a stale setpoint.
|
|
148
|
+
*
|
|
149
|
+
* The reply is an empty acknowledgement, not readback. A setpoint was seen to
|
|
150
|
+
* discharge below the backup reserve and to export with export set to
|
|
151
|
+
* `pv_only` or `never`. The gateway refuses a request above its power limit
|
|
152
|
+
* rather than clamping it: the signed path raises `DeviceUnexpectedResponse`
|
|
153
|
+
* with code 11.
|
|
154
|
+
*
|
|
155
|
+
* Tesla's cloud refuses this command unsigned (HTTP 400), so it acts only on
|
|
156
|
+
* a site with a signing key.
|
|
157
|
+
* @param power_watts Battery power in watts: positive discharges, negative charges.
|
|
158
|
+
* @param duration_seconds Whole seconds from 1 to 86400.
|
|
159
|
+
* @throws RangeError or TypeError before any request on invalid arguments.
|
|
160
|
+
*/
|
|
161
|
+
dispatch_battery_power(power_watts: number, duration_seconds: number): Promise<Record<string, any>>;
|
|
162
|
+
/**
|
|
163
|
+
* Release a `dispatch_battery_power` setpoint, returning the gateway to its
|
|
164
|
+
* configured operating mode. The gateway also acknowledges this when no
|
|
165
|
+
* setpoint is active. It acts only on a site with a signing key.
|
|
166
|
+
*/
|
|
167
|
+
resume_battery_operation(): Promise<Record<string, any>>;
|
|
168
|
+
/**
|
|
169
|
+
* Set the island mode on the energy gateway.
|
|
170
|
+
*
|
|
171
|
+
* Signed only: gateways acknowledge the unsigned `grpc_command` without
|
|
172
|
+
* operating the grid contactor, so this never sends one. A success-shaped
|
|
173
|
+
* reply still does not prove the contactor moved: confirm `island_status`
|
|
174
|
+
* with a status read before relying on it.
|
|
175
|
+
* @param mode `EnergyIslandMode.OFF_GRID` (6) or `ON_GRID` (1).
|
|
176
|
+
* @param force Sent when given. Some gateways need `true` to open the contactor.
|
|
177
|
+
* @throws TypeError on any other mode, before signing.
|
|
178
|
+
* @throws SignedCommandRequired without a signing key, before any request.
|
|
179
|
+
* @throws DeviceUnexpectedResponse when the gateway refuses, as `REJECTED_LOW_ENERGY` and the like.
|
|
180
|
+
*/
|
|
181
|
+
set_island_mode(mode: EnergyIslandMode | number, force?: boolean | null): Promise<Record<string, any>>;
|
|
182
|
+
/** Request off-grid mode, with `force`. Signed only: see `set_island_mode`. */
|
|
183
|
+
go_off_grid(): Promise<Record<string, any>>;
|
|
184
|
+
/** Request on-grid mode. Signed only: see `set_island_mode`. */
|
|
185
|
+
reconnect_grid(): Promise<Record<string, any>>;
|
|
8
186
|
/**
|
|
9
187
|
* Adjust the site's backup reserve.
|
|
10
188
|
* @param backup_reserve_percent The desired backup reserve percent.
|
|
@@ -13,33 +191,30 @@ export default class EnergySpecific {
|
|
|
13
191
|
backup(backup_reserve_percent: number): Promise<Record<string, any>>;
|
|
14
192
|
/**
|
|
15
193
|
* Returns the backup (off-grid) event history of the site in duration of seconds.
|
|
16
|
-
* @param
|
|
194
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
17
195
|
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
18
196
|
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
19
|
-
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
20
197
|
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
21
198
|
* @returns
|
|
22
199
|
*/
|
|
23
|
-
backup_history(
|
|
200
|
+
backup_history(period: TeslaEnergyPeriod | string | null, start_date?: string | null, end_date?: string | null, time_zone?: string | null): Promise<Record<string, any>>;
|
|
24
201
|
/**
|
|
25
202
|
* Returns the charging history of a wall connector.
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
203
|
+
* @param start_date Start date of the window to retrieve charging events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
204
|
+
* @param end_date End date of the window to retrieve charging events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
29
205
|
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
30
206
|
* @returns
|
|
31
207
|
*/
|
|
32
|
-
charge_history(
|
|
208
|
+
charge_history(start_date: string, end_date: string, time_zone?: string | null): Promise<Record<string, any>>;
|
|
33
209
|
/**
|
|
34
|
-
* Returns the energy
|
|
35
|
-
* @param
|
|
36
|
-
* @param start_date Start date of the window to retrieve
|
|
37
|
-
* @param end_date End date of the window to retrieve
|
|
38
|
-
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
210
|
+
* Returns the energy measurements of the site, aggregated to the requested period.
|
|
211
|
+
* @param period Period of the window to retrieve energy measurements. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
212
|
+
* @param start_date Start date of the window to retrieve energy measurements in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
213
|
+
* @param end_date End date of the window to retrieve energy measurements in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
39
214
|
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
40
215
|
* @returns
|
|
41
216
|
*/
|
|
42
|
-
energy_history(
|
|
217
|
+
energy_history(period: TeslaEnergyPeriod | string | null, start_date?: string | null, end_date?: string | null, time_zone?: string | null): Promise<Record<string, any>>;
|
|
43
218
|
/**
|
|
44
219
|
* Allow/disallow charging from the grid and exporting energy to the grid.
|
|
45
220
|
* @param disallow_charge_from_grid_with_solar_installed The desired behavior towards importing from the grid. Charging from the grid is disabled when set to true and enabled when set to false.
|
|
@@ -51,7 +226,7 @@ export default class EnergySpecific {
|
|
|
51
226
|
* Returns the live status of the site.
|
|
52
227
|
* @returns
|
|
53
228
|
*/
|
|
54
|
-
live_status(): Promise<LiveStatusResponse
|
|
229
|
+
live_status(): Promise<ResponseEnvelope<LiveStatusResponse>>;
|
|
55
230
|
/**
|
|
56
231
|
* Adjust the site's off-grid vehicle charging backup reserve.
|
|
57
232
|
* @param off_grid_vehicle_charging_reserve_percent The desired off grid vehicle charging reserve percent.
|
|
@@ -67,11 +242,17 @@ export default class EnergySpecific {
|
|
|
67
242
|
/**
|
|
68
243
|
* Returns information about the site. Things like assets (has solar, etc), settings (backup reserve, etc), and features (storm_mode_capable, etc).
|
|
69
244
|
*/
|
|
70
|
-
site_info(): Promise<SiteInfoResponse
|
|
245
|
+
site_info(): Promise<ResponseEnvelope<SiteInfoResponse>>;
|
|
71
246
|
/**
|
|
72
247
|
* Update storm watch participation.
|
|
73
248
|
* @param enabled The storm mode participation value to set.
|
|
74
249
|
* @returns
|
|
75
250
|
*/
|
|
76
251
|
storm_mode(enabled: boolean): Promise<Record<string, any>>;
|
|
252
|
+
/**
|
|
253
|
+
* Update the time of use settings for the energy site.
|
|
254
|
+
* @param settings The `tariff_content_v2` document.
|
|
255
|
+
* @returns
|
|
256
|
+
*/
|
|
257
|
+
time_of_use_settings(settings: Record<string, any>): Promise<Record<string, any>>;
|
|
77
258
|
}
|