yoto-nodejs-client 0.0.3 → 0.0.5

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 CHANGED
@@ -1144,7 +1144,7 @@ yoto-devices --device-id abc123 --mqtt --mqtt-timeout 10
1144
1144
  # Use YotoDeviceModel to monitor device (HTTP + MQTT)
1145
1145
  yoto-device-model --device-id abc123
1146
1146
 
1147
- # Interactive TUI for device control (Prototype/WIP)
1147
+ # Interactive TUI for device control (Prototype/WIP/Unpublished)
1148
1148
  yoto-device-tui --device-id abc123
1149
1149
  ```
1150
1150
 
package/bin/device-tui.js CHANGED
File without changes
package/bin/devices.js CHANGED
@@ -165,6 +165,40 @@ async function main () {
165
165
  accessToken
166
166
  })
167
167
 
168
+ // Setup interactive keyboard input (once, before connecting)
169
+ readline.emitKeypressEvents(process.stdin)
170
+ if (process.stdin.isTTY) {
171
+ process.stdin.setRawMode(true)
172
+ }
173
+
174
+ process.stdin.on('keypress', (_str, key) => {
175
+ if (key.ctrl && key.name === 'c') {
176
+ cleanup()
177
+ return
178
+ }
179
+
180
+ if (key.name === 's') {
181
+ const requestId = `interactive-${Date.now()}`
182
+ console.log(`\n⌨️ Requesting status [${requestId}]...`)
183
+ mqttClient.requestStatus(requestId).catch(err => {
184
+ console.error('⚠️ Failed to request status:', err.message)
185
+ })
186
+ } else if (key.name === 'e') {
187
+ const requestId = `interactive-${Date.now()}`
188
+ console.log(`\n⌨️ Requesting events [${requestId}]...`)
189
+ mqttClient.requestEvents(requestId).catch(err => {
190
+ console.error('⚠️ Failed to request events:', err.message)
191
+ })
192
+ } else if (key.name === 'return') {
193
+ const timestamp = new Date().toISOString()
194
+ console.log(`\n${'─'.repeat(60)}`)
195
+ console.log(`📍 MARKER [${timestamp}]`)
196
+ console.log(`${'─'.repeat(60)}\n`)
197
+ } else if (key.name === 'q') {
198
+ cleanup()
199
+ }
200
+ })
201
+
168
202
  // Setup message handlers
169
203
  mqttClient.on('connected', () => {
170
204
  console.log('✅ Connected to MQTT broker')
@@ -211,40 +245,6 @@ async function main () {
211
245
  }
212
246
 
213
247
  console.log() // Add blank line for spacing
214
-
215
- // Setup interactive keyboard input
216
- readline.emitKeypressEvents(process.stdin)
217
- if (process.stdin.isTTY) {
218
- process.stdin.setRawMode(true)
219
- }
220
-
221
- process.stdin.on('keypress', (_str, key) => {
222
- if (key.ctrl && key.name === 'c') {
223
- cleanup()
224
- return
225
- }
226
-
227
- if (key.name === 's') {
228
- const requestId = `interactive-${Date.now()}`
229
- console.log(`\n⌨️ Requesting status [${requestId}]...`)
230
- mqttClient.requestStatus(requestId).catch(err => {
231
- console.error('⚠️ Failed to request status:', err.message)
232
- })
233
- } else if (key.name === 'e') {
234
- const requestId = `interactive-${Date.now()}`
235
- console.log(`\n⌨️ Requesting events [${requestId}]...`)
236
- mqttClient.requestEvents(requestId).catch(err => {
237
- console.error('⚠️ Failed to request events:', err.message)
238
- })
239
- } else if (key.name === 'return') {
240
- const timestamp = new Date().toISOString()
241
- console.log(`\n${'─'.repeat(60)}`)
242
- console.log(`📍 MARKER [${timestamp}]`)
243
- console.log(`${'─'.repeat(60)}\n`)
244
- } else if (key.name === 'q') {
245
- cleanup()
246
- }
247
- })
248
248
  })
249
249
 
250
250
  mqttClient.on('events', (topic, payload) => {
@@ -370,15 +370,15 @@ export type YotoMqttStatus = {
370
370
  */
371
371
  headphones: boolean;
372
372
  /**
373
- * - Current display brightness
373
+ * - Current display brightness (Integer 0-100)
374
374
  */
375
375
  dnowBrightness: number;
376
376
  /**
377
- * - Day brightness setting
377
+ * - Day brightness setting (Integer 0-100)
378
378
  */
379
379
  dayBright: number;
380
380
  /**
381
- * - Night brightness setting
381
+ * - Night brightness setting (Integer 0-100)
382
382
  */
383
383
  nightBright: number;
384
384
  /**
@@ -70,9 +70,9 @@
70
70
  * @property {0 | 1 | 2} cardInserted - Card insertion state (0=none, 1=physical, 2=remote)
71
71
  * @property {number} playingStatus - Playing status code
72
72
  * @property {boolean} headphones - Headphones connected
73
- * @property {number} dnowBrightness - Current display brightness
74
- * @property {number} dayBright - Day brightness setting
75
- * @property {number} nightBright - Night brightness setting
73
+ * @property {number} dnowBrightness - Current display brightness (Integer 0-100)
74
+ * @property {number} dayBright - Day brightness setting (Integer 0-100)
75
+ * @property {number} nightBright - Night brightness setting (Integer 0-100)
76
76
  * @property {boolean} bluetoothHp - Bluetooth headphones enabled
77
77
  * @property {number} volume - System/max volume level (0-100 percentage, represents 0-16 hardware scale, maps to volumeMax in events)
78
78
  * @property {number} userVolume - User volume setting (0-100 percentage, represents 0-16 hardware scale, maps to volume in events)
package/lib/pkg.d.cts CHANGED
@@ -7,12 +7,12 @@ export const pkg: {
7
7
  url: string;
8
8
  };
9
9
  dependencies: {
10
- "@unblessed/node": string;
11
10
  "jwt-decode": string;
12
11
  mqtt: string;
13
12
  undici: string;
14
13
  };
15
14
  devDependencies: {
15
+ "@unblessed/node": string;
16
16
  "@types/node": string;
17
17
  "@voxpelli/tsconfig": string;
18
18
  argsclopts: string;
@@ -42,7 +42,6 @@ export const pkg: {
42
42
  "yoto-refresh-token": string;
43
43
  "yoto-devices": string;
44
44
  "yoto-device-model": string;
45
- "yoto-device-tui": string;
46
45
  "yoto-content": string;
47
46
  "yoto-groups": string;
48
47
  "yoto-icons": string;
@@ -51,7 +51,7 @@ export const NIGHTLIGHT_COLORS: {
51
51
  * @property {string} nightlightMode - Current nightlight color (6-digit hex color like '0xff5733' or 'off'). Most accurate value comes from MQTT status. HTTP endpoint returns either 'off' or '0x000000'. Note: This is the live status; configured colors are in config.ambientColour (day) and config.nightAmbientColour (night). Only available on devices with colored nightlight (v3).
52
52
  * @property {string | number | null} temperatureCelsius - Temperature in Celsius (null if not supported, can be number, string "0", or "notSupported") TODO: Number or null only
53
53
  * @property {number} ambientLightSensorReading - Ambient light sensor reading TODO: Figure out units
54
- * @property {number | null} displayBrightness - Current display brightness (null when device is off) - from YotoDeviceFullStatus (dnowBrightness) TODO: Figure out units
54
+ * @property {number | null} displayBrightness - Current display brightness (null when device is off) - from YotoDeviceFullStatus (dnowBrightness integer 0-100)
55
55
  * @property {'12' | '24' | null} timeFormat - Time format preference - from YotoDeviceFullStatus
56
56
  * @property {number} uptime - Device uptime in seconds
57
57
  * @property {string} updatedAt - ISO 8601 timestamp of last update
@@ -392,7 +392,7 @@ export type YotoDeviceStatus = {
392
392
  */
393
393
  ambientLightSensorReading: number;
394
394
  /**
395
- * - Current display brightness (null when device is off) - from YotoDeviceFullStatus (dnowBrightness) TODO: Figure out units
395
+ * - Current display brightness (null when device is off) - from YotoDeviceFullStatus (dnowBrightness integer 0-100)
396
396
  */
397
397
  displayBrightness: number | null;
398
398
  /**
@@ -133,7 +133,7 @@ export function getNightlightColorName (colorValue) {
133
133
  * @property {string} nightlightMode - Current nightlight color (6-digit hex color like '0xff5733' or 'off'). Most accurate value comes from MQTT status. HTTP endpoint returns either 'off' or '0x000000'. Note: This is the live status; configured colors are in config.ambientColour (day) and config.nightAmbientColour (night). Only available on devices with colored nightlight (v3).
134
134
  * @property {string | number | null} temperatureCelsius - Temperature in Celsius (null if not supported, can be number, string "0", or "notSupported") TODO: Number or null only
135
135
  * @property {number} ambientLightSensorReading - Ambient light sensor reading TODO: Figure out units
136
- * @property {number | null} displayBrightness - Current display brightness (null when device is off) - from YotoDeviceFullStatus (dnowBrightness) TODO: Figure out units
136
+ * @property {number | null} displayBrightness - Current display brightness (null when device is off) - from YotoDeviceFullStatus (dnowBrightness integer 0-100)
137
137
  * @property {'12' | '24' | null} timeFormat - Time format preference - from YotoDeviceFullStatus
138
138
  * @property {number} uptime - Device uptime in seconds
139
139
  * @property {string} updatedAt - ISO 8601 timestamp of last update
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "yoto-nodejs-client",
3
3
  "description": "(Unofficial) Node.js client for the Yoto API with automatic token refresh, MQTT device communication, and TypeScript support",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "author": "Bret Comnes <bcomnes@gmail.com> (https://bret.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/bcomnes/yoto-nodejs-client/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@unblessed/node": "1.0.0-alpha.23",
11
10
  "jwt-decode": "^4.0.0",
12
11
  "mqtt": "^5.14.1",
13
12
  "undici": "^7.16.0"
14
13
  },
15
14
  "devDependencies": {
15
+ "@unblessed/node": "1.0.0-alpha.23",
16
16
  "@types/node": "^25.0.0",
17
17
  "@voxpelli/tsconfig": "^16.1.0",
18
18
  "argsclopts": "^1.0.5",
@@ -61,7 +61,6 @@
61
61
  "yoto-refresh-token": "./bin/refresh-token.js",
62
62
  "yoto-devices": "./bin/devices.js",
63
63
  "yoto-device-model": "./bin/device-model.js",
64
- "yoto-device-tui": "./bin/device-tui.js",
65
64
  "yoto-content": "./bin/content.js",
66
65
  "yoto-groups": "./bin/groups.js",
67
66
  "yoto-icons": "./bin/icons.js"