yoto-nodejs-client 0.0.1 → 0.0.2
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/bin/lib/cli-helpers.d.ts +32 -0
- package/bin/lib/cli-helpers.d.ts.map +1 -1
- package/bin/lib/token-helpers.d.ts +32 -0
- package/bin/lib/token-helpers.d.ts.map +1 -1
- package/index.d.ts +368 -0
- package/index.d.ts.map +1 -1
- package/lib/api-endpoints/auth.d.ts +85 -0
- package/lib/api-endpoints/auth.d.ts.map +1 -1
- package/lib/api-endpoints/constants.d.ts +22 -0
- package/lib/api-endpoints/constants.d.ts.map +1 -1
- package/lib/api-endpoints/content.d.ts +760 -0
- package/lib/api-endpoints/content.d.ts.map +1 -1
- package/lib/api-endpoints/devices.d.ts +581 -0
- package/lib/api-endpoints/devices.d.ts.map +1 -1
- package/lib/api-endpoints/family-library-groups.d.ts +187 -0
- package/lib/api-endpoints/family-library-groups.d.ts.map +1 -1
- package/lib/api-endpoints/family.d.ts +88 -0
- package/lib/api-endpoints/family.d.ts.map +1 -1
- package/lib/api-endpoints/helpers.d.ts +37 -3
- package/lib/api-endpoints/helpers.d.ts.map +1 -1
- package/lib/api-endpoints/icons.d.ts +196 -0
- package/lib/api-endpoints/icons.d.ts.map +1 -1
- package/lib/api-endpoints/media.d.ts +83 -0
- package/lib/api-endpoints/media.d.ts.map +1 -1
- package/lib/api-endpoints/test-helpers.d.ts +21 -0
- package/lib/api-endpoints/test-helpers.d.ts.map +1 -1
- package/lib/mqtt/client.d.ts +277 -0
- package/lib/mqtt/client.d.ts.map +1 -1
- package/lib/mqtt/commands.d.ts +195 -0
- package/lib/mqtt/commands.d.ts.map +1 -1
- package/lib/mqtt/factory.d.ts +43 -0
- package/lib/mqtt/factory.d.ts.map +1 -1
- package/lib/mqtt/topics.d.ts +157 -0
- package/lib/mqtt/topics.d.ts.map +1 -1
- package/lib/token.d.ts +88 -0
- package/lib/token.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://yoto.dev/api/getdevices/
|
|
3
|
+
* @typedef {Object} YotoDevicesResponse
|
|
4
|
+
* @property {YotoDevice[]} devices
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @see https://yoto.dev/api/getdevices/
|
|
8
|
+
* @typedef {Object} YotoDevice
|
|
9
|
+
* @property {string} deviceId - The unique identifier for the device
|
|
10
|
+
* @property {string} name - The name of the device
|
|
11
|
+
* @property {string} description - A brief description of the device
|
|
12
|
+
* @property {boolean} online - Indicates whether the device is currently online
|
|
13
|
+
* @property {string} releaseChannel - The release channel of the device
|
|
14
|
+
* @property {string} deviceType - The type of the device
|
|
15
|
+
* @property {string} deviceFamily - The family to which the device belongs
|
|
16
|
+
* @property {string} deviceGroup - The group classification of the device
|
|
17
|
+
* @property {string} [generation] - Device generation (e.g., 'gen3')
|
|
18
|
+
* @property {string} [formFactor] - Device form factor (e.g., 'standard', 'mini')
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the list of devices associated with the authenticated user.
|
|
22
|
+
* @see https://yoto.dev/api/getdevices/
|
|
23
|
+
* @param {object} options
|
|
24
|
+
* @param {string} options.accessToken The API token to request with
|
|
25
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
26
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
27
|
+
* @return {Promise<YotoDevicesResponse>} The user's devices
|
|
28
|
+
*/
|
|
1
29
|
export function getDevices({ accessToken, userAgent, requestOptions }: {
|
|
2
30
|
accessToken: string;
|
|
3
31
|
userAgent?: string | undefined;
|
|
@@ -5,6 +33,53 @@ export function getDevices({ accessToken, userAgent, requestOptions }: {
|
|
|
5
33
|
dispatcher?: import("undici").Dispatcher;
|
|
6
34
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
7
35
|
}): Promise<YotoDevicesResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* @see https://yoto.dev/api/getdevicestatus/
|
|
38
|
+
* @typedef {Object} YotoDeviceStatusResponse
|
|
39
|
+
* @property {string} deviceId - Unique identifier of the device
|
|
40
|
+
* @property {string} [activeCard] - Active card on the device (can be 'none')
|
|
41
|
+
* @property {number} [ambientLightSensorReading] - Reading from ambient light sensor
|
|
42
|
+
* @property {number} [averageDownloadSpeedBytesSecond] - Average download speed in bytes per second
|
|
43
|
+
* @property {number} [batteryLevelPercentage] - Battery level in percentage
|
|
44
|
+
* @property {number} [batteryLevelPercentageRaw] - Raw battery level percentage
|
|
45
|
+
* @property {number} [buzzErrors] - Number of buzz errors
|
|
46
|
+
* @property {0 | 1 | 2} [cardInsertionState] - Card insertion state (0=none, 1=physical, 2=remote)
|
|
47
|
+
* @property {-1 | 0 | 1} [dayMode] - Day mode status (-1=unknown, 0=night, 1=day)
|
|
48
|
+
* @property {number} [errorsLogged] - Number of errors logged
|
|
49
|
+
* @property {string} [firmwareVersion] - Firmware version (e.g., 'v2.23.2')
|
|
50
|
+
* @property {number} [freeDiskSpaceBytes] - Free disk space in bytes
|
|
51
|
+
* @property {boolean} [isAudioDeviceConnected] - Whether audio device is connected
|
|
52
|
+
* @property {boolean} [isBackgroundDownloadActive] - Whether background download is active
|
|
53
|
+
* @property {boolean} [isBluetoothAudioConnected] - Whether Bluetooth audio is connected
|
|
54
|
+
* @property {boolean} [isCharging] - Whether device is currently charging
|
|
55
|
+
* @property {number} [isNfcLocked] - NFC lock status
|
|
56
|
+
* @property {boolean} [isOnline] - Whether device is currently online
|
|
57
|
+
* @property {string} [networkSsid] - Network SSID device is connected to
|
|
58
|
+
* @property {string} [nightlightMode] - Nightlight mode (hex code or 'off')
|
|
59
|
+
* @property {number} [playingSource] - Currently playing source
|
|
60
|
+
* @property {string | null} [powerCapabilities] - Power capabilities (e.g., '0x02')
|
|
61
|
+
* @property {0 | 1 | 2 | 3} [powerSource] - Power source (0=battery, 1=V2 dock, 2=USB-C, 3=Qi)
|
|
62
|
+
* @property {number} [systemVolumePercentage] - System volume in percentage
|
|
63
|
+
* @property {number} [taskWatchdogTimeoutCount] - Task watchdog timeout count
|
|
64
|
+
* @property {number | string} [temperatureCelcius] - Temperature in Celsius (can be number, string like "0", or "notSupported")
|
|
65
|
+
* @property {number} [totalDiskSpaceBytes] - Total disk space in bytes
|
|
66
|
+
* @property {string} [updatedAt] - Timestamp of last update
|
|
67
|
+
* @property {number} [uptime] - Uptime of the device in seconds
|
|
68
|
+
* @property {number} [userVolumePercentage] - User volume in percentage
|
|
69
|
+
* @property {number} [utcOffsetSeconds] - UTC offset in seconds
|
|
70
|
+
* @property {number} [utcTime] - UTC time as Unix timestamp
|
|
71
|
+
* @property {number} [wifiStrength] - WiFi connection strength in decibels
|
|
72
|
+
*/
|
|
73
|
+
/**
|
|
74
|
+
* Retrieves the current status of a specific device.
|
|
75
|
+
* @see https://yoto.dev/api/getdevicestatus/
|
|
76
|
+
* @param {object} options
|
|
77
|
+
* @param {string} options.accessToken The API token to request with
|
|
78
|
+
* @param {string} options.deviceId The device ID to get status for
|
|
79
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
80
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
81
|
+
* @return {Promise<YotoDeviceStatusResponse>} The device status
|
|
82
|
+
*/
|
|
8
83
|
export function getDeviceStatus({ accessToken, userAgent, deviceId, requestOptions }: {
|
|
9
84
|
accessToken: string;
|
|
10
85
|
deviceId: string;
|
|
@@ -13,6 +88,110 @@ export function getDeviceStatus({ accessToken, userAgent, deviceId, requestOptio
|
|
|
13
88
|
dispatcher?: import("undici").Dispatcher;
|
|
14
89
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
15
90
|
}): Promise<YotoDeviceStatusResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* @see https://yoto.dev/api/getdeviceconfig/
|
|
93
|
+
* @typedef {Object} YotoDeviceConfigResponse
|
|
94
|
+
* @property {YotoDeviceConfigDevice} device
|
|
95
|
+
*/
|
|
96
|
+
/**
|
|
97
|
+
* @see https://yoto.dev/api/getdeviceconfig/
|
|
98
|
+
* @typedef {Object} YotoDeviceConfigDevice
|
|
99
|
+
* @property {YotoDeviceConfig} config - Device configuration settings
|
|
100
|
+
* @property {string} deviceFamily - Device family (e.g., 'v2', 'v3', 'mini')
|
|
101
|
+
* @property {string} deviceGroup - Device group classification
|
|
102
|
+
* @property {string} deviceId - Unique identifier for the device
|
|
103
|
+
* @property {string} deviceType - Type of device
|
|
104
|
+
* @property {any} errorCode - Error code (null if no error)
|
|
105
|
+
* @property {string} geoTimezone - Geographic timezone (e.g., 'Europe/London')
|
|
106
|
+
* @property {string} getPosix - POSIX timezone string
|
|
107
|
+
* @property {string} mac - MAC address
|
|
108
|
+
* @property {string} name - Device name (undocumented)
|
|
109
|
+
* @property {boolean} online - Whether device is online
|
|
110
|
+
* @property {string} registrationCode - Device registration code
|
|
111
|
+
* @property {string} activationPopCode - Activation POP code (undocumented)
|
|
112
|
+
* @property {string} popCode - POP code (undocumented)
|
|
113
|
+
* @property {string} releaseChannelId - Release channel identifier
|
|
114
|
+
* @property {string} releaseChannelVersion - Release channel version
|
|
115
|
+
* @property {string} fwVersion - Firmware version (undocumented)
|
|
116
|
+
* @property {any} [status] - Device status object (undocumented)
|
|
117
|
+
* @property {YotoDeviceShortcuts} [shortcuts] - Button shortcuts configuration (beta feature)
|
|
118
|
+
*/
|
|
119
|
+
/**
|
|
120
|
+
* @see https://yoto.dev/api/getdeviceconfig/
|
|
121
|
+
* @typedef {Object} YotoDeviceConfig
|
|
122
|
+
* @property {string[]} [alarms] - Array of alarm strings in comma-separated format (e.g., '1111111,1100,5WsQg,,,8')
|
|
123
|
+
* @property {string} ambientColour - Ambient light color (hex code)
|
|
124
|
+
* @property {string} bluetoothEnabled - Bluetooth enabled state ('0' or '1')
|
|
125
|
+
* @property {boolean} btHeadphonesEnabled - Bluetooth headphones enabled
|
|
126
|
+
* @property {string} [clockFace] - Clock face style (e.g., 'digital-sun')
|
|
127
|
+
* @property {string} dayDisplayBrightness - Day display brightness (e.g., 'auto')
|
|
128
|
+
* @property {string} dayTime - Day mode start time (e.g., '07:30')
|
|
129
|
+
* @property {string} dayYotoDaily - Day mode Yoto Daily card path
|
|
130
|
+
* @property {string} dayYotoRadio - Day mode Yoto Radio card path
|
|
131
|
+
* @property {string} [daySoundsOff] - Day sounds off setting (undocumented)
|
|
132
|
+
* @property {string} [displayDimBrightness] - Display dim brightness level
|
|
133
|
+
* @property {string} displayDimTimeout - Display dim timeout in seconds
|
|
134
|
+
* @property {boolean} headphonesVolumeLimited - Whether headphones volume is limited
|
|
135
|
+
* @property {string} [hourFormat] - Hour format ('12' or '24')
|
|
136
|
+
* @property {string} [logLevel] - Log level (e.g., 'none') (undocumented)
|
|
137
|
+
* @property {string} [locale] - Device locale (e.g., 'en') (undocumented)
|
|
138
|
+
* @property {string} maxVolumeLimit - Maximum volume limit
|
|
139
|
+
* @property {string} nightAmbientColour - Night ambient light color (hex code)
|
|
140
|
+
* @property {string} nightDisplayBrightness - Night display brightness
|
|
141
|
+
* @property {string} nightMaxVolumeLimit - Night maximum volume limit
|
|
142
|
+
* @property {string} nightTime - Night mode start time (e.g., '19:30')
|
|
143
|
+
* @property {string} nightYotoDaily - Night mode Yoto Daily card path
|
|
144
|
+
* @property {string} nightYotoRadio - Night mode Yoto Radio card path
|
|
145
|
+
* @property {string} [nightSoundsOff] - Night sounds off setting (undocumented)
|
|
146
|
+
* @property {boolean} [pausePowerButton] - Pause on power button press (undocumented)
|
|
147
|
+
* @property {boolean} [pauseVolumeDown] - Pause on volume down (undocumented)
|
|
148
|
+
* @property {boolean} repeatAll - Whether repeat all is enabled
|
|
149
|
+
* @property {boolean} [showDiagnostics] - Show diagnostics (undocumented)
|
|
150
|
+
* @property {string} shutdownTimeout - Shutdown timeout in seconds
|
|
151
|
+
* @property {string} [systemVolume] - System volume level (undocumented)
|
|
152
|
+
* @property {string} [timezone] - Timezone setting (undocumented)
|
|
153
|
+
* @property {string} [volumeLevel] - Volume level preset (e.g., 'safe')
|
|
154
|
+
*/
|
|
155
|
+
/**
|
|
156
|
+
* @see https://yoto.dev/api/getdeviceconfig/
|
|
157
|
+
* @typedef {Object} YotoDeviceShortcuts
|
|
158
|
+
* @property {YotoShortcutModes} modes - Shortcut modes for day and night
|
|
159
|
+
* @property {string} versionId - Shortcuts configuration version ID
|
|
160
|
+
*/
|
|
161
|
+
/**
|
|
162
|
+
* @see https://yoto.dev/api/getdeviceconfig/
|
|
163
|
+
* @typedef {Object} YotoShortcutModes
|
|
164
|
+
* @property {YotoShortcutMode} day - Day mode shortcuts
|
|
165
|
+
* @property {YotoShortcutMode} night - Night mode shortcuts
|
|
166
|
+
*/
|
|
167
|
+
/**
|
|
168
|
+
* @see https://yoto.dev/api/getdeviceconfig/
|
|
169
|
+
* @typedef {Object} YotoShortcutMode
|
|
170
|
+
* @property {YotoShortcutContent[]} content - Array of shortcut content commands
|
|
171
|
+
*/
|
|
172
|
+
/**
|
|
173
|
+
* @see https://yoto.dev/api/getdeviceconfig/
|
|
174
|
+
* @typedef {Object} YotoShortcutContent
|
|
175
|
+
* @property {string} cmd - Command type (e.g., 'track-play')
|
|
176
|
+
* @property {YotoShortcutParams} params - Command parameters
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* @see https://yoto.dev/api/getdeviceconfig/
|
|
180
|
+
* @typedef {Object} YotoShortcutParams
|
|
181
|
+
* @property {string} card - Card ID
|
|
182
|
+
* @property {string} chapter - Chapter identifier
|
|
183
|
+
* @property {string} track - Track identifier
|
|
184
|
+
*/
|
|
185
|
+
/**
|
|
186
|
+
* Retrieves the configuration details for a specific device.
|
|
187
|
+
* @see https://yoto.dev/api/getdeviceconfig/
|
|
188
|
+
* @param {object} options
|
|
189
|
+
* @param {string} options.accessToken The API token to request with
|
|
190
|
+
* @param {string} options.deviceId The device ID to get config for
|
|
191
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
192
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
193
|
+
* @return {Promise<YotoDeviceConfigResponse>} The device configuration
|
|
194
|
+
*/
|
|
16
195
|
export function getDeviceConfig({ accessToken, userAgent, deviceId, requestOptions }: {
|
|
17
196
|
accessToken: string;
|
|
18
197
|
deviceId: string;
|
|
@@ -21,6 +200,28 @@ export function getDeviceConfig({ accessToken, userAgent, deviceId, requestOptio
|
|
|
21
200
|
dispatcher?: import("undici").Dispatcher;
|
|
22
201
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
23
202
|
}): Promise<YotoDeviceConfigResponse>;
|
|
203
|
+
/**
|
|
204
|
+
* @see https://yoto.dev/api/updatedeviceconfig/
|
|
205
|
+
* @typedef {Object} YotoUpdateDeviceConfigRequest
|
|
206
|
+
* @property {string} [name] - Device name
|
|
207
|
+
* @property {Partial<YotoDeviceConfig>} config - Configuration settings to update (all fields optional)
|
|
208
|
+
*/
|
|
209
|
+
/**
|
|
210
|
+
* @see https://yoto.dev/api/updatedeviceconfig/
|
|
211
|
+
* @typedef {Object} YotoUpdateDeviceConfigResponse
|
|
212
|
+
* @property {string} status - Status of the update operation (e.g., 'ok')
|
|
213
|
+
*/
|
|
214
|
+
/**
|
|
215
|
+
* Updates the configuration settings for a specific device.
|
|
216
|
+
* @see https://yoto.dev/api/updatedeviceconfig/
|
|
217
|
+
* @param {object} options
|
|
218
|
+
* @param {string} options.accessToken The API token to request with
|
|
219
|
+
* @param {string} options.deviceId The device ID to update config for
|
|
220
|
+
* @param {YotoUpdateDeviceConfigRequest} options.configUpdate The configuration updates to apply (all config fields are optional)
|
|
221
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
222
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
223
|
+
* @return {Promise<YotoUpdateDeviceConfigResponse>} The update response
|
|
224
|
+
*/
|
|
24
225
|
export function updateDeviceConfig({ accessToken, userAgent, deviceId, configUpdate, requestOptions }: {
|
|
25
226
|
accessToken: string;
|
|
26
227
|
deviceId: string;
|
|
@@ -30,6 +231,27 @@ export function updateDeviceConfig({ accessToken, userAgent, deviceId, configUpd
|
|
|
30
231
|
dispatcher?: import("undici").Dispatcher;
|
|
31
232
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
32
233
|
}): Promise<YotoUpdateDeviceConfigResponse>;
|
|
234
|
+
/**
|
|
235
|
+
* @see https://yoto.dev/api/updateshortcutsbeta/
|
|
236
|
+
* @typedef {Object} YotoUpdateShortcutsRequest
|
|
237
|
+
* @property {YotoDeviceShortcuts} shortcuts - Shortcuts configuration to update
|
|
238
|
+
*/
|
|
239
|
+
/**
|
|
240
|
+
* @see https://yoto.dev/api/updateshortcutsbeta/
|
|
241
|
+
* @typedef {Object} YotoUpdateShortcutsResponse
|
|
242
|
+
* @property {string} status - Status of the update operation (e.g., 'ok')
|
|
243
|
+
*/
|
|
244
|
+
/**
|
|
245
|
+
* Updates the shortcuts configuration for a specific device (beta feature).
|
|
246
|
+
* @see https://yoto.dev/api/updateshortcutsbeta/
|
|
247
|
+
* @param {object} options
|
|
248
|
+
* @param {string} options.accessToken The API token to request with
|
|
249
|
+
* @param {string} options.deviceId The device ID to update shortcuts for
|
|
250
|
+
* @param {YotoUpdateShortcutsRequest} options.shortcutsUpdate The shortcuts configuration to update
|
|
251
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
252
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
253
|
+
* @return {Promise<YotoUpdateShortcutsResponse>} The update response
|
|
254
|
+
*/
|
|
33
255
|
export function updateDeviceShortcuts({ accessToken, userAgent, deviceId, shortcutsUpdate, requestOptions }: {
|
|
34
256
|
accessToken: string;
|
|
35
257
|
deviceId: string;
|
|
@@ -39,6 +261,31 @@ export function updateDeviceShortcuts({ accessToken, userAgent, deviceId, shortc
|
|
|
39
261
|
dispatcher?: import("undici").Dispatcher;
|
|
40
262
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
41
263
|
}): Promise<YotoUpdateShortcutsResponse>;
|
|
264
|
+
/**
|
|
265
|
+
* @see https://yoto.dev/api/senddevicecommand/
|
|
266
|
+
* @see https://yoto.dev/players-mqtt/mqtt-docs/
|
|
267
|
+
* @typedef {Object} YotoDeviceCommandResponse
|
|
268
|
+
* @property {string} status - Status of the command (e.g., 'ok')
|
|
269
|
+
*/
|
|
270
|
+
/**
|
|
271
|
+
* MQTT command types that can be sent to a device.
|
|
272
|
+
* Uses command types from the mqtt module.
|
|
273
|
+
* @see https://yoto.dev/players-mqtt/mqtt-docs/
|
|
274
|
+
* @typedef {YotoVolumeCommand | YotoAmbientCommand | YotoSleepTimerCommand | YotoCardStartCommand | YotoBluetoothCommand | YotoDisplayPreviewCommand | {}} YotoDeviceCommand
|
|
275
|
+
*/
|
|
276
|
+
/**
|
|
277
|
+
* Sends an MQTT command to a device.
|
|
278
|
+
* This is a mutation endpoint that controls device behavior.
|
|
279
|
+
* @see https://yoto.dev/api/senddevicecommand/
|
|
280
|
+
* @see https://yoto.dev/players-mqtt/mqtt-docs/
|
|
281
|
+
* @param {object} options
|
|
282
|
+
* @param {string} options.accessToken The API token to request with
|
|
283
|
+
* @param {string} options.deviceId The device ID to send command to
|
|
284
|
+
* @param {YotoDeviceCommand} options.command The MQTT command payload to send
|
|
285
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
286
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
287
|
+
* @return {Promise<YotoDeviceCommandResponse>} The command response
|
|
288
|
+
*/
|
|
42
289
|
export function sendDeviceCommand({ accessToken, userAgent, deviceId, command, requestOptions }: {
|
|
43
290
|
accessToken: string;
|
|
44
291
|
deviceId: string;
|
|
@@ -52,146 +299,480 @@ export type YotoDevicesResponse = {
|
|
|
52
299
|
devices: YotoDevice[];
|
|
53
300
|
};
|
|
54
301
|
export type YotoDevice = {
|
|
302
|
+
/**
|
|
303
|
+
* - The unique identifier for the device
|
|
304
|
+
*/
|
|
55
305
|
deviceId: string;
|
|
306
|
+
/**
|
|
307
|
+
* - The name of the device
|
|
308
|
+
*/
|
|
56
309
|
name: string;
|
|
310
|
+
/**
|
|
311
|
+
* - A brief description of the device
|
|
312
|
+
*/
|
|
57
313
|
description: string;
|
|
314
|
+
/**
|
|
315
|
+
* - Indicates whether the device is currently online
|
|
316
|
+
*/
|
|
58
317
|
online: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* - The release channel of the device
|
|
320
|
+
*/
|
|
59
321
|
releaseChannel: string;
|
|
322
|
+
/**
|
|
323
|
+
* - The type of the device
|
|
324
|
+
*/
|
|
60
325
|
deviceType: string;
|
|
326
|
+
/**
|
|
327
|
+
* - The family to which the device belongs
|
|
328
|
+
*/
|
|
61
329
|
deviceFamily: string;
|
|
330
|
+
/**
|
|
331
|
+
* - The group classification of the device
|
|
332
|
+
*/
|
|
62
333
|
deviceGroup: string;
|
|
334
|
+
/**
|
|
335
|
+
* - Device generation (e.g., 'gen3')
|
|
336
|
+
*/
|
|
63
337
|
generation?: string;
|
|
338
|
+
/**
|
|
339
|
+
* - Device form factor (e.g., 'standard', 'mini')
|
|
340
|
+
*/
|
|
64
341
|
formFactor?: string;
|
|
65
342
|
};
|
|
66
343
|
export type YotoDeviceStatusResponse = {
|
|
344
|
+
/**
|
|
345
|
+
* - Unique identifier of the device
|
|
346
|
+
*/
|
|
67
347
|
deviceId: string;
|
|
348
|
+
/**
|
|
349
|
+
* - Active card on the device (can be 'none')
|
|
350
|
+
*/
|
|
68
351
|
activeCard?: string;
|
|
352
|
+
/**
|
|
353
|
+
* - Reading from ambient light sensor
|
|
354
|
+
*/
|
|
69
355
|
ambientLightSensorReading?: number;
|
|
356
|
+
/**
|
|
357
|
+
* - Average download speed in bytes per second
|
|
358
|
+
*/
|
|
70
359
|
averageDownloadSpeedBytesSecond?: number;
|
|
360
|
+
/**
|
|
361
|
+
* - Battery level in percentage
|
|
362
|
+
*/
|
|
71
363
|
batteryLevelPercentage?: number;
|
|
364
|
+
/**
|
|
365
|
+
* - Raw battery level percentage
|
|
366
|
+
*/
|
|
72
367
|
batteryLevelPercentageRaw?: number;
|
|
368
|
+
/**
|
|
369
|
+
* - Number of buzz errors
|
|
370
|
+
*/
|
|
73
371
|
buzzErrors?: number;
|
|
372
|
+
/**
|
|
373
|
+
* - Card insertion state (0=none, 1=physical, 2=remote)
|
|
374
|
+
*/
|
|
74
375
|
cardInsertionState?: 0 | 1 | 2;
|
|
376
|
+
/**
|
|
377
|
+
* - Day mode status (-1=unknown, 0=night, 1=day)
|
|
378
|
+
*/
|
|
75
379
|
dayMode?: -1 | 0 | 1;
|
|
380
|
+
/**
|
|
381
|
+
* - Number of errors logged
|
|
382
|
+
*/
|
|
76
383
|
errorsLogged?: number;
|
|
384
|
+
/**
|
|
385
|
+
* - Firmware version (e.g., 'v2.23.2')
|
|
386
|
+
*/
|
|
77
387
|
firmwareVersion?: string;
|
|
388
|
+
/**
|
|
389
|
+
* - Free disk space in bytes
|
|
390
|
+
*/
|
|
78
391
|
freeDiskSpaceBytes?: number;
|
|
392
|
+
/**
|
|
393
|
+
* - Whether audio device is connected
|
|
394
|
+
*/
|
|
79
395
|
isAudioDeviceConnected?: boolean;
|
|
396
|
+
/**
|
|
397
|
+
* - Whether background download is active
|
|
398
|
+
*/
|
|
80
399
|
isBackgroundDownloadActive?: boolean;
|
|
400
|
+
/**
|
|
401
|
+
* - Whether Bluetooth audio is connected
|
|
402
|
+
*/
|
|
81
403
|
isBluetoothAudioConnected?: boolean;
|
|
404
|
+
/**
|
|
405
|
+
* - Whether device is currently charging
|
|
406
|
+
*/
|
|
82
407
|
isCharging?: boolean;
|
|
408
|
+
/**
|
|
409
|
+
* - NFC lock status
|
|
410
|
+
*/
|
|
83
411
|
isNfcLocked?: number;
|
|
412
|
+
/**
|
|
413
|
+
* - Whether device is currently online
|
|
414
|
+
*/
|
|
84
415
|
isOnline?: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* - Network SSID device is connected to
|
|
418
|
+
*/
|
|
85
419
|
networkSsid?: string;
|
|
420
|
+
/**
|
|
421
|
+
* - Nightlight mode (hex code or 'off')
|
|
422
|
+
*/
|
|
86
423
|
nightlightMode?: string;
|
|
424
|
+
/**
|
|
425
|
+
* - Currently playing source
|
|
426
|
+
*/
|
|
87
427
|
playingSource?: number;
|
|
428
|
+
/**
|
|
429
|
+
* - Power capabilities (e.g., '0x02')
|
|
430
|
+
*/
|
|
88
431
|
powerCapabilities?: string | null;
|
|
432
|
+
/**
|
|
433
|
+
* - Power source (0=battery, 1=V2 dock, 2=USB-C, 3=Qi)
|
|
434
|
+
*/
|
|
89
435
|
powerSource?: 0 | 1 | 2 | 3;
|
|
436
|
+
/**
|
|
437
|
+
* - System volume in percentage
|
|
438
|
+
*/
|
|
90
439
|
systemVolumePercentage?: number;
|
|
440
|
+
/**
|
|
441
|
+
* - Task watchdog timeout count
|
|
442
|
+
*/
|
|
91
443
|
taskWatchdogTimeoutCount?: number;
|
|
444
|
+
/**
|
|
445
|
+
* - Temperature in Celsius (can be number, string like "0", or "notSupported")
|
|
446
|
+
*/
|
|
92
447
|
temperatureCelcius?: number | string;
|
|
448
|
+
/**
|
|
449
|
+
* - Total disk space in bytes
|
|
450
|
+
*/
|
|
93
451
|
totalDiskSpaceBytes?: number;
|
|
452
|
+
/**
|
|
453
|
+
* - Timestamp of last update
|
|
454
|
+
*/
|
|
94
455
|
updatedAt?: string;
|
|
456
|
+
/**
|
|
457
|
+
* - Uptime of the device in seconds
|
|
458
|
+
*/
|
|
95
459
|
uptime?: number;
|
|
460
|
+
/**
|
|
461
|
+
* - User volume in percentage
|
|
462
|
+
*/
|
|
96
463
|
userVolumePercentage?: number;
|
|
464
|
+
/**
|
|
465
|
+
* - UTC offset in seconds
|
|
466
|
+
*/
|
|
97
467
|
utcOffsetSeconds?: number;
|
|
468
|
+
/**
|
|
469
|
+
* - UTC time as Unix timestamp
|
|
470
|
+
*/
|
|
98
471
|
utcTime?: number;
|
|
472
|
+
/**
|
|
473
|
+
* - WiFi connection strength in decibels
|
|
474
|
+
*/
|
|
99
475
|
wifiStrength?: number;
|
|
100
476
|
};
|
|
101
477
|
export type YotoDeviceConfigResponse = {
|
|
102
478
|
device: YotoDeviceConfigDevice;
|
|
103
479
|
};
|
|
104
480
|
export type YotoDeviceConfigDevice = {
|
|
481
|
+
/**
|
|
482
|
+
* - Device configuration settings
|
|
483
|
+
*/
|
|
105
484
|
config: YotoDeviceConfig;
|
|
485
|
+
/**
|
|
486
|
+
* - Device family (e.g., 'v2', 'v3', 'mini')
|
|
487
|
+
*/
|
|
106
488
|
deviceFamily: string;
|
|
489
|
+
/**
|
|
490
|
+
* - Device group classification
|
|
491
|
+
*/
|
|
107
492
|
deviceGroup: string;
|
|
493
|
+
/**
|
|
494
|
+
* - Unique identifier for the device
|
|
495
|
+
*/
|
|
108
496
|
deviceId: string;
|
|
497
|
+
/**
|
|
498
|
+
* - Type of device
|
|
499
|
+
*/
|
|
109
500
|
deviceType: string;
|
|
501
|
+
/**
|
|
502
|
+
* - Error code (null if no error)
|
|
503
|
+
*/
|
|
110
504
|
errorCode: any;
|
|
505
|
+
/**
|
|
506
|
+
* - Geographic timezone (e.g., 'Europe/London')
|
|
507
|
+
*/
|
|
111
508
|
geoTimezone: string;
|
|
509
|
+
/**
|
|
510
|
+
* - POSIX timezone string
|
|
511
|
+
*/
|
|
112
512
|
getPosix: string;
|
|
513
|
+
/**
|
|
514
|
+
* - MAC address
|
|
515
|
+
*/
|
|
113
516
|
mac: string;
|
|
517
|
+
/**
|
|
518
|
+
* - Device name (undocumented)
|
|
519
|
+
*/
|
|
114
520
|
name: string;
|
|
521
|
+
/**
|
|
522
|
+
* - Whether device is online
|
|
523
|
+
*/
|
|
115
524
|
online: boolean;
|
|
525
|
+
/**
|
|
526
|
+
* - Device registration code
|
|
527
|
+
*/
|
|
116
528
|
registrationCode: string;
|
|
529
|
+
/**
|
|
530
|
+
* - Activation POP code (undocumented)
|
|
531
|
+
*/
|
|
117
532
|
activationPopCode: string;
|
|
533
|
+
/**
|
|
534
|
+
* - POP code (undocumented)
|
|
535
|
+
*/
|
|
118
536
|
popCode: string;
|
|
537
|
+
/**
|
|
538
|
+
* - Release channel identifier
|
|
539
|
+
*/
|
|
119
540
|
releaseChannelId: string;
|
|
541
|
+
/**
|
|
542
|
+
* - Release channel version
|
|
543
|
+
*/
|
|
120
544
|
releaseChannelVersion: string;
|
|
545
|
+
/**
|
|
546
|
+
* - Firmware version (undocumented)
|
|
547
|
+
*/
|
|
121
548
|
fwVersion: string;
|
|
549
|
+
/**
|
|
550
|
+
* - Device status object (undocumented)
|
|
551
|
+
*/
|
|
122
552
|
status?: any;
|
|
553
|
+
/**
|
|
554
|
+
* - Button shortcuts configuration (beta feature)
|
|
555
|
+
*/
|
|
123
556
|
shortcuts?: YotoDeviceShortcuts;
|
|
124
557
|
};
|
|
125
558
|
export type YotoDeviceConfig = {
|
|
559
|
+
/**
|
|
560
|
+
* - Array of alarm strings in comma-separated format (e.g., '1111111,1100,5WsQg,,,8')
|
|
561
|
+
*/
|
|
126
562
|
alarms?: string[];
|
|
563
|
+
/**
|
|
564
|
+
* - Ambient light color (hex code)
|
|
565
|
+
*/
|
|
127
566
|
ambientColour: string;
|
|
567
|
+
/**
|
|
568
|
+
* - Bluetooth enabled state ('0' or '1')
|
|
569
|
+
*/
|
|
128
570
|
bluetoothEnabled: string;
|
|
571
|
+
/**
|
|
572
|
+
* - Bluetooth headphones enabled
|
|
573
|
+
*/
|
|
129
574
|
btHeadphonesEnabled: boolean;
|
|
575
|
+
/**
|
|
576
|
+
* - Clock face style (e.g., 'digital-sun')
|
|
577
|
+
*/
|
|
130
578
|
clockFace?: string;
|
|
579
|
+
/**
|
|
580
|
+
* - Day display brightness (e.g., 'auto')
|
|
581
|
+
*/
|
|
131
582
|
dayDisplayBrightness: string;
|
|
583
|
+
/**
|
|
584
|
+
* - Day mode start time (e.g., '07:30')
|
|
585
|
+
*/
|
|
132
586
|
dayTime: string;
|
|
587
|
+
/**
|
|
588
|
+
* - Day mode Yoto Daily card path
|
|
589
|
+
*/
|
|
133
590
|
dayYotoDaily: string;
|
|
591
|
+
/**
|
|
592
|
+
* - Day mode Yoto Radio card path
|
|
593
|
+
*/
|
|
134
594
|
dayYotoRadio: string;
|
|
595
|
+
/**
|
|
596
|
+
* - Day sounds off setting (undocumented)
|
|
597
|
+
*/
|
|
135
598
|
daySoundsOff?: string;
|
|
599
|
+
/**
|
|
600
|
+
* - Display dim brightness level
|
|
601
|
+
*/
|
|
136
602
|
displayDimBrightness?: string;
|
|
603
|
+
/**
|
|
604
|
+
* - Display dim timeout in seconds
|
|
605
|
+
*/
|
|
137
606
|
displayDimTimeout: string;
|
|
607
|
+
/**
|
|
608
|
+
* - Whether headphones volume is limited
|
|
609
|
+
*/
|
|
138
610
|
headphonesVolumeLimited: boolean;
|
|
611
|
+
/**
|
|
612
|
+
* - Hour format ('12' or '24')
|
|
613
|
+
*/
|
|
139
614
|
hourFormat?: string;
|
|
615
|
+
/**
|
|
616
|
+
* - Log level (e.g., 'none') (undocumented)
|
|
617
|
+
*/
|
|
140
618
|
logLevel?: string;
|
|
619
|
+
/**
|
|
620
|
+
* - Device locale (e.g., 'en') (undocumented)
|
|
621
|
+
*/
|
|
141
622
|
locale?: string;
|
|
623
|
+
/**
|
|
624
|
+
* - Maximum volume limit
|
|
625
|
+
*/
|
|
142
626
|
maxVolumeLimit: string;
|
|
627
|
+
/**
|
|
628
|
+
* - Night ambient light color (hex code)
|
|
629
|
+
*/
|
|
143
630
|
nightAmbientColour: string;
|
|
631
|
+
/**
|
|
632
|
+
* - Night display brightness
|
|
633
|
+
*/
|
|
144
634
|
nightDisplayBrightness: string;
|
|
635
|
+
/**
|
|
636
|
+
* - Night maximum volume limit
|
|
637
|
+
*/
|
|
145
638
|
nightMaxVolumeLimit: string;
|
|
639
|
+
/**
|
|
640
|
+
* - Night mode start time (e.g., '19:30')
|
|
641
|
+
*/
|
|
146
642
|
nightTime: string;
|
|
643
|
+
/**
|
|
644
|
+
* - Night mode Yoto Daily card path
|
|
645
|
+
*/
|
|
147
646
|
nightYotoDaily: string;
|
|
647
|
+
/**
|
|
648
|
+
* - Night mode Yoto Radio card path
|
|
649
|
+
*/
|
|
148
650
|
nightYotoRadio: string;
|
|
651
|
+
/**
|
|
652
|
+
* - Night sounds off setting (undocumented)
|
|
653
|
+
*/
|
|
149
654
|
nightSoundsOff?: string;
|
|
655
|
+
/**
|
|
656
|
+
* - Pause on power button press (undocumented)
|
|
657
|
+
*/
|
|
150
658
|
pausePowerButton?: boolean;
|
|
659
|
+
/**
|
|
660
|
+
* - Pause on volume down (undocumented)
|
|
661
|
+
*/
|
|
151
662
|
pauseVolumeDown?: boolean;
|
|
663
|
+
/**
|
|
664
|
+
* - Whether repeat all is enabled
|
|
665
|
+
*/
|
|
152
666
|
repeatAll: boolean;
|
|
667
|
+
/**
|
|
668
|
+
* - Show diagnostics (undocumented)
|
|
669
|
+
*/
|
|
153
670
|
showDiagnostics?: boolean;
|
|
671
|
+
/**
|
|
672
|
+
* - Shutdown timeout in seconds
|
|
673
|
+
*/
|
|
154
674
|
shutdownTimeout: string;
|
|
675
|
+
/**
|
|
676
|
+
* - System volume level (undocumented)
|
|
677
|
+
*/
|
|
155
678
|
systemVolume?: string;
|
|
679
|
+
/**
|
|
680
|
+
* - Timezone setting (undocumented)
|
|
681
|
+
*/
|
|
156
682
|
timezone?: string;
|
|
683
|
+
/**
|
|
684
|
+
* - Volume level preset (e.g., 'safe')
|
|
685
|
+
*/
|
|
157
686
|
volumeLevel?: string;
|
|
158
687
|
};
|
|
159
688
|
export type YotoDeviceShortcuts = {
|
|
689
|
+
/**
|
|
690
|
+
* - Shortcut modes for day and night
|
|
691
|
+
*/
|
|
160
692
|
modes: YotoShortcutModes;
|
|
693
|
+
/**
|
|
694
|
+
* - Shortcuts configuration version ID
|
|
695
|
+
*/
|
|
161
696
|
versionId: string;
|
|
162
697
|
};
|
|
163
698
|
export type YotoShortcutModes = {
|
|
699
|
+
/**
|
|
700
|
+
* - Day mode shortcuts
|
|
701
|
+
*/
|
|
164
702
|
day: YotoShortcutMode;
|
|
703
|
+
/**
|
|
704
|
+
* - Night mode shortcuts
|
|
705
|
+
*/
|
|
165
706
|
night: YotoShortcutMode;
|
|
166
707
|
};
|
|
167
708
|
export type YotoShortcutMode = {
|
|
709
|
+
/**
|
|
710
|
+
* - Array of shortcut content commands
|
|
711
|
+
*/
|
|
168
712
|
content: YotoShortcutContent[];
|
|
169
713
|
};
|
|
170
714
|
export type YotoShortcutContent = {
|
|
715
|
+
/**
|
|
716
|
+
* - Command type (e.g., 'track-play')
|
|
717
|
+
*/
|
|
171
718
|
cmd: string;
|
|
719
|
+
/**
|
|
720
|
+
* - Command parameters
|
|
721
|
+
*/
|
|
172
722
|
params: YotoShortcutParams;
|
|
173
723
|
};
|
|
174
724
|
export type YotoShortcutParams = {
|
|
725
|
+
/**
|
|
726
|
+
* - Card ID
|
|
727
|
+
*/
|
|
175
728
|
card: string;
|
|
729
|
+
/**
|
|
730
|
+
* - Chapter identifier
|
|
731
|
+
*/
|
|
176
732
|
chapter: string;
|
|
733
|
+
/**
|
|
734
|
+
* - Track identifier
|
|
735
|
+
*/
|
|
177
736
|
track: string;
|
|
178
737
|
};
|
|
179
738
|
export type YotoUpdateDeviceConfigRequest = {
|
|
739
|
+
/**
|
|
740
|
+
* - Device name
|
|
741
|
+
*/
|
|
180
742
|
name?: string;
|
|
743
|
+
/**
|
|
744
|
+
* - Configuration settings to update (all fields optional)
|
|
745
|
+
*/
|
|
181
746
|
config: Partial<YotoDeviceConfig>;
|
|
182
747
|
};
|
|
183
748
|
export type YotoUpdateDeviceConfigResponse = {
|
|
749
|
+
/**
|
|
750
|
+
* - Status of the update operation (e.g., 'ok')
|
|
751
|
+
*/
|
|
184
752
|
status: string;
|
|
185
753
|
};
|
|
186
754
|
export type YotoUpdateShortcutsRequest = {
|
|
755
|
+
/**
|
|
756
|
+
* - Shortcuts configuration to update
|
|
757
|
+
*/
|
|
187
758
|
shortcuts: YotoDeviceShortcuts;
|
|
188
759
|
};
|
|
189
760
|
export type YotoUpdateShortcutsResponse = {
|
|
761
|
+
/**
|
|
762
|
+
* - Status of the update operation (e.g., 'ok')
|
|
763
|
+
*/
|
|
190
764
|
status: string;
|
|
191
765
|
};
|
|
192
766
|
export type YotoDeviceCommandResponse = {
|
|
767
|
+
/**
|
|
768
|
+
* - Status of the command (e.g., 'ok')
|
|
769
|
+
*/
|
|
193
770
|
status: string;
|
|
194
771
|
};
|
|
772
|
+
/**
|
|
773
|
+
* MQTT command types that can be sent to a device.
|
|
774
|
+
* Uses command types from the mqtt module.
|
|
775
|
+
*/
|
|
195
776
|
export type YotoDeviceCommand = YotoVolumeCommand | YotoAmbientCommand | YotoSleepTimerCommand | YotoCardStartCommand | YotoBluetoothCommand | YotoDisplayPreviewCommand | {};
|
|
196
777
|
import type { YotoVolumeCommand } from '../mqtt/commands.js';
|
|
197
778
|
import type { YotoAmbientCommand } from '../mqtt/commands.js';
|