yoto-nodejs-client 0.0.1 → 0.0.3
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 +523 -30
- package/bin/auth.js +36 -46
- package/bin/content.js +0 -0
- package/bin/device-model.d.ts +3 -0
- package/bin/device-model.d.ts.map +1 -0
- package/bin/device-model.js +360 -0
- package/bin/device-tui.TODO.md +125 -0
- package/bin/device-tui.d.ts +31 -0
- package/bin/device-tui.d.ts.map +1 -0
- package/bin/device-tui.js +1123 -0
- package/bin/devices.js +166 -28
- package/bin/groups.js +0 -0
- package/bin/icons.js +0 -0
- package/bin/lib/cli-helpers.d.ts +33 -1
- package/bin/lib/cli-helpers.d.ts.map +1 -1
- package/bin/lib/cli-helpers.js +5 -5
- package/bin/lib/token-helpers.d.ts +32 -0
- package/bin/lib/token-helpers.d.ts.map +1 -1
- package/bin/refresh-token.js +6 -6
- package/bin/token-info.js +3 -3
- package/index.d.ts +4 -217
- package/index.d.ts.map +1 -1
- package/index.js +11 -689
- package/lib/api-client.d.ts +576 -0
- package/lib/api-client.d.ts.map +1 -0
- package/lib/api-client.js +681 -0
- package/lib/api-endpoints/auth.d.ts +280 -4
- package/lib/api-endpoints/auth.d.ts.map +1 -1
- package/lib/api-endpoints/auth.js +224 -7
- package/lib/api-endpoints/auth.test.js +54 -2
- package/lib/api-endpoints/constants.d.ts +30 -2
- package/lib/api-endpoints/constants.d.ts.map +1 -1
- package/lib/api-endpoints/constants.js +17 -10
- package/lib/api-endpoints/content.d.ts +760 -0
- package/lib/api-endpoints/content.d.ts.map +1 -1
- package/lib/api-endpoints/content.test.js +1 -1
- package/lib/api-endpoints/devices.d.ts +917 -48
- package/lib/api-endpoints/devices.d.ts.map +1 -1
- package/lib/api-endpoints/devices.js +114 -52
- package/lib/api-endpoints/devices.test.js +1 -1
- package/lib/api-endpoints/endpoint-test-helpers.d.ts +28 -0
- package/lib/api-endpoints/endpoint-test-helpers.d.ts.map +1 -0
- 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-library-groups.test.js +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/family.test.js +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/icons.test.js +1 -1
- package/lib/api-endpoints/media.d.ts +83 -0
- package/lib/api-endpoints/media.d.ts.map +1 -1
- package/lib/helpers/power-state.d.ts +53 -0
- package/lib/helpers/power-state.d.ts.map +1 -0
- package/lib/helpers/power-state.js +73 -0
- package/lib/helpers/power-state.test.js +100 -0
- package/lib/helpers/temperature.d.ts +24 -0
- package/lib/helpers/temperature.d.ts.map +1 -0
- package/lib/helpers/temperature.js +61 -0
- package/lib/helpers/temperature.test.js +58 -0
- package/lib/helpers/typed-keys.d.ts +7 -0
- package/lib/helpers/typed-keys.d.ts.map +1 -0
- package/lib/helpers/typed-keys.js +8 -0
- package/lib/mqtt/client.d.ts +610 -7
- package/lib/mqtt/client.d.ts.map +1 -1
- package/lib/mqtt/client.js +213 -31
- package/lib/mqtt/commands.d.ts +195 -0
- package/lib/mqtt/commands.d.ts.map +1 -1
- package/lib/mqtt/factory.d.ts +62 -1
- package/lib/mqtt/factory.d.ts.map +1 -1
- package/lib/mqtt/factory.js +27 -5
- package/lib/mqtt/mqtt.test.js +85 -28
- package/lib/mqtt/topics.d.ts +186 -1
- package/lib/mqtt/topics.d.ts.map +1 -1
- package/lib/mqtt/topics.js +54 -20
- package/lib/pkg.d.cts +9 -0
- package/lib/token.d.ts +106 -3
- package/lib/token.d.ts.map +1 -1
- package/lib/token.js +30 -23
- package/lib/yoto-account.d.ts +163 -0
- package/lib/yoto-account.d.ts.map +1 -0
- package/lib/yoto-account.js +340 -0
- package/lib/yoto-device.d.ts +656 -0
- package/lib/yoto-device.d.ts.map +1 -0
- package/lib/yoto-device.js +2850 -0
- package/package.json +22 -15
- package/lib/api-endpoints/test-helpers.d.ts +0 -7
- package/lib/api-endpoints/test-helpers.d.ts.map +0 -1
- /package/lib/api-endpoints/{test-helpers.js → endpoint-test-helpers.js} +0 -0
package/lib/mqtt/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["client.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["client.js"],"names":[],"mappings":"AA6PA;;;;;;;;;;;;;;;;GAgBG;AACH;IACE;;;;;;OAMG;IACH,wBALW,UAAU,YACV,MAAM,YAEd;QAA0B,aAAa;KACzC,EAaA;IATC,uBAA4B;IAC5B,iBAAwB;IACxB,uBAAoD;IAMpD;;;;;;;;;;MAAwB;IAG1B;;;OAGG;IACH,aAFa,uBAAuB,CAMnC;IAED;;;OAGG;IACH,iBAFa,OAAO,CAInB;IA2CD;;;;;;;;;;;;OAYG;IACH,kBAXW,KAAK,CAAC,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC,GAAG,KAAK,GAC7C,OAAO,CAAC,IAAI,CAAC,CAiDzB;IA8CD;;;OAGG;IACH,WAFa,OAAO,CAAC,IAAI,CAAC,CA8BzB;IAED;;;OAGG;IACH,cAFa,OAAO,CAAC,IAAI,CAAC,CAiBzB;IAwBD;;;;OAIG;IACH,qBAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKzB;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKzB;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAMzB;IAED;;;;;;OAMG;IACH,cALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,OAAO,CAAC,IAAI,C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;;;;iBACN,MAAM;;;;qBACN,MAAM;;;;UACN,MAAM;;;;aACN,MAAM;;;;YACN,MAAM;;;;YACN,MAAM;;;;aACN,MAAM;;;;eACN,MAAM;;;;eACN,MAAM;;;;oBACN,MAAM;;;;cACN,MAAM;;;;gBACN,MAAM;;;;cACN,MAAM;;;;qBACN,MAAM;;;;eACN,MAAM;;;;aACN,MAAM;;;;iBACN,MAAM;;;;cACN,MAAM;;;;cACN,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;;;;gBACb,MAAM;;;;kBACN,CAAC,GAAG,CAAC,GAAG,CAAC;;;;mBACT,MAAM;;;;gBACN,MAAM;;;;kBACN,MAAM;;;;WACN,MAAM;;;;gBACN,MAAM;;;;oBACN,MAAM;;;;eACN,MAAM;;;;iBACN,MAAM;;;;kBACN,MAAM;;;;UACN,MAAM;;;;iBACN,MAAM;;;;oBACN,MAAM;;;;gBACN,MAAM;;;;aACN,MAAM;;;;SACN,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;;;;UACV,MAAM;;;;SACN,MAAM;;;;YACN,MAAM;;;;gBACN,MAAM;;;;gBACN,IAAI,GAAG,IAAI;;;;kBACX,MAAM;;;;gBACN,MAAM;;;;aACN,MAAM;;;;oBACN,MAAM;;;;;sCAKP,cAAc,GAAG,WAAW,GAAG,cAAc;;;;qCAM/C,MAAM,WACN,iBAAiB;;;;qCAMjB,MAAM,WACN,iBAAiB;;;;2CAMjB,MAAM,WACN,uBAAuB;;;;uCAMvB,MAAM,WACN,mBAAmB;;;;sCAMnB,MAAM,WACN,GAAG;6BAGe,QAAQ;gCAtNN,MAAM"}
|
package/lib/mqtt/client.js
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* @typedef {Object} YotoEventsMessage
|
|
21
21
|
* @property {boolean} [repeatAll] - Repeat all tracks
|
|
22
22
|
* @property {boolean} [streaming] - Whether streaming
|
|
23
|
-
* @property {number} [volume] - Current volume level
|
|
24
|
-
* @property {number} [volumeMax] - Maximum volume
|
|
23
|
+
* @property {number} [volume] - Current user volume level (0-16 scale, maps to userVolumePercentage in status)
|
|
24
|
+
* @property {number} [volumeMax] - Maximum volume limit (0-16 scale, maps to systemVolumePercentage in status)
|
|
25
25
|
* @property {boolean} [playbackWait] - Playback waiting
|
|
26
26
|
* @property {boolean} [sleepTimerActive] - Sleep timer active
|
|
27
27
|
* @property {number} [eventUtc] - Unix timestamp
|
|
@@ -34,37 +34,52 @@
|
|
|
34
34
|
* @property {string} [chapterKey] - Current chapter key
|
|
35
35
|
* @property {string} [trackTitle] - Current track title
|
|
36
36
|
* @property {string} [trackKey] - Current track key
|
|
37
|
-
* @property {string} [playbackStatus] - Playback status
|
|
37
|
+
* @property {'playing' | 'paused' | 'stopped' | 'loading' | string} [playbackStatus] - Playback status
|
|
38
38
|
* @property {number} [sleepTimerSeconds] - Seconds remaining on sleep timer
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* Status message from device
|
|
42
|
+
* Status message from device (MQTT /data/status)
|
|
43
|
+
*
|
|
44
|
+
* Device automatically publishes status updates every 5 minutes (matching keepalive interval).
|
|
45
|
+
* Can also be requested on-demand via requestStatus().
|
|
46
|
+
*
|
|
47
|
+
* Note: MQTT types differ from HTTP - uses booleans, non-nullable fields
|
|
43
48
|
* @see https://yoto.dev/players-mqtt/mqtt-docs/#deviceiddatastatus
|
|
44
49
|
* @typedef {Object} YotoStatusMessage
|
|
50
|
+
* @property {YotoMqttStatus} status - Status object
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* MQTT status payload structure (documented spec)
|
|
55
|
+
*
|
|
56
|
+
* Automatic updates (every 5 minutes): 21 fields (excludes nightlightMode and temp)
|
|
57
|
+
* Requested status: All 23 fields including nightlightMode and temp
|
|
58
|
+
*
|
|
59
|
+
* @typedef {Object} YotoMqttStatus
|
|
45
60
|
* @property {number} statusVersion - Status message version
|
|
46
61
|
* @property {string} fwVersion - Firmware version
|
|
47
62
|
* @property {string} productType - Product type identifier
|
|
48
63
|
* @property {number} batteryLevel - Battery level percentage
|
|
49
64
|
* @property {number} als - Ambient light sensor reading
|
|
50
|
-
* @property {number} freeDisk - Free disk space
|
|
65
|
+
* @property {number} freeDisk - Free disk space in bytes
|
|
51
66
|
* @property {number} shutdownTimeout - Shutdown timeout in seconds
|
|
52
67
|
* @property {number} dbatTimeout - DBAT timeout
|
|
53
68
|
* @property {number} charging - Charging state (0 or 1)
|
|
54
|
-
* @property {string} activeCard - Active card ID
|
|
55
|
-
* @property {
|
|
69
|
+
* @property {string} activeCard - Active card ID or 'none'
|
|
70
|
+
* @property {0 | 1 | 2} cardInserted - Card insertion state (0=none, 1=physical, 2=remote)
|
|
56
71
|
* @property {number} playingStatus - Playing status code
|
|
57
72
|
* @property {boolean} headphones - Headphones connected
|
|
58
73
|
* @property {number} dnowBrightness - Current display brightness
|
|
59
74
|
* @property {number} dayBright - Day brightness setting
|
|
60
75
|
* @property {number} nightBright - Night brightness setting
|
|
61
76
|
* @property {boolean} bluetoothHp - Bluetooth headphones enabled
|
|
62
|
-
* @property {number} volume -
|
|
63
|
-
* @property {number} userVolume - User volume setting
|
|
77
|
+
* @property {number} volume - System/max volume level (0-100 percentage, represents 0-16 hardware scale, maps to volumeMax in events)
|
|
78
|
+
* @property {number} userVolume - User volume setting (0-100 percentage, represents 0-16 hardware scale, maps to volume in events)
|
|
64
79
|
* @property {'12' | '24'} timeFormat - Time format preference
|
|
65
|
-
* @property {string} nightlightMode -
|
|
66
|
-
* @property {string} temp - Temperature reading
|
|
67
|
-
* @property {
|
|
80
|
+
* @property {string} [nightlightMode] - Current nightlight color (actual hex color like '0xff5733' or 'off') - only in requested status, most accurate source
|
|
81
|
+
* @property {string} [temp] - Temperature reading (format varies: 'value1:value2:value3' or 'value1:notSupported') - only in requested status
|
|
82
|
+
* @property {-1 | 0 | 1} day - Day mode (0=night, 1=day, -1=unknown)
|
|
68
83
|
*/
|
|
69
84
|
|
|
70
85
|
/**
|
|
@@ -85,14 +100,136 @@
|
|
|
85
100
|
|
|
86
101
|
*/
|
|
87
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Legacy status message from device (MQTT /status)
|
|
105
|
+
*
|
|
106
|
+
* This is the older undocumented status topic that contains critical lifecycle information
|
|
107
|
+
* not available in the documented /data/status topic, including:
|
|
108
|
+
* - shutDown field: Indicates device power state changes ('userShutdown', 'nA', etc.)
|
|
109
|
+
* - Startup detection: Low upTime values, utcTime: 0 after power on
|
|
110
|
+
* - Full hardware diagnostics: battery voltage, memory stats, temperatures
|
|
111
|
+
*
|
|
112
|
+
* Both documented and legacy status topics are necessary for complete device monitoring.
|
|
113
|
+
*
|
|
114
|
+
* @typedef {Object} YotoStatusLegacyMessage
|
|
115
|
+
* @property {YotoLegacyStatus} status - Legacy status object with full hardware details
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Legacy MQTT status payload structure (undocumented)
|
|
120
|
+
*
|
|
121
|
+
* Contains all fields from documented status plus additional lifecycle and diagnostic fields.
|
|
122
|
+
*
|
|
123
|
+
* @typedef {Object} YotoLegacyStatus
|
|
124
|
+
* @property {number} statusVersion - Status message version
|
|
125
|
+
* @property {string} fwVersion - Firmware version
|
|
126
|
+
* @property {string} shutDown - Power state: 'nA' = device running, any other value = shutting down/shut down (e.g., 'userShutdown') - ONLY in legacy topic
|
|
127
|
+
* @property {number} totalDisk - Total disk space in bytes
|
|
128
|
+
* @property {string} productType - Product type identifier
|
|
129
|
+
* @property {number} wifiStrength - WiFi signal strength in dBm
|
|
130
|
+
* @property {string} ssid - WiFi SSID
|
|
131
|
+
* @property {number} rtcResetReasonPRO - RTC reset reason (PRO)
|
|
132
|
+
* @property {number} rtcResetReasonAPP - RTC reset reason (APP)
|
|
133
|
+
* @property {number} rtcWakeupCause - RTC wakeup cause code
|
|
134
|
+
* @property {number} espResetReason - ESP reset reason code
|
|
135
|
+
* @property {string} sd_info - SD card information string
|
|
136
|
+
* @property {number} battery - Raw battery voltage in millivolts
|
|
137
|
+
* @property {string} powerCaps - Power capabilities
|
|
138
|
+
* @property {number} batteryLevel - Battery level percentage
|
|
139
|
+
* @property {number} batteryTemp - Battery temperature
|
|
140
|
+
* @property {string} batteryData - Battery data string (format: 'val1:val2:val3')
|
|
141
|
+
* @property {number} batteryLevelRaw - Raw battery level reading
|
|
142
|
+
* @property {number} free - Free memory in bytes
|
|
143
|
+
* @property {number} freeDMA - Free DMA memory in bytes
|
|
144
|
+
* @property {number} free32 - Free 32-bit memory in bytes
|
|
145
|
+
* @property {number} upTime - Device uptime in seconds (low values indicate recent startup)
|
|
146
|
+
* @property {number} utcTime - UTC timestamp (0 indicates fresh startup before time sync)
|
|
147
|
+
* @property {number} aliveTime - Total alive time in seconds
|
|
148
|
+
* @property {number} accelTemp - Accelerometer temperature in Celsius
|
|
149
|
+
* @property {string} batteryProfile - Battery profile identifier
|
|
150
|
+
* @property {number} freeDisk - Free disk space in bytes
|
|
151
|
+
* @property {number} failReason - Failure reason code
|
|
152
|
+
* @property {number} failData - Failure data
|
|
153
|
+
* @property {number} shutdownTimeout - Shutdown timeout in seconds
|
|
154
|
+
* @property {number} utcOffset - UTC offset in seconds
|
|
155
|
+
* @property {string} nfcErrs - NFC error rates (format: 'xx.xx%-xx.xx%')
|
|
156
|
+
* @property {number} dbatTimeout - DBAT timeout in seconds
|
|
157
|
+
* @property {number} charging - Charging state (0 or 1)
|
|
158
|
+
* @property {0 | 1 | 2 | 3} powerSrc - Power source (0=battery, 1=V2 dock, 2=USB-C, 3=Qi)
|
|
159
|
+
* @property {string} activeCard - Active card ID or 'none'
|
|
160
|
+
* @property {0 | 1 | 2} cardInserted - Card insertion state (0=none, 1=physical, 2=remote)
|
|
161
|
+
* @property {number} playingStatus - Playing status code
|
|
162
|
+
* @property {number} headphones - Headphones connected (0 or 1)
|
|
163
|
+
* @property {number} wifiRestarts - WiFi restart count
|
|
164
|
+
* @property {number} qiOtp - Qi OTP value
|
|
165
|
+
* @property {number} buzzErrors - Buzzer error count
|
|
166
|
+
* @property {number} dnowBrightness - Current display brightness
|
|
167
|
+
* @property {number} dayBright - Day brightness setting
|
|
168
|
+
* @property {number} nightBright - Night brightness setting
|
|
169
|
+
* @property {number} errorsLogged - Number of errors logged
|
|
170
|
+
* @property {number} twdt - Task watchdog timer value
|
|
171
|
+
* @property {number} bluetoothHp - Bluetooth headphones state (0 or 1)
|
|
172
|
+
* @property {string} nightlightMode - Current nightlight color (hex color like '0xff5733' or 'off')
|
|
173
|
+
* @property {number} bgDownload - Background download state
|
|
174
|
+
* @property {number} bytesPS - Bytes per second
|
|
175
|
+
* @property {-1 | 0 | 1} day - Day mode (0=night, 1=day, -1=unknown)
|
|
176
|
+
* @property {string} temp - Temperature readings (format: 'val1:val2:val3')
|
|
177
|
+
* @property {number} als - Ambient light sensor reading
|
|
178
|
+
* @property {number} volume - System/max volume level (0-100 percentage, represents 0-16 hardware scale, maps to volumeMax in events)
|
|
179
|
+
* @property {number} userVolume - User volume setting (0-100 percentage, represents 0-16 hardware scale, maps to volume in events)
|
|
180
|
+
* @property {'12' | '24'} timeFormat - Time format preference
|
|
181
|
+
* @property {number} chgStatLevel - Charge state level
|
|
182
|
+
* @property {number} missedLogs - Missed log count
|
|
183
|
+
* @property {number} nfcLock - NFC lock state
|
|
184
|
+
* @property {number} batteryFullPct - Battery full percentage threshold
|
|
185
|
+
*/
|
|
186
|
+
|
|
88
187
|
/**
|
|
89
188
|
* MQTT connection state
|
|
90
189
|
* @typedef {'disconnected' | 'connected' | 'reconnecting'} YotoMqttConnectionState
|
|
91
190
|
*/
|
|
92
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Events message callback
|
|
194
|
+
* @callback EventsCallback
|
|
195
|
+
* @param {string} topic - Raw MQTT topic string
|
|
196
|
+
* @param {YotoEventsMessage} payload - Events message payload
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Status message callback
|
|
201
|
+
* @callback StatusCallback
|
|
202
|
+
* @param {string} topic - Raw MQTT topic string
|
|
203
|
+
* @param {YotoStatusMessage} payload - Status message payload
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Legacy status message callback
|
|
208
|
+
* @callback StatusLegacyCallback
|
|
209
|
+
* @param {string} topic - Raw MQTT topic string
|
|
210
|
+
* @param {YotoStatusLegacyMessage} payload - Legacy status message payload with lifecycle events
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Response message callback
|
|
215
|
+
* @callback ResponseCallback
|
|
216
|
+
* @param {string} topic - Raw MQTT topic string
|
|
217
|
+
* @param {YotoResponseMessage} payload - Response message payload
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Unknown message callback
|
|
222
|
+
* @callback UnknownCallback
|
|
223
|
+
* @param {string} topic - Raw MQTT topic string
|
|
224
|
+
* @param {any} payload - Unknown message payload
|
|
225
|
+
*/
|
|
226
|
+
|
|
93
227
|
import { EventEmitter } from 'events'
|
|
94
228
|
import {
|
|
95
229
|
getSubscriptionTopics,
|
|
230
|
+
getEventsTopic,
|
|
231
|
+
getStatusTopic,
|
|
232
|
+
getResponseTopic,
|
|
96
233
|
parseTopic,
|
|
97
234
|
getEventsRequestTopic,
|
|
98
235
|
getStatusRequestTopic,
|
|
@@ -118,9 +255,14 @@ import { commands } from './commands.js'
|
|
|
118
255
|
* Yoto MQTT Client class
|
|
119
256
|
* @extends EventEmitter
|
|
120
257
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
258
|
+
* Device automatically publishes status updates every 5 minutes when connected.
|
|
259
|
+
* Status can also be requested on-demand via requestStatus() and requestEvents().
|
|
260
|
+
*
|
|
261
|
+
* @fires YotoMqttClient#events - Emits (topic, payload) when device sends events
|
|
262
|
+
* @fires YotoMqttClient#status - Emits (topic, payload) when device sends status (automatic every 5 min, or on-demand)
|
|
263
|
+
* @fires YotoMqttClient#status-legacy - Emits (topic, payload) when device sends legacy status with lifecycle events
|
|
264
|
+
* @fires YotoMqttClient#response - Emits (topic, payload) when device responds to commands
|
|
265
|
+
* @fires YotoMqttClient#unknown - Emits (topic, payload) when receiving unknown message type
|
|
124
266
|
* @fires YotoMqttClient#connected
|
|
125
267
|
* @fires YotoMqttClient#disconnected
|
|
126
268
|
* @fires YotoMqttClient#reconnecting
|
|
@@ -209,14 +351,43 @@ export class YotoMqttClient extends EventEmitter {
|
|
|
209
351
|
|
|
210
352
|
/**
|
|
211
353
|
* Subscribe to device topics
|
|
354
|
+
* @param {Array<'events' | 'status' | 'response'> | 'all'} [types='all'] - Topic types to subscribe to, or 'all' for all topics
|
|
212
355
|
* @returns {Promise<void>}
|
|
356
|
+
* @example
|
|
357
|
+
* // Subscribe to all topics (default)
|
|
358
|
+
* await client.subscribe()
|
|
359
|
+
* await client.subscribe('all')
|
|
360
|
+
*
|
|
361
|
+
* // Subscribe to specific topics
|
|
362
|
+
* await client.subscribe(['events', 'status'])
|
|
363
|
+
* await client.subscribe(['response'])
|
|
213
364
|
*/
|
|
214
|
-
async
|
|
215
|
-
|
|
365
|
+
async subscribe (types = 'all') {
|
|
366
|
+
let topicsToSubscribe = []
|
|
367
|
+
|
|
368
|
+
if (types === 'all') {
|
|
369
|
+
// Subscribe to all device topics
|
|
370
|
+
topicsToSubscribe = getSubscriptionTopics(this.deviceId)
|
|
371
|
+
} else {
|
|
372
|
+
// Subscribe to specific topic types
|
|
373
|
+
const typeArray = Array.isArray(types) ? types : [types]
|
|
374
|
+
|
|
375
|
+
for (const type of typeArray) {
|
|
376
|
+
if (type === 'events') {
|
|
377
|
+
topicsToSubscribe.push(...getEventsTopic(this.deviceId))
|
|
378
|
+
} else if (type === 'status') {
|
|
379
|
+
topicsToSubscribe.push(...getStatusTopic(this.deviceId))
|
|
380
|
+
} else if (type === 'response') {
|
|
381
|
+
topicsToSubscribe.push(getResponseTopic(this.deviceId))
|
|
382
|
+
} else {
|
|
383
|
+
throw new Error(`Invalid topic type: ${type}. Must be 'events', 'status', 'response', or 'all'`)
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
216
387
|
|
|
217
388
|
// Wait for all subscriptions to complete
|
|
218
389
|
await Promise.all(
|
|
219
|
-
|
|
390
|
+
topicsToSubscribe.map((topic) => {
|
|
220
391
|
return new Promise((resolve, reject) => {
|
|
221
392
|
this.mqttClient.subscribe(topic, (err) => {
|
|
222
393
|
if (err) {
|
|
@@ -232,6 +403,14 @@ export class YotoMqttClient extends EventEmitter {
|
|
|
232
403
|
)
|
|
233
404
|
}
|
|
234
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Subscribe to device topics (internal - used by autoSubscribe)
|
|
408
|
+
* @returns {Promise<void>}
|
|
409
|
+
*/
|
|
410
|
+
async #subscribe () {
|
|
411
|
+
return this.subscribe('all')
|
|
412
|
+
}
|
|
413
|
+
|
|
235
414
|
/**
|
|
236
415
|
* Handle incoming MQTT message
|
|
237
416
|
* @param {string} topic - MQTT topic
|
|
@@ -245,21 +424,22 @@ export class YotoMqttClient extends EventEmitter {
|
|
|
245
424
|
return
|
|
246
425
|
}
|
|
247
426
|
|
|
248
|
-
// Ignore unknown message types
|
|
249
|
-
if (messageType === 'unknown') {
|
|
250
|
-
return
|
|
251
|
-
}
|
|
252
|
-
|
|
253
427
|
try {
|
|
254
428
|
const payload = JSON.parse(message.toString())
|
|
255
429
|
|
|
256
|
-
// Emit typed events based on message type
|
|
430
|
+
// Emit typed events based on message type, including raw topic
|
|
257
431
|
if (messageType === 'events') {
|
|
258
|
-
this.emit('events', /** @type {YotoEventsMessage} */ (payload))
|
|
432
|
+
this.emit('events', topic, /** @type {YotoEventsMessage} */ (payload))
|
|
259
433
|
} else if (messageType === 'status') {
|
|
260
|
-
this.emit('status', /** @type {YotoStatusMessage} */ (payload))
|
|
434
|
+
this.emit('status', topic, /** @type {YotoStatusMessage} */ (payload))
|
|
435
|
+
} else if (messageType === 'status-legacy') {
|
|
436
|
+
// Legacy status topic contains lifecycle events (shutdown, startup) and full hardware diagnostics
|
|
437
|
+
// The documented /data/status topic does not include these critical lifecycle fields
|
|
438
|
+
this.emit('status-legacy', topic, /** @type {YotoStatusLegacyMessage} */ (payload))
|
|
261
439
|
} else if (messageType === 'response') {
|
|
262
|
-
this.emit('response', /** @type {YotoResponseMessage} */ (payload))
|
|
440
|
+
this.emit('response', topic, /** @type {YotoResponseMessage} */ (payload))
|
|
441
|
+
} else if (messageType === 'unknown') {
|
|
442
|
+
this.emit('unknown', topic, payload)
|
|
263
443
|
}
|
|
264
444
|
} catch (err) {
|
|
265
445
|
const error = /** @type {Error} */ (err)
|
|
@@ -346,20 +526,22 @@ export class YotoMqttClient extends EventEmitter {
|
|
|
346
526
|
|
|
347
527
|
/**
|
|
348
528
|
* Request current events from device
|
|
529
|
+
* @param {string} [body=''] - Optional request body for tracking/identification
|
|
349
530
|
* @returns {Promise<void>}
|
|
350
531
|
*/
|
|
351
|
-
async requestEvents () {
|
|
532
|
+
async requestEvents (body = '') {
|
|
352
533
|
const topic = getEventsRequestTopic(this.deviceId)
|
|
353
|
-
return this.#publish(topic,
|
|
534
|
+
return this.#publish(topic, body)
|
|
354
535
|
}
|
|
355
536
|
|
|
356
537
|
/**
|
|
357
538
|
* Request current status from device
|
|
539
|
+
* @param {string} [body=''] - Optional request body for tracking/identification
|
|
358
540
|
* @returns {Promise<void>}
|
|
359
541
|
*/
|
|
360
|
-
async requestStatus () {
|
|
542
|
+
async requestStatus (body = '') {
|
|
361
543
|
const topic = getStatusRequestTopic(this.deviceId)
|
|
362
|
-
return this.#publish(topic,
|
|
544
|
+
return this.#publish(topic, body)
|
|
363
545
|
}
|
|
364
546
|
|
|
365
547
|
/**
|
package/lib/mqtt/commands.d.ts
CHANGED
|
@@ -1,7 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MQTT Command Builders for Yoto Players
|
|
3
|
+
*
|
|
4
|
+
* Type-safe builders for constructing MQTT command payloads
|
|
5
|
+
* @see https://yoto.dev/players-mqtt/
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Volume command payload
|
|
9
|
+
* @see https://yoto.dev/players-mqtt/mqtt-docs/#deviceidcommandvolumeset
|
|
10
|
+
* @typedef {Object} YotoVolumeCommand
|
|
11
|
+
* @property {number} volume - Volume level [0-100]
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Ambient light command payload
|
|
15
|
+
* @see https://yoto.dev/players-mqtt/mqtt-docs/#deviceidcommandambientsset
|
|
16
|
+
* @typedef {Object} YotoAmbientCommand
|
|
17
|
+
* @property {number} r - Red intensity [0-255]
|
|
18
|
+
* @property {number} g - Green intensity [0-255]
|
|
19
|
+
* @property {number} b - Blue intensity [0-255]
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Sleep timer command payload
|
|
23
|
+
* @see https://yoto.dev/players-mqtt/mqtt-docs/#deviceidcommandsleep-timerset
|
|
24
|
+
* @typedef {Object} YotoSleepTimerCommand
|
|
25
|
+
* @property {number} seconds - Timer duration in seconds (0 to disable)
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Card start command payload
|
|
29
|
+
* @see https://yoto.dev/players-mqtt/mqtt-docs/#deviceidcommandcardstart
|
|
30
|
+
* @typedef {Object} YotoCardStartCommand
|
|
31
|
+
* @property {string} uri - Card URI (e.g., "https://yoto.io/<cardID>")
|
|
32
|
+
* @property {string} [chapterKey] - Chapter to start from
|
|
33
|
+
* @property {string} [trackKey] - Track to start from
|
|
34
|
+
* @property {number} [secondsIn] - Playback start offset in seconds
|
|
35
|
+
* @property {number} [cutOff] - Playback stop offset in seconds
|
|
36
|
+
* @property {boolean} [anyButtonStop] - Whether button press stops playback
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Bluetooth command payload
|
|
40
|
+
* @see https://yoto.dev/players-mqtt/mqtt-docs/#deviceidcommandbluetooth
|
|
41
|
+
* @typedef {Object} YotoBluetoothCommand
|
|
42
|
+
* @property {string} [action] - Bluetooth action (e.g., "on")
|
|
43
|
+
* @property {boolean | string} [mode] - Bluetooth mode (true for audio source, "bt_speaker" for sink)
|
|
44
|
+
* @property {number} [rssi] - RSSI threshold for auto-connect
|
|
45
|
+
* @property {string} [name] - Target Bluetooth device name
|
|
46
|
+
* @property {string} [mac] - Target Bluetooth MAC address
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Display preview command payload
|
|
50
|
+
* @see https://yoto.dev/players-mqtt/mqtt-docs/#deviceidcommanddisplaypreview
|
|
51
|
+
* @typedef {Object} YotoDisplayPreviewCommand
|
|
52
|
+
* @property {string} uri - Filepath to icon asset
|
|
53
|
+
* @property {number} timeout - Display duration in seconds
|
|
54
|
+
* @property {0 | 1} animated - Whether icon is animated (1) or static (0)
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* Create a volume set command
|
|
58
|
+
* @param {number} volume - Volume level [0-100]
|
|
59
|
+
* @returns {YotoVolumeCommand}
|
|
60
|
+
* @throws {Error} If volume is out of range
|
|
61
|
+
*/
|
|
1
62
|
export function createVolumeCommand(volume: number): YotoVolumeCommand;
|
|
63
|
+
/**
|
|
64
|
+
* Create an ambient light set command
|
|
65
|
+
* @param {number} r - Red intensity [0-255]
|
|
66
|
+
* @param {number} g - Green intensity [0-255]
|
|
67
|
+
* @param {number} b - Blue intensity [0-255]
|
|
68
|
+
* @returns {YotoAmbientCommand}
|
|
69
|
+
* @throws {Error} If any color value is out of range
|
|
70
|
+
*/
|
|
2
71
|
export function createAmbientCommand(r: number, g: number, b: number): YotoAmbientCommand;
|
|
72
|
+
/**
|
|
73
|
+
* Create an ambient light command from hex color
|
|
74
|
+
* @param {string} hexColor - Hex color string (e.g., "#FF0000" or "FF0000")
|
|
75
|
+
* @returns {YotoAmbientCommand}
|
|
76
|
+
* @throws {Error} If hex color is invalid
|
|
77
|
+
*/
|
|
3
78
|
export function createAmbientCommandFromHex(hexColor: string): YotoAmbientCommand;
|
|
79
|
+
/**
|
|
80
|
+
* Create a sleep timer set command
|
|
81
|
+
* @param {number} seconds - Timer duration in seconds (0 to disable)
|
|
82
|
+
* @returns {YotoSleepTimerCommand}
|
|
83
|
+
* @throws {Error} If seconds is negative
|
|
84
|
+
*/
|
|
4
85
|
export function createSleepTimerCommand(seconds: number): YotoSleepTimerCommand;
|
|
86
|
+
/**
|
|
87
|
+
* Create a card start command
|
|
88
|
+
* @param {Object} options - Card start options
|
|
89
|
+
* @param {string} options.uri - Card URI (e.g., "https://yoto.io/<cardID>")
|
|
90
|
+
* @param {string} [options.chapterKey] - Chapter to start from
|
|
91
|
+
* @param {string} [options.trackKey] - Track to start from
|
|
92
|
+
* @param {number} [options.secondsIn] - Playback start offset in seconds
|
|
93
|
+
* @param {number} [options.cutOff] - Playback stop offset in seconds
|
|
94
|
+
* @param {boolean} [options.anyButtonStop] - Whether button press stops playback
|
|
95
|
+
* @returns {YotoCardStartCommand}
|
|
96
|
+
* @throws {Error} If uri is missing
|
|
97
|
+
*/
|
|
5
98
|
export function createCardStartCommand(options: {
|
|
6
99
|
uri: string;
|
|
7
100
|
chapterKey?: string | undefined;
|
|
@@ -10,6 +103,16 @@ export function createCardStartCommand(options: {
|
|
|
10
103
|
cutOff?: number | undefined;
|
|
11
104
|
anyButtonStop?: boolean | undefined;
|
|
12
105
|
}): YotoCardStartCommand;
|
|
106
|
+
/**
|
|
107
|
+
* Create a bluetooth on command
|
|
108
|
+
* @param {Object} [options] - Bluetooth options
|
|
109
|
+
* @param {string} [options.action] - Bluetooth action (e.g., "on")
|
|
110
|
+
* @param {boolean | string} [options.mode] - Bluetooth mode (true for audio source, "bt_speaker" for sink)
|
|
111
|
+
* @param {number} [options.rssi] - RSSI threshold for auto-connect
|
|
112
|
+
* @param {string} [options.name] - Target Bluetooth device name
|
|
113
|
+
* @param {string} [options.mac] - Target Bluetooth MAC address
|
|
114
|
+
* @returns {YotoBluetoothCommand}
|
|
115
|
+
*/
|
|
13
116
|
export function createBluetoothOnCommand(options?: {
|
|
14
117
|
action?: string | undefined;
|
|
15
118
|
mode?: string | boolean | undefined;
|
|
@@ -17,8 +120,25 @@ export function createBluetoothOnCommand(options?: {
|
|
|
17
120
|
name?: string | undefined;
|
|
18
121
|
mac?: string | undefined;
|
|
19
122
|
}): YotoBluetoothCommand;
|
|
123
|
+
/**
|
|
124
|
+
* Create a bluetooth speaker mode command
|
|
125
|
+
* @returns {YotoBluetoothCommand}
|
|
126
|
+
*/
|
|
20
127
|
export function createBluetoothSpeakerCommand(): YotoBluetoothCommand;
|
|
128
|
+
/**
|
|
129
|
+
* Create a bluetooth audio source mode command
|
|
130
|
+
* @returns {YotoBluetoothCommand}
|
|
131
|
+
*/
|
|
21
132
|
export function createBluetoothAudioSourceCommand(): YotoBluetoothCommand;
|
|
133
|
+
/**
|
|
134
|
+
* Create a display preview command
|
|
135
|
+
* @param {Object} options - Display preview options
|
|
136
|
+
* @param {string} options.uri - Filepath to icon asset
|
|
137
|
+
* @param {number} options.timeout - Display duration in seconds
|
|
138
|
+
* @param {boolean} options.animated - Whether icon is animated
|
|
139
|
+
* @returns {YotoDisplayPreviewCommand}
|
|
140
|
+
* @throws {Error} If uri or timeout is missing
|
|
141
|
+
*/
|
|
22
142
|
export function createDisplayPreviewCommand(options: {
|
|
23
143
|
uri: string;
|
|
24
144
|
timeout: number;
|
|
@@ -35,35 +155,110 @@ export namespace commands {
|
|
|
35
155
|
export { createBluetoothAudioSourceCommand as bluetoothAudioSource };
|
|
36
156
|
export { createDisplayPreviewCommand as displayPreview };
|
|
37
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Volume command payload
|
|
160
|
+
*/
|
|
38
161
|
export type YotoVolumeCommand = {
|
|
162
|
+
/**
|
|
163
|
+
* - Volume level [0-100]
|
|
164
|
+
*/
|
|
39
165
|
volume: number;
|
|
40
166
|
};
|
|
167
|
+
/**
|
|
168
|
+
* Ambient light command payload
|
|
169
|
+
*/
|
|
41
170
|
export type YotoAmbientCommand = {
|
|
171
|
+
/**
|
|
172
|
+
* - Red intensity [0-255]
|
|
173
|
+
*/
|
|
42
174
|
r: number;
|
|
175
|
+
/**
|
|
176
|
+
* - Green intensity [0-255]
|
|
177
|
+
*/
|
|
43
178
|
g: number;
|
|
179
|
+
/**
|
|
180
|
+
* - Blue intensity [0-255]
|
|
181
|
+
*/
|
|
44
182
|
b: number;
|
|
45
183
|
};
|
|
184
|
+
/**
|
|
185
|
+
* Sleep timer command payload
|
|
186
|
+
*/
|
|
46
187
|
export type YotoSleepTimerCommand = {
|
|
188
|
+
/**
|
|
189
|
+
* - Timer duration in seconds (0 to disable)
|
|
190
|
+
*/
|
|
47
191
|
seconds: number;
|
|
48
192
|
};
|
|
193
|
+
/**
|
|
194
|
+
* Card start command payload
|
|
195
|
+
*/
|
|
49
196
|
export type YotoCardStartCommand = {
|
|
197
|
+
/**
|
|
198
|
+
* - Card URI (e.g., "https://yoto.io/<cardID>")
|
|
199
|
+
*/
|
|
50
200
|
uri: string;
|
|
201
|
+
/**
|
|
202
|
+
* - Chapter to start from
|
|
203
|
+
*/
|
|
51
204
|
chapterKey?: string;
|
|
205
|
+
/**
|
|
206
|
+
* - Track to start from
|
|
207
|
+
*/
|
|
52
208
|
trackKey?: string;
|
|
209
|
+
/**
|
|
210
|
+
* - Playback start offset in seconds
|
|
211
|
+
*/
|
|
53
212
|
secondsIn?: number;
|
|
213
|
+
/**
|
|
214
|
+
* - Playback stop offset in seconds
|
|
215
|
+
*/
|
|
54
216
|
cutOff?: number;
|
|
217
|
+
/**
|
|
218
|
+
* - Whether button press stops playback
|
|
219
|
+
*/
|
|
55
220
|
anyButtonStop?: boolean;
|
|
56
221
|
};
|
|
222
|
+
/**
|
|
223
|
+
* Bluetooth command payload
|
|
224
|
+
*/
|
|
57
225
|
export type YotoBluetoothCommand = {
|
|
226
|
+
/**
|
|
227
|
+
* - Bluetooth action (e.g., "on")
|
|
228
|
+
*/
|
|
58
229
|
action?: string;
|
|
230
|
+
/**
|
|
231
|
+
* - Bluetooth mode (true for audio source, "bt_speaker" for sink)
|
|
232
|
+
*/
|
|
59
233
|
mode?: boolean | string;
|
|
234
|
+
/**
|
|
235
|
+
* - RSSI threshold for auto-connect
|
|
236
|
+
*/
|
|
60
237
|
rssi?: number;
|
|
238
|
+
/**
|
|
239
|
+
* - Target Bluetooth device name
|
|
240
|
+
*/
|
|
61
241
|
name?: string;
|
|
242
|
+
/**
|
|
243
|
+
* - Target Bluetooth MAC address
|
|
244
|
+
*/
|
|
62
245
|
mac?: string;
|
|
63
246
|
};
|
|
247
|
+
/**
|
|
248
|
+
* Display preview command payload
|
|
249
|
+
*/
|
|
64
250
|
export type YotoDisplayPreviewCommand = {
|
|
251
|
+
/**
|
|
252
|
+
* - Filepath to icon asset
|
|
253
|
+
*/
|
|
65
254
|
uri: string;
|
|
255
|
+
/**
|
|
256
|
+
* - Display duration in seconds
|
|
257
|
+
*/
|
|
66
258
|
timeout: number;
|
|
259
|
+
/**
|
|
260
|
+
* - Whether icon is animated (1) or static (0)
|
|
261
|
+
*/
|
|
67
262
|
animated: 0 | 1;
|
|
68
263
|
};
|
|
69
264
|
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["commands.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["commands.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;GAKG;AAEH;;;;;;;GAOG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,4CAJW,MAAM,GACJ,iBAAiB,CAS7B;AAED;;;;;;;GAOG;AACH,wCANW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,kBAAkB,CAS9B;AAED;;;;;GAKG;AACH,sDAJW,MAAM,GACJ,kBAAkB,CAgB9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