meross-iot 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +153 -0
  4. package/index.d.ts +2344 -0
  5. package/index.js +131 -0
  6. package/lib/controller/device.js +1317 -0
  7. package/lib/controller/features/alarm-feature.js +89 -0
  8. package/lib/controller/features/child-lock-feature.js +61 -0
  9. package/lib/controller/features/config-feature.js +54 -0
  10. package/lib/controller/features/consumption-feature.js +210 -0
  11. package/lib/controller/features/control-feature.js +62 -0
  12. package/lib/controller/features/diffuser-feature.js +411 -0
  13. package/lib/controller/features/digest-timer-feature.js +22 -0
  14. package/lib/controller/features/digest-trigger-feature.js +22 -0
  15. package/lib/controller/features/dnd-feature.js +79 -0
  16. package/lib/controller/features/electricity-feature.js +144 -0
  17. package/lib/controller/features/encryption-feature.js +259 -0
  18. package/lib/controller/features/garage-feature.js +337 -0
  19. package/lib/controller/features/hub-feature.js +687 -0
  20. package/lib/controller/features/light-feature.js +408 -0
  21. package/lib/controller/features/presence-sensor-feature.js +297 -0
  22. package/lib/controller/features/roller-shutter-feature.js +456 -0
  23. package/lib/controller/features/runtime-feature.js +74 -0
  24. package/lib/controller/features/screen-feature.js +67 -0
  25. package/lib/controller/features/sensor-history-feature.js +47 -0
  26. package/lib/controller/features/smoke-config-feature.js +50 -0
  27. package/lib/controller/features/spray-feature.js +166 -0
  28. package/lib/controller/features/system-feature.js +269 -0
  29. package/lib/controller/features/temp-unit-feature.js +55 -0
  30. package/lib/controller/features/thermostat-feature.js +804 -0
  31. package/lib/controller/features/timer-feature.js +507 -0
  32. package/lib/controller/features/toggle-feature.js +223 -0
  33. package/lib/controller/features/trigger-feature.js +333 -0
  34. package/lib/controller/hub-device.js +185 -0
  35. package/lib/controller/subdevice.js +1537 -0
  36. package/lib/device-factory.js +463 -0
  37. package/lib/error-budget.js +138 -0
  38. package/lib/http-api.js +766 -0
  39. package/lib/manager.js +1609 -0
  40. package/lib/model/channel-info.js +79 -0
  41. package/lib/model/constants.js +119 -0
  42. package/lib/model/enums.js +819 -0
  43. package/lib/model/exception.js +363 -0
  44. package/lib/model/http/device.js +215 -0
  45. package/lib/model/http/error-codes.js +121 -0
  46. package/lib/model/http/exception.js +151 -0
  47. package/lib/model/http/subdevice.js +133 -0
  48. package/lib/model/push/alarm.js +112 -0
  49. package/lib/model/push/bind.js +97 -0
  50. package/lib/model/push/common.js +282 -0
  51. package/lib/model/push/diffuser-light.js +100 -0
  52. package/lib/model/push/diffuser-spray.js +83 -0
  53. package/lib/model/push/factory.js +229 -0
  54. package/lib/model/push/generic.js +115 -0
  55. package/lib/model/push/hub-battery.js +59 -0
  56. package/lib/model/push/hub-mts100-all.js +64 -0
  57. package/lib/model/push/hub-mts100-mode.js +59 -0
  58. package/lib/model/push/hub-mts100-temperature.js +62 -0
  59. package/lib/model/push/hub-online.js +59 -0
  60. package/lib/model/push/hub-sensor-alert.js +61 -0
  61. package/lib/model/push/hub-sensor-all.js +59 -0
  62. package/lib/model/push/hub-sensor-smoke.js +110 -0
  63. package/lib/model/push/hub-sensor-temphum.js +62 -0
  64. package/lib/model/push/hub-subdevicelist.js +50 -0
  65. package/lib/model/push/hub-togglex.js +60 -0
  66. package/lib/model/push/index.js +81 -0
  67. package/lib/model/push/online.js +53 -0
  68. package/lib/model/push/presence-study.js +61 -0
  69. package/lib/model/push/sensor-latestx.js +106 -0
  70. package/lib/model/push/timerx.js +63 -0
  71. package/lib/model/push/togglex.js +78 -0
  72. package/lib/model/push/triggerx.js +62 -0
  73. package/lib/model/push/unbind.js +34 -0
  74. package/lib/model/push/water-leak.js +107 -0
  75. package/lib/model/states/diffuser-light-state.js +119 -0
  76. package/lib/model/states/diffuser-spray-state.js +58 -0
  77. package/lib/model/states/garage-door-state.js +71 -0
  78. package/lib/model/states/index.js +38 -0
  79. package/lib/model/states/light-state.js +134 -0
  80. package/lib/model/states/presence-sensor-state.js +239 -0
  81. package/lib/model/states/roller-shutter-state.js +82 -0
  82. package/lib/model/states/spray-state.js +58 -0
  83. package/lib/model/states/thermostat-state.js +297 -0
  84. package/lib/model/states/timer-state.js +192 -0
  85. package/lib/model/states/toggle-state.js +105 -0
  86. package/lib/model/states/trigger-state.js +155 -0
  87. package/lib/subscription.js +587 -0
  88. package/lib/utilities/conversion.js +62 -0
  89. package/lib/utilities/debug.js +165 -0
  90. package/lib/utilities/mqtt.js +152 -0
  91. package/lib/utilities/network.js +53 -0
  92. package/lib/utilities/options.js +64 -0
  93. package/lib/utilities/request-queue.js +161 -0
  94. package/lib/utilities/ssid.js +37 -0
  95. package/lib/utilities/state-changes.js +66 -0
  96. package/lib/utilities/stats.js +687 -0
  97. package/lib/utilities/timer.js +310 -0
  98. package/lib/utilities/trigger.js +286 -0
  99. package/package.json +73 -0
@@ -0,0 +1,819 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Transport mode for device communication.
5
+ *
6
+ * Determines how the library communicates with Meross devices. Each mode
7
+ * uses different protocols and network paths, affecting latency, reliability,
8
+ * and whether remote access is required.
9
+ *
10
+ * @enum {number}
11
+ * @readonly
12
+ */
13
+ const TransportMode = {
14
+ /**
15
+ * MQTT-only communication.
16
+ *
17
+ * All commands route through the Meross cloud MQTT broker. Required when
18
+ * devices are not on the local network or when local network access is
19
+ * unavailable, but introduces cloud latency compared to direct LAN communication.
20
+ *
21
+ * @constant {number}
22
+ */
23
+ MQTT_ONLY: 0,
24
+
25
+ /**
26
+ * LAN HTTP with MQTT fallback.
27
+ *
28
+ * Attempts direct HTTP communication over the local network first for lower
29
+ * latency. Falls back to MQTT if the device is unreachable locally, enabling
30
+ * both fast local access and remote access when needed.
31
+ *
32
+ * @constant {number}
33
+ */
34
+ LAN_HTTP_FIRST: 1,
35
+
36
+ /**
37
+ * LAN HTTP for reads only, MQTT for writes.
38
+ *
39
+ * Uses LAN HTTP for read operations (GET requests) to reduce latency for
40
+ * status queries. Write operations (SET requests) route through MQTT to
41
+ * ensure consistency across multiple clients and enable remote access.
42
+ *
43
+ * @constant {number}
44
+ */
45
+ LAN_HTTP_FIRST_ONLY_GET: 2
46
+ };
47
+
48
+ /**
49
+ * Thermostat operating mode.
50
+ *
51
+ * Defines the working mode of the thermostat. Each mode determines how
52
+ * the device maintains temperature and which temperature parameters are used.
53
+ *
54
+ * @enum {number}
55
+ * @readonly
56
+ */
57
+ const ThermostatMode = {
58
+ /**
59
+ * Heating mode.
60
+ *
61
+ * Working mode: Heating. Device only heats to reach the target temperature.
62
+ *
63
+ * @constant {number}
64
+ */
65
+ HEAT: 0,
66
+
67
+ /**
68
+ * Cooling mode.
69
+ *
70
+ * Working mode: Cooling. Device only cools to reach the target temperature.
71
+ *
72
+ * @constant {number}
73
+ */
74
+ COOL: 1,
75
+
76
+ /**
77
+ * Economy mode.
78
+ *
79
+ * Working mode: Economic. Reduces energy consumption by operating at
80
+ * economic temperature settings.
81
+ *
82
+ * @constant {number}
83
+ */
84
+ ECONOMY: 2,
85
+
86
+ /**
87
+ * Auto mode.
88
+ *
89
+ * Working mode: Automatic. Device automatically selects heating or cooling
90
+ * as needed to maintain the target temperature.
91
+ *
92
+ * @constant {number}
93
+ */
94
+ AUTO: 3,
95
+
96
+ /**
97
+ * Manual mode.
98
+ *
99
+ * Working mode: Manual. User directly controls heating and cooling without
100
+ * automatic temperature regulation.
101
+ *
102
+ * @constant {number}
103
+ */
104
+ MANUAL: 4
105
+ };
106
+
107
+ /**
108
+ * Thermostat working status.
109
+ *
110
+ * Indicates the current active operation when the thermostat is maintaining
111
+ * temperature. Used with `ThermostatMode.AUTO` to determine which system
112
+ * is currently active. Note: 0 indicates Idle status.
113
+ *
114
+ * @enum {number}
115
+ * @readonly
116
+ * @see {@link ThermostatMode}
117
+ */
118
+ const ThermostatWorkingMode = {
119
+ /**
120
+ * Heating is active.
121
+ *
122
+ * Working status: Heating. Indicates the thermostat is currently heating
123
+ * to reach the target temperature.
124
+ *
125
+ * @constant {number}
126
+ */
127
+ HEAT: 1,
128
+
129
+ /**
130
+ * Cooling is active.
131
+ *
132
+ * Working status: Cooling. Indicates the thermostat is currently cooling
133
+ * to reach the target temperature.
134
+ *
135
+ * @constant {number}
136
+ */
137
+ COOL: 2
138
+ };
139
+
140
+ /**
141
+ * Thermostat Mode B state.
142
+ *
143
+ * Indicates whether the thermostat is actively operating or idle. Some
144
+ * thermostat models use this field instead of or in addition to
145
+ * `ThermostatWorkingMode` to report operational status.
146
+ *
147
+ * @enum {number}
148
+ * @readonly
149
+ */
150
+ const ThermostatModeBState = {
151
+ /**
152
+ * Actively heating or cooling.
153
+ *
154
+ * Indicates the thermostat is currently operating to change the temperature.
155
+ *
156
+ * @constant {number}
157
+ */
158
+ HEATING_COOLING: 1,
159
+
160
+ /**
161
+ * Idle - not currently heating or cooling.
162
+ *
163
+ * Indicates the thermostat has reached the target temperature or is waiting
164
+ * for conditions that require heating or cooling.
165
+ *
166
+ * @constant {number}
167
+ */
168
+ NOT_HEATING_COOLING: 2
169
+ };
170
+
171
+ /**
172
+ * Light mode for RGB-capable lights.
173
+ *
174
+ * Defines which color control method the light uses based on capacity flags.
175
+ * Each mode determines which parameters are valid (RGB values, color temperature,
176
+ * or brightness only). These values correspond to capacity bit flags.
177
+ *
178
+ * @enum {number}
179
+ * @readonly
180
+ */
181
+ const LightMode = {
182
+ /**
183
+ * RGB color mode.
184
+ *
185
+ * Capacity flag 0x1: RGB field is valid. Full color control using red, green,
186
+ * and blue component values (0x0~0xFFFFFF). Requires RGB parameter.
187
+ *
188
+ * @constant {number}
189
+ */
190
+ MODE_RGB: 1,
191
+
192
+ /**
193
+ * Color temperature mode.
194
+ *
195
+ * Capacity flag 0x2: Temperature field is valid. Controls color temperature
196
+ * along the warm-to-cool white spectrum. Value range is 1~100 where larger
197
+ * values are colder (1 is yellowest, 100 is coldest).
198
+ *
199
+ * @constant {number}
200
+ */
201
+ MODE_TEMPERATURE: 2,
202
+
203
+ /**
204
+ * Luminance-only mode.
205
+ *
206
+ * Capacity flag 0x4: Luminance field is valid. Controls brightness only
207
+ * without color control. Value range is 1-100 (or 0-100 for WWA standard).
208
+ *
209
+ * @constant {number}
210
+ */
211
+ MODE_LUMINANCE: 4
212
+ };
213
+
214
+ /**
215
+ * Light mode for diffuser devices.
216
+ *
217
+ * Defines how the LED lights on a diffuser device operate. Diffusers support
218
+ * RGB cycle mode, fixed RGB colors, or night light mode (warm white).
219
+ *
220
+ * @enum {number}
221
+ * @readonly
222
+ */
223
+ const DiffuserLightMode = {
224
+ /**
225
+ * RGB cycle mode.
226
+ *
227
+ * Colors cycle automatically through a predefined sequence without
228
+ * requiring continuous updates.
229
+ *
230
+ * @constant {number}
231
+ */
232
+ ROTATING_COLORS: 0,
233
+
234
+ /**
235
+ * Fixed color mode.
236
+ *
237
+ * Fixed RGB color. Displays a specific RGB color until changed.
238
+ * Requires RGB parameter. This parameter is only valid when mode is fixed color.
239
+ *
240
+ * @constant {number}
241
+ */
242
+ FIXED_RGB: 1,
243
+
244
+ /**
245
+ * Night light mode.
246
+ *
247
+ * Fixed to warm white light with default brightness 100%.
248
+ * Used for night light functionality.
249
+ *
250
+ * @constant {number}
251
+ */
252
+ FIXED_LUMINANCE: 2
253
+ };
254
+
255
+ /**
256
+ * Spray mode for diffuser devices (mod100).
257
+ *
258
+ * Controls the mist/spray output intensity from a diffuser device.
259
+ * mod100 supports 3 modes. The newly added mod150 continues to use 'mod100'
260
+ * because the corresponding mode items are consistent.
261
+ *
262
+ * @enum {number}
263
+ * @readonly
264
+ */
265
+ const DiffuserSprayMode = {
266
+ /**
267
+ * Small spray.
268
+ *
269
+ * Lower mist output rate, suitable for smaller spaces or extended operation.
270
+ *
271
+ * @constant {number}
272
+ */
273
+ LIGHT: 0,
274
+
275
+ /**
276
+ * Large spray.
277
+ *
278
+ * Higher mist output rate, suitable for larger spaces or faster diffusion.
279
+ *
280
+ * @constant {number}
281
+ */
282
+ STRONG: 1,
283
+
284
+ /**
285
+ * Spray off.
286
+ *
287
+ * Mist/spray output is turned off.
288
+ *
289
+ * @constant {number}
290
+ */
291
+ OFF: 2
292
+ };
293
+
294
+ /**
295
+ * Spray mode for spray devices.
296
+ *
297
+ * Controls the spray pattern for devices that spray liquids (e.g., misting devices).
298
+ * Determines whether spraying is continuous or cycles on and off.
299
+ *
300
+ * @enum {number}
301
+ * @readonly
302
+ */
303
+ const SprayMode = {
304
+ /**
305
+ * Spray disabled.
306
+ *
307
+ * Spray output is turned off.
308
+ *
309
+ * @constant {number}
310
+ */
311
+ OFF: 0,
312
+
313
+ /**
314
+ * Continuous spray.
315
+ *
316
+ * Sprays continuously without interruption until manually stopped or
317
+ * the device runs out of liquid. Provides consistent output without
318
+ * cycling.
319
+ *
320
+ * @constant {number}
321
+ */
322
+ CONTINUOUS: 1,
323
+
324
+ /**
325
+ * Intermittent spray.
326
+ *
327
+ * Sprays in repeating on/off cycles to conserve liquid and reduce
328
+ * over-saturation. The device automatically cycles between spraying
329
+ * and pausing.
330
+ *
331
+ * @constant {number}
332
+ */
333
+ INTERMITTENT: 2
334
+ };
335
+
336
+ /**
337
+ * Roller shutter status/state.
338
+ *
339
+ * Indicates the current motion status of the curtain controller.
340
+ * Used to determine if the shutter is moving, stopped, or in an unknown state.
341
+ *
342
+ * @enum {number}
343
+ * @readonly
344
+ */
345
+ const RollerShutterStatus = {
346
+ /**
347
+ * Unknown status.
348
+ *
349
+ * State could not be determined, typically due to communication issues,
350
+ * device initialization, or when the device has not yet reported its status.
351
+ *
352
+ * @constant {number}
353
+ */
354
+ UNKNOWN: -1,
355
+
356
+ /**
357
+ * Stopped.
358
+ *
359
+ * Indicates the current motion status is stopped. The shutter is not moving.
360
+ *
361
+ * @constant {number}
362
+ */
363
+ IDLE: 0,
364
+
365
+ /**
366
+ * Opening.
367
+ *
368
+ * Indicates the current motion status is opening. The shutter is moving
369
+ * to the open position.
370
+ *
371
+ * @constant {number}
372
+ */
373
+ OPENING: 1,
374
+
375
+ /**
376
+ * Closing.
377
+ *
378
+ * Indicates the current motion status is closing. The shutter is moving
379
+ * to the closed position.
380
+ *
381
+ * @constant {number}
382
+ */
383
+ CLOSING: 2
384
+ };
385
+
386
+ /**
387
+ * Do Not Disturb (DND) mode.
388
+ *
389
+ * Currently mainly controls the on and off of the device LED light.
390
+ * When enabled, the device LED light is turned off.
391
+ *
392
+ * @enum {number}
393
+ * @readonly
394
+ */
395
+ const DNDMode = {
396
+ /**
397
+ * Do Not Disturb disabled.
398
+ *
399
+ * DNDMode off. Device LED light operates normally.
400
+ *
401
+ * @constant {number}
402
+ */
403
+ DND_DISABLED: 0,
404
+
405
+ /**
406
+ * Do Not Disturb enabled.
407
+ *
408
+ * DNDMode on. Device LED light is turned off.
409
+ *
410
+ * @constant {number}
411
+ */
412
+ DND_ENABLED: 1
413
+ };
414
+
415
+ /**
416
+ * Device online status.
417
+ *
418
+ * Indicates the online status of the device. Used to determine whether
419
+ * a device is reachable and operational, or if it's in a transitional
420
+ * state such as MQTT connecting or firmware upgrade.
421
+ *
422
+ * @enum {number}
423
+ * @readonly
424
+ */
425
+ const OnlineStatus = {
426
+ /**
427
+ * MQTT connecting.
428
+ *
429
+ * Device is in the process of connecting to the MQTT broker.
430
+ * This is the initial state before establishing connection.
431
+ *
432
+ * @constant {number}
433
+ */
434
+ NOT_ONLINE: 0,
435
+
436
+ /**
437
+ * Online.
438
+ *
439
+ * Device is online and connected. Commands can be sent successfully
440
+ * to the device.
441
+ *
442
+ * @constant {number}
443
+ */
444
+ ONLINE: 1,
445
+
446
+ /**
447
+ * Offline.
448
+ *
449
+ * Device is offline and unreachable. Indicates a connection loss.
450
+ * Commands may fail until connectivity is restored.
451
+ *
452
+ * @constant {number}
453
+ */
454
+ OFFLINE: 2,
455
+
456
+ /**
457
+ * Unknown.
458
+ *
459
+ * Status could not be determined, typically due to communication
460
+ * errors, incomplete device information, or when the device has not
461
+ * yet reported its status.
462
+ *
463
+ * @constant {number}
464
+ */
465
+ UNKNOWN: -1,
466
+
467
+ /**
468
+ * Upgrading.
469
+ *
470
+ * Device is currently upgrading firmware. The device may be unresponsive
471
+ * during this time and should not receive commands to avoid interrupting
472
+ * the upgrade process.
473
+ *
474
+ * @constant {number}
475
+ */
476
+ UPGRADING: 3
477
+ };
478
+
479
+ /**
480
+ * Smoke alarm status.
481
+ *
482
+ * Indicates the current status of a smoke detector device. Values represent
483
+ * normal operation, muted alarm conditions, or interconnection status for
484
+ * multi-device setups.
485
+ *
486
+ * @enum {number}
487
+ * @readonly
488
+ */
489
+ const SmokeAlarmStatus = {
490
+ /**
491
+ * Normal status.
492
+ *
493
+ * No alarms detected and device is operating normally. All sensors
494
+ * are functioning within expected parameters.
495
+ *
496
+ * @constant {number}
497
+ */
498
+ NORMAL: 23,
499
+
500
+ /**
501
+ * Temperature alarm muted.
502
+ *
503
+ * Temperature alarm has been silenced by user action. The alarm condition
504
+ * may still exist but audio alerts are suppressed. Visual indicators may
505
+ * still be active.
506
+ *
507
+ * @constant {number}
508
+ */
509
+ MUTE_TEMPERATURE_ALARM: 26,
510
+
511
+ /**
512
+ * Smoke alarm muted.
513
+ *
514
+ * Smoke alarm has been silenced by user action. The alarm condition
515
+ * may still exist but audio alerts are suppressed. Visual indicators
516
+ * may still be active.
517
+ *
518
+ * @constant {number}
519
+ */
520
+ MUTE_SMOKE_ALARM: 27,
521
+
522
+ /**
523
+ * Interconnection status.
524
+ *
525
+ * Indicates that interconnection/linkage status information is available.
526
+ * When status is 170, the `interConn` field indicates:
527
+ * - interConn = 0: Not interconnected (linkage not in progress)
528
+ * - interConn = 1: Interconnected (linkage in progress)
529
+ *
530
+ * This is not an alarm state, but a status indicator for the
531
+ * interconnection system that allows multiple smoke detectors to
532
+ * communicate and trigger each other.
533
+ *
534
+ * @constant {number}
535
+ */
536
+ INTERCONNECTION_STATUS: 170
537
+ };
538
+
539
+ /**
540
+ * Timer type for device timers.
541
+ *
542
+ * Defines the schedule pattern for device timers. Timers can be one-time or
543
+ * recurring, and can trigger at a single point in time or continuously over
544
+ * a period. The type determines how the timer repeats and when it activates.
545
+ *
546
+ * Note: Some timer types share the same numeric value but have different
547
+ * meanings depending on context. Currently only types 1 and 2 are used.
548
+ * Type 1 can mean either single point weekly cycle or AUTO-OFF depending
549
+ * on context. Type 2 can mean either single point single shot or COUNTDOWN
550
+ * depending on context.
551
+ *
552
+ * @enum {number}
553
+ * @readonly
554
+ */
555
+ const TimerType = {
556
+ /**
557
+ * Single point weekly cycle.
558
+ *
559
+ * Timer type: 1 - single point weekly cycle. Timer triggers at a specific
560
+ * time on specified days of the week, repeating weekly. Also used as
561
+ * AUTO-OFF in countdown contexts.
562
+ *
563
+ * @constant {number}
564
+ */
565
+ SINGLE_POINT_WEEKLY_CYCLE: 1,
566
+
567
+ /**
568
+ * Single point single shot.
569
+ *
570
+ * Timer type: 2 - single point single shot. Timer triggers once at a
571
+ * specific time and does not repeat. Also used as COUNTDOWN (countdown off)
572
+ * in countdown contexts.
573
+ *
574
+ * @constant {number}
575
+ */
576
+ SINGLE_POINT_SINGLE_SHOT: 2,
577
+
578
+ /**
579
+ * Continuous weekly cycle.
580
+ *
581
+ * Timer type: 3 - continuous weekly cycle. Timer is active continuously
582
+ * during specified time periods on specified days, repeating weekly.
583
+ *
584
+ * @constant {number}
585
+ */
586
+ CONTINUOUS_WEEKLY_CYCLE: 3,
587
+
588
+ /**
589
+ * Continuous single shot.
590
+ *
591
+ * Timer type: 4 - continuous single shot. Timer is active continuously
592
+ * during a specific time period, one time only.
593
+ *
594
+ * @constant {number}
595
+ */
596
+ CONTINUOUS_SINGLE_SHOT: 4,
597
+
598
+ /**
599
+ * Auto off timer.
600
+ *
601
+ * AUTO-OFF timer type. Automatically turns device off after a specified
602
+ * duration. Shares the same value (1) as `SINGLE_POINT_WEEKLY_CYCLE`
603
+ * but used in countdown/auto-off contexts.
604
+ *
605
+ * @constant {number}
606
+ */
607
+ AUTO_OFF: 1,
608
+
609
+ /**
610
+ * Countdown timer.
611
+ *
612
+ * COUNTDOWN timer type (countdown off). Counts down from a specified
613
+ * duration and triggers when the countdown reaches zero. Shares the same
614
+ * value (2) as `SINGLE_POINT_SINGLE_SHOT` but used in countdown contexts.
615
+ *
616
+ * @constant {number}
617
+ */
618
+ COUNTDOWN: 2
619
+ };
620
+
621
+ /**
622
+ * Trigger type for device triggers.
623
+ *
624
+ * Defines the schedule pattern for device triggers. Triggers are similar to
625
+ * timers but execute conditional actions (e.g., "if condition X, then do Y")
626
+ * rather than simple time-based actions. The type determines how the trigger
627
+ * repeats and when it evaluates its conditions.
628
+ *
629
+ * Note: Trigger types share the same numeric values as some timer types,
630
+ * but are used in different contexts.
631
+ *
632
+ * @enum {number}
633
+ * @readonly
634
+ * @see {@link TimerType}
635
+ */
636
+ const TriggerType = {
637
+ /**
638
+ * Single point weekly cycle.
639
+ *
640
+ * Trigger activates at a specific time on specified days of the week,
641
+ * repeating weekly. Useful for recurring conditional automation.
642
+ *
643
+ * @constant {number}
644
+ */
645
+ SINGLE_POINT_WEEKLY_CYCLE: 1,
646
+
647
+ /**
648
+ * Single point single shot.
649
+ *
650
+ * Trigger activates once at a specific time and does not repeat. Useful
651
+ * for one-time conditional automation.
652
+ *
653
+ * @constant {number}
654
+ */
655
+ SINGLE_POINT_SINGLE_SHOT: 2,
656
+
657
+ /**
658
+ * Continuous weekly cycle.
659
+ *
660
+ * Trigger is active continuously during specified time periods on
661
+ * specified days, repeating weekly. Useful for time-windowed conditional
662
+ * automation that needs to run for extended periods.
663
+ *
664
+ * @constant {number}
665
+ */
666
+ CONTINUOUS_WEEKLY_CYCLE: 3,
667
+
668
+ /**
669
+ * Continuous single shot.
670
+ *
671
+ * Trigger is active continuously during a specific time period,
672
+ * one time only. Useful for one-time time-windowed conditional
673
+ * automation that needs to run for an extended period.
674
+ *
675
+ * @constant {number}
676
+ */
677
+ CONTINUOUS_SINGLE_SHOT: 4
678
+ };
679
+
680
+ /**
681
+ * Presence detection state values.
682
+ *
683
+ * Indicates whether presence is currently detected by a presence sensor device.
684
+ * Values are based on MS600 behavior analysis and represent the sensor's
685
+ * current detection state.
686
+ *
687
+ * @enum {number}
688
+ * @readonly
689
+ */
690
+ const PresenceState = {
691
+ /**
692
+ * Absence detected.
693
+ *
694
+ * No presence is currently detected by the sensor. The monitored area
695
+ * appears to be unoccupied.
696
+ *
697
+ * @constant {number}
698
+ */
699
+ ABSENCE: 1,
700
+
701
+ /**
702
+ * Presence detected.
703
+ *
704
+ * Presence is currently detected by the sensor. The monitored area
705
+ * appears to be occupied.
706
+ *
707
+ * @constant {number}
708
+ */
709
+ PRESENCE: 2
710
+ };
711
+
712
+ /**
713
+ * Presence sensor sensitivity level.
714
+ *
715
+ * Controls the sensitivity of presence detection. Different levels balance
716
+ * responsiveness (how quickly presence is detected) against false positive
717
+ * prevention (resistance to interference and non-presence triggers).
718
+ *
719
+ * @enum {number}
720
+ * @readonly
721
+ */
722
+ const SensitivityLevel = {
723
+ /**
724
+ * Responsive.
725
+ *
726
+ * Highest sensitivity level, most responsive to movement. Detects presence
727
+ * quickly but may be more prone to false positives from interference.
728
+ *
729
+ * @constant {number}
730
+ */
731
+ RESPONSIVE: 3,
732
+
733
+ /**
734
+ * Anti-Interference.
735
+ *
736
+ * Lower sensitivity level, reduces false positives. Less responsive to
737
+ * movement but more resistant to interference and false triggers.
738
+ *
739
+ * @constant {number}
740
+ */
741
+ ANTI_INTERFERENCE: 1,
742
+
743
+ /**
744
+ * Balance.
745
+ *
746
+ * Balanced sensitivity between responsive and anti-interference modes.
747
+ * Provides moderate responsiveness with moderate false positive prevention,
748
+ * suitable for most use cases.
749
+ *
750
+ * @constant {number}
751
+ */
752
+ BALANCE: 2
753
+ };
754
+
755
+ /**
756
+ * Presence sensor work mode.
757
+ *
758
+ * Controls the operating mode of the presence sensor. Different modes determine
759
+ * which detection algorithms are used and how the sensor filters and reports
760
+ * presence events.
761
+ *
762
+ * @enum {number}
763
+ * @readonly
764
+ */
765
+ const WorkMode = {
766
+ /**
767
+ * Unknown work mode.
768
+ *
769
+ * Mode value is 0. Specific behavior is not documented. May represent
770
+ * a default or unconfigured state.
771
+ *
772
+ * @constant {number}
773
+ */
774
+ UNKNOWN: 0,
775
+
776
+ /**
777
+ * Biological detection only mode.
778
+ *
779
+ * Detects biological presence only, filtering out non-biological movement
780
+ * and interference. Used to reduce false positives from pets, moving objects,
781
+ * or environmental changes. Optimized for detecting human presence.
782
+ *
783
+ * @constant {number}
784
+ */
785
+ BIOLOGICAL_DETECTION_ONLY: 1,
786
+
787
+ /**
788
+ * Security mode.
789
+ *
790
+ * Enhanced detection mode optimized for security applications. Uses more
791
+ * aggressive detection algorithms to catch all movement, including
792
+ * non-biological sources. Reduces false negatives at the cost of potentially
793
+ * more false positives.
794
+ *
795
+ * @constant {number}
796
+ */
797
+ SECURITY: 2
798
+ };
799
+
800
+ module.exports = {
801
+ TransportMode,
802
+ ThermostatMode,
803
+ ThermostatWorkingMode,
804
+ ThermostatModeBState,
805
+ LightMode,
806
+ DiffuserLightMode,
807
+ DiffuserSprayMode,
808
+ SprayMode,
809
+ RollerShutterStatus,
810
+ DNDMode,
811
+ OnlineStatus,
812
+ SmokeAlarmStatus,
813
+ TimerType,
814
+ TriggerType,
815
+ PresenceState,
816
+ SensitivityLevel,
817
+ WorkMode
818
+ };
819
+