@ecobridge.xyz/devicemanager 3.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.
Files changed (137) hide show
  1. package/.gitea/workflows/default_nottags.yaml +66 -0
  2. package/.gitea/workflows/default_tags.yaml +124 -0
  3. package/.vscode/launch.json +11 -0
  4. package/.vscode/settings.json +26 -0
  5. package/changelog.md +91 -0
  6. package/dist_ts/00_commitinfo_data.d.ts +8 -0
  7. package/dist_ts/00_commitinfo_data.js +9 -0
  8. package/dist_ts/device/device.classes.device.d.ts +205 -0
  9. package/dist_ts/device/device.classes.device.js +344 -0
  10. package/dist_ts/devicemanager.classes.devicemanager.d.ts +210 -0
  11. package/dist_ts/devicemanager.classes.devicemanager.js +835 -0
  12. package/dist_ts/discovery/discovery.classes.homeassistant.d.ts +101 -0
  13. package/dist_ts/discovery/discovery.classes.homeassistant.js +313 -0
  14. package/dist_ts/discovery/discovery.classes.mdns.d.ts +90 -0
  15. package/dist_ts/discovery/discovery.classes.mdns.js +291 -0
  16. package/dist_ts/discovery/discovery.classes.networkscanner.d.ts +64 -0
  17. package/dist_ts/discovery/discovery.classes.networkscanner.js +535 -0
  18. package/dist_ts/discovery/discovery.classes.ssdp.d.ts +112 -0
  19. package/dist_ts/discovery/discovery.classes.ssdp.js +255 -0
  20. package/dist_ts/factories/index.d.ts +190 -0
  21. package/dist_ts/factories/index.js +350 -0
  22. package/dist_ts/features/feature.abstract.d.ts +118 -0
  23. package/dist_ts/features/feature.abstract.js +172 -0
  24. package/dist_ts/features/feature.camera.d.ts +95 -0
  25. package/dist_ts/features/feature.camera.js +162 -0
  26. package/dist_ts/features/feature.climate.d.ts +174 -0
  27. package/dist_ts/features/feature.climate.js +328 -0
  28. package/dist_ts/features/feature.cover.d.ts +121 -0
  29. package/dist_ts/features/feature.cover.js +217 -0
  30. package/dist_ts/features/feature.fan.d.ts +127 -0
  31. package/dist_ts/features/feature.fan.js +235 -0
  32. package/dist_ts/features/feature.light.d.ts +156 -0
  33. package/dist_ts/features/feature.light.js +296 -0
  34. package/dist_ts/features/feature.lock.d.ts +103 -0
  35. package/dist_ts/features/feature.lock.js +170 -0
  36. package/dist_ts/features/feature.playback.d.ts +98 -0
  37. package/dist_ts/features/feature.playback.js +191 -0
  38. package/dist_ts/features/feature.power.d.ts +79 -0
  39. package/dist_ts/features/feature.power.js +173 -0
  40. package/dist_ts/features/feature.print.d.ts +78 -0
  41. package/dist_ts/features/feature.print.js +226 -0
  42. package/dist_ts/features/feature.scan.d.ts +79 -0
  43. package/dist_ts/features/feature.scan.js +315 -0
  44. package/dist_ts/features/feature.sensor.d.ts +95 -0
  45. package/dist_ts/features/feature.sensor.js +147 -0
  46. package/dist_ts/features/feature.snmp.d.ts +88 -0
  47. package/dist_ts/features/feature.snmp.js +175 -0
  48. package/dist_ts/features/feature.switch.d.ts +75 -0
  49. package/dist_ts/features/feature.switch.js +126 -0
  50. package/dist_ts/features/feature.volume.d.ts +104 -0
  51. package/dist_ts/features/feature.volume.js +186 -0
  52. package/dist_ts/features/index.d.ts +19 -0
  53. package/dist_ts/features/index.js +23 -0
  54. package/dist_ts/helpers/helpers.iprange.d.ts +35 -0
  55. package/dist_ts/helpers/helpers.iprange.js +151 -0
  56. package/dist_ts/helpers/helpers.retry.d.ts +25 -0
  57. package/dist_ts/helpers/helpers.retry.js +69 -0
  58. package/dist_ts/index.d.ts +15 -0
  59. package/dist_ts/index.js +40 -0
  60. package/dist_ts/interfaces/feature.interfaces.d.ts +255 -0
  61. package/dist_ts/interfaces/feature.interfaces.js +6 -0
  62. package/dist_ts/interfaces/homeassistant.interfaces.d.ts +550 -0
  63. package/dist_ts/interfaces/homeassistant.interfaces.js +111 -0
  64. package/dist_ts/interfaces/index.d.ts +330 -0
  65. package/dist_ts/interfaces/index.js +16 -0
  66. package/dist_ts/interfaces/smarthome.interfaces.d.ts +282 -0
  67. package/dist_ts/interfaces/smarthome.interfaces.js +7 -0
  68. package/dist_ts/paths.d.ts +1 -0
  69. package/dist_ts/paths.js +3 -0
  70. package/dist_ts/plugins.d.ts +23 -0
  71. package/dist_ts/plugins.js +30 -0
  72. package/dist_ts/protocols/index.d.ts +12 -0
  73. package/dist_ts/protocols/index.js +21 -0
  74. package/dist_ts/protocols/protocol.escl.d.ts +58 -0
  75. package/dist_ts/protocols/protocol.escl.js +364 -0
  76. package/dist_ts/protocols/protocol.homeassistant.d.ts +248 -0
  77. package/dist_ts/protocols/protocol.homeassistant.js +611 -0
  78. package/dist_ts/protocols/protocol.ipp.d.ts +45 -0
  79. package/dist_ts/protocols/protocol.ipp.js +284 -0
  80. package/dist_ts/protocols/protocol.nut.d.ts +160 -0
  81. package/dist_ts/protocols/protocol.nut.js +364 -0
  82. package/dist_ts/protocols/protocol.sane.d.ts +104 -0
  83. package/dist_ts/protocols/protocol.sane.js +597 -0
  84. package/dist_ts/protocols/protocol.snmp.d.ts +133 -0
  85. package/dist_ts/protocols/protocol.snmp.js +333 -0
  86. package/dist_ts/protocols/protocol.upnp.d.ts +207 -0
  87. package/dist_ts/protocols/protocol.upnp.js +442 -0
  88. package/dist_ts/protocols/protocol.upssnmp.d.ts +160 -0
  89. package/dist_ts/protocols/protocol.upssnmp.js +263 -0
  90. package/npmextra.json +24 -0
  91. package/package.json +39 -0
  92. package/readme.hints.md +115 -0
  93. package/readme.md +624 -0
  94. package/test/test.ts +261 -0
  95. package/ts/00_commitinfo_data.ts +8 -0
  96. package/ts/device/device.classes.device.ts +454 -0
  97. package/ts/devicemanager.classes.devicemanager.ts +1219 -0
  98. package/ts/discovery/discovery.classes.homeassistant.ts +376 -0
  99. package/ts/discovery/discovery.classes.mdns.ts +347 -0
  100. package/ts/discovery/discovery.classes.networkscanner.ts +648 -0
  101. package/ts/discovery/discovery.classes.ssdp.ts +357 -0
  102. package/ts/factories/index.ts +696 -0
  103. package/ts/features/feature.abstract.ts +251 -0
  104. package/ts/features/feature.camera.ts +214 -0
  105. package/ts/features/feature.climate.ts +407 -0
  106. package/ts/features/feature.cover.ts +278 -0
  107. package/ts/features/feature.fan.ts +296 -0
  108. package/ts/features/feature.light.ts +369 -0
  109. package/ts/features/feature.lock.ts +223 -0
  110. package/ts/features/feature.playback.ts +246 -0
  111. package/ts/features/feature.power.ts +231 -0
  112. package/ts/features/feature.print.ts +297 -0
  113. package/ts/features/feature.scan.ts +370 -0
  114. package/ts/features/feature.sensor.ts +202 -0
  115. package/ts/features/feature.snmp.ts +235 -0
  116. package/ts/features/feature.switch.ts +170 -0
  117. package/ts/features/feature.volume.ts +256 -0
  118. package/ts/features/index.ts +25 -0
  119. package/ts/helpers/helpers.iprange.ts +172 -0
  120. package/ts/helpers/helpers.retry.ts +100 -0
  121. package/ts/index.ts +165 -0
  122. package/ts/interfaces/feature.interfaces.ts +359 -0
  123. package/ts/interfaces/homeassistant.interfaces.ts +666 -0
  124. package/ts/interfaces/index.ts +421 -0
  125. package/ts/interfaces/smarthome.interfaces.ts +421 -0
  126. package/ts/paths.ts +5 -0
  127. package/ts/plugins.ts +41 -0
  128. package/ts/protocols/index.ts +59 -0
  129. package/ts/protocols/protocol.escl.ts +439 -0
  130. package/ts/protocols/protocol.homeassistant.ts +737 -0
  131. package/ts/protocols/protocol.ipp.ts +329 -0
  132. package/ts/protocols/protocol.nut.ts +471 -0
  133. package/ts/protocols/protocol.sane.ts +694 -0
  134. package/ts/protocols/protocol.snmp.ts +439 -0
  135. package/ts/protocols/protocol.upnp.ts +627 -0
  136. package/ts/protocols/protocol.upssnmp.ts +377 -0
  137. package/tsconfig.json +12 -0
@@ -0,0 +1,421 @@
1
+ /**
2
+ * Smart Home Device Interfaces
3
+ * Generic types for smart home features (lights, climate, sensors, etc.)
4
+ * Protocol-agnostic - can be implemented by Home Assistant, Hue, MQTT, etc.
5
+ */
6
+
7
+ import type { TFeatureState, IFeatureInfo } from './feature.interfaces.js';
8
+
9
+ // ============================================================================
10
+ // Light Feature Types
11
+ // ============================================================================
12
+
13
+ export type TLightProtocol = 'home-assistant' | 'hue' | 'mqtt' | 'zigbee';
14
+
15
+ export interface ILightCapabilities {
16
+ supportsBrightness: boolean;
17
+ supportsColorTemp: boolean;
18
+ supportsRgb: boolean;
19
+ supportsHs: boolean; // Hue/Saturation
20
+ supportsXy: boolean; // CIE xy color
21
+ supportsEffects: boolean;
22
+ supportsTransition: boolean;
23
+ effects?: string[];
24
+ minMireds?: number;
25
+ maxMireds?: number;
26
+ minColorTempKelvin?: number;
27
+ maxColorTempKelvin?: number;
28
+ }
29
+
30
+ export interface ILightState {
31
+ isOn: boolean;
32
+ brightness?: number; // 0-255
33
+ colorTemp?: number; // Kelvin
34
+ colorTempMireds?: number; // Mireds (1000000/Kelvin)
35
+ rgbColor?: [number, number, number];
36
+ hsColor?: [number, number]; // [hue 0-360, saturation 0-100]
37
+ xyColor?: [number, number]; // CIE xy
38
+ effect?: string;
39
+ }
40
+
41
+ export interface ILightFeatureInfo extends IFeatureInfo {
42
+ type: 'light';
43
+ protocol: TLightProtocol;
44
+ capabilities: ILightCapabilities;
45
+ currentState: ILightState;
46
+ }
47
+
48
+ // ============================================================================
49
+ // Climate/Thermostat Feature Types
50
+ // ============================================================================
51
+
52
+ export type TClimateProtocol = 'home-assistant' | 'nest' | 'ecobee' | 'mqtt';
53
+
54
+ export type THvacMode =
55
+ | 'off'
56
+ | 'heat'
57
+ | 'cool'
58
+ | 'heat_cool' // Auto dual setpoint
59
+ | 'auto'
60
+ | 'dry'
61
+ | 'fan_only';
62
+
63
+ export type THvacAction =
64
+ | 'off'
65
+ | 'heating'
66
+ | 'cooling'
67
+ | 'drying'
68
+ | 'idle'
69
+ | 'fan';
70
+
71
+ export interface IClimateCapabilities {
72
+ hvacModes: THvacMode[];
73
+ presetModes?: string[]; // 'away', 'eco', 'boost', 'sleep'
74
+ fanModes?: string[]; // 'auto', 'low', 'medium', 'high'
75
+ swingModes?: string[]; // 'off', 'vertical', 'horizontal', 'both'
76
+ supportsTargetTemp: boolean;
77
+ supportsTargetTempRange: boolean; // For heat_cool mode
78
+ supportsHumidity: boolean;
79
+ supportsAuxHeat: boolean;
80
+ minTemp: number;
81
+ maxTemp: number;
82
+ tempStep: number; // Temperature increment (e.g., 0.5, 1)
83
+ minHumidity?: number;
84
+ maxHumidity?: number;
85
+ }
86
+
87
+ export interface IClimateState {
88
+ currentTemp?: number;
89
+ targetTemp?: number;
90
+ targetTempHigh?: number; // For heat_cool mode
91
+ targetTempLow?: number; // For heat_cool mode
92
+ hvacMode: THvacMode;
93
+ hvacAction?: THvacAction;
94
+ presetMode?: string;
95
+ fanMode?: string;
96
+ swingMode?: string;
97
+ humidity?: number;
98
+ targetHumidity?: number;
99
+ auxHeat?: boolean;
100
+ }
101
+
102
+ export interface IClimateFeatureInfo extends IFeatureInfo {
103
+ type: 'climate';
104
+ protocol: TClimateProtocol;
105
+ capabilities: IClimateCapabilities;
106
+ currentState: IClimateState;
107
+ }
108
+
109
+ // ============================================================================
110
+ // Sensor Feature Types
111
+ // ============================================================================
112
+
113
+ export type TSensorProtocol = 'home-assistant' | 'mqtt' | 'snmp';
114
+
115
+ export type TSensorDeviceClass =
116
+ | 'temperature'
117
+ | 'humidity'
118
+ | 'pressure'
119
+ | 'illuminance'
120
+ | 'battery'
121
+ | 'power'
122
+ | 'energy'
123
+ | 'voltage'
124
+ | 'current'
125
+ | 'frequency'
126
+ | 'gas'
127
+ | 'co2'
128
+ | 'pm25'
129
+ | 'pm10'
130
+ | 'signal_strength'
131
+ | 'timestamp'
132
+ | 'duration'
133
+ | 'distance'
134
+ | 'speed'
135
+ | 'weight'
136
+ | 'monetary'
137
+ | 'data_size'
138
+ | 'data_rate'
139
+ | 'water'
140
+ | 'irradiance'
141
+ | 'precipitation'
142
+ | 'precipitation_intensity'
143
+ | 'wind_speed';
144
+
145
+ export type TSensorStateClass =
146
+ | 'measurement' // Instantaneous reading
147
+ | 'total' // Cumulative total
148
+ | 'total_increasing'; // Monotonically increasing total
149
+
150
+ export interface ISensorCapabilities {
151
+ deviceClass?: TSensorDeviceClass;
152
+ stateClass?: TSensorStateClass;
153
+ unit?: string;
154
+ nativeUnit?: string;
155
+ precision?: number; // Decimal places
156
+ }
157
+
158
+ export interface ISensorState {
159
+ value: string | number | boolean;
160
+ numericValue?: number;
161
+ unit?: string;
162
+ lastUpdated: Date;
163
+ }
164
+
165
+ export interface ISensorFeatureInfo extends IFeatureInfo {
166
+ type: 'sensor';
167
+ protocol: TSensorProtocol;
168
+ capabilities: ISensorCapabilities;
169
+ currentState: ISensorState;
170
+ }
171
+
172
+ // ============================================================================
173
+ // Camera Feature Types
174
+ // ============================================================================
175
+
176
+ export type TCameraProtocol = 'home-assistant' | 'onvif' | 'rtsp';
177
+
178
+ export interface ICameraCapabilities {
179
+ supportsStream: boolean;
180
+ supportsPtz: boolean; // Pan-tilt-zoom
181
+ supportsSnapshot: boolean;
182
+ supportsMotionDetection: boolean;
183
+ frontendStreamType?: 'hls' | 'web_rtc';
184
+ streamUrl?: string;
185
+ }
186
+
187
+ export interface ICameraState {
188
+ isRecording: boolean;
189
+ isStreaming: boolean;
190
+ motionDetected: boolean;
191
+ }
192
+
193
+ export interface ICameraFeatureInfo extends IFeatureInfo {
194
+ type: 'camera';
195
+ protocol: TCameraProtocol;
196
+ capabilities: ICameraCapabilities;
197
+ currentState: ICameraState;
198
+ }
199
+
200
+ // ============================================================================
201
+ // Cover/Blind Feature Types
202
+ // ============================================================================
203
+
204
+ export type TCoverProtocol = 'home-assistant' | 'mqtt' | 'somfy';
205
+
206
+ export type TCoverDeviceClass =
207
+ | 'awning'
208
+ | 'blind'
209
+ | 'curtain'
210
+ | 'damper'
211
+ | 'door'
212
+ | 'garage'
213
+ | 'gate'
214
+ | 'shade'
215
+ | 'shutter'
216
+ | 'window';
217
+
218
+ export type TCoverState = 'open' | 'opening' | 'closed' | 'closing' | 'stopped' | 'unknown';
219
+
220
+ export interface ICoverCapabilities {
221
+ deviceClass?: TCoverDeviceClass;
222
+ supportsOpen: boolean;
223
+ supportsClose: boolean;
224
+ supportsStop: boolean;
225
+ supportsPosition: boolean; // set_cover_position
226
+ supportsTilt: boolean; // set_cover_tilt_position
227
+ }
228
+
229
+ export interface ICoverStateInfo {
230
+ state: TCoverState;
231
+ position?: number; // 0-100, 0 = closed, 100 = fully open
232
+ tiltPosition?: number; // 0-100
233
+ }
234
+
235
+ export interface ICoverFeatureInfo extends IFeatureInfo {
236
+ type: 'cover';
237
+ protocol: TCoverProtocol;
238
+ capabilities: ICoverCapabilities;
239
+ currentState: ICoverStateInfo;
240
+ }
241
+
242
+ // ============================================================================
243
+ // Switch Feature Types
244
+ // ============================================================================
245
+
246
+ export type TSwitchProtocol = 'home-assistant' | 'mqtt' | 'tasmota' | 'tuya';
247
+
248
+ export type TSwitchDeviceClass = 'outlet' | 'switch';
249
+
250
+ export interface ISwitchCapabilities {
251
+ deviceClass?: TSwitchDeviceClass;
252
+ }
253
+
254
+ export interface ISwitchState {
255
+ isOn: boolean;
256
+ }
257
+
258
+ export interface ISwitchFeatureInfo extends IFeatureInfo {
259
+ type: 'switch';
260
+ protocol: TSwitchProtocol;
261
+ capabilities: ISwitchCapabilities;
262
+ currentState: ISwitchState;
263
+ }
264
+
265
+ // ============================================================================
266
+ // Lock Feature Types
267
+ // ============================================================================
268
+
269
+ export type TLockProtocol = 'home-assistant' | 'mqtt' | 'august' | 'yale';
270
+
271
+ export type TLockState =
272
+ | 'locked'
273
+ | 'unlocked'
274
+ | 'locking'
275
+ | 'unlocking'
276
+ | 'jammed'
277
+ | 'unknown';
278
+
279
+ export interface ILockCapabilities {
280
+ supportsOpen: boolean; // Physical open (some locks can open the door)
281
+ }
282
+
283
+ export interface ILockStateInfo {
284
+ state: TLockState;
285
+ isLocked: boolean;
286
+ }
287
+
288
+ export interface ILockFeatureInfo extends IFeatureInfo {
289
+ type: 'lock';
290
+ protocol: TLockProtocol;
291
+ capabilities: ILockCapabilities;
292
+ currentState: ILockStateInfo;
293
+ }
294
+
295
+ // ============================================================================
296
+ // Fan Feature Types
297
+ // ============================================================================
298
+
299
+ export type TFanProtocol = 'home-assistant' | 'mqtt' | 'bond';
300
+
301
+ export type TFanDirection = 'forward' | 'reverse';
302
+
303
+ export interface IFanCapabilities {
304
+ supportsSpeed: boolean;
305
+ supportsOscillate: boolean;
306
+ supportsDirection: boolean;
307
+ supportsPresetModes: boolean;
308
+ presetModes?: string[];
309
+ speedCount?: number; // Number of discrete speed levels
310
+ }
311
+
312
+ export interface IFanState {
313
+ isOn: boolean;
314
+ percentage?: number; // 0-100 speed
315
+ presetMode?: string;
316
+ oscillating?: boolean;
317
+ direction?: TFanDirection;
318
+ }
319
+
320
+ export interface IFanFeatureInfo extends IFeatureInfo {
321
+ type: 'fan';
322
+ protocol: TFanProtocol;
323
+ capabilities: IFanCapabilities;
324
+ currentState: IFanState;
325
+ }
326
+
327
+ // ============================================================================
328
+ // Protocol Client Interfaces (for dependency injection)
329
+ // ============================================================================
330
+
331
+ /**
332
+ * Light protocol client interface
333
+ * Implemented by HomeAssistantProtocol, HueProtocol, etc.
334
+ */
335
+ export interface ILightProtocolClient {
336
+ turnOn(entityId: string, options?: { brightness?: number; colorTemp?: number; rgb?: [number, number, number]; transition?: number }): Promise<void>;
337
+ turnOff(entityId: string, options?: { transition?: number }): Promise<void>;
338
+ toggle(entityId: string): Promise<void>;
339
+ setBrightness(entityId: string, brightness: number, transition?: number): Promise<void>;
340
+ setColorTemp(entityId: string, kelvin: number, transition?: number): Promise<void>;
341
+ setRgbColor(entityId: string, r: number, g: number, b: number, transition?: number): Promise<void>;
342
+ setEffect(entityId: string, effect: string): Promise<void>;
343
+ getState(entityId: string): Promise<ILightState>;
344
+ }
345
+
346
+ /**
347
+ * Climate protocol client interface
348
+ */
349
+ export interface IClimateProtocolClient {
350
+ setHvacMode(entityId: string, mode: THvacMode): Promise<void>;
351
+ setTargetTemp(entityId: string, temp: number): Promise<void>;
352
+ setTargetTempRange(entityId: string, low: number, high: number): Promise<void>;
353
+ setPresetMode(entityId: string, preset: string): Promise<void>;
354
+ setFanMode(entityId: string, mode: string): Promise<void>;
355
+ setSwingMode(entityId: string, mode: string): Promise<void>;
356
+ setAuxHeat(entityId: string, enabled: boolean): Promise<void>;
357
+ getState(entityId: string): Promise<IClimateState>;
358
+ }
359
+
360
+ /**
361
+ * Sensor protocol client interface (read-only)
362
+ */
363
+ export interface ISensorProtocolClient {
364
+ getState(entityId: string): Promise<ISensorState>;
365
+ }
366
+
367
+ /**
368
+ * Camera protocol client interface
369
+ */
370
+ export interface ICameraProtocolClient {
371
+ getSnapshot(entityId: string): Promise<Buffer>;
372
+ getSnapshotUrl(entityId: string): Promise<string>;
373
+ getStreamUrl(entityId: string): Promise<string>;
374
+ getState(entityId: string): Promise<ICameraState>;
375
+ }
376
+
377
+ /**
378
+ * Cover protocol client interface
379
+ */
380
+ export interface ICoverProtocolClient {
381
+ open(entityId: string): Promise<void>;
382
+ close(entityId: string): Promise<void>;
383
+ stop(entityId: string): Promise<void>;
384
+ setPosition(entityId: string, position: number): Promise<void>;
385
+ setTiltPosition(entityId: string, position: number): Promise<void>;
386
+ getState(entityId: string): Promise<ICoverStateInfo>;
387
+ }
388
+
389
+ /**
390
+ * Switch protocol client interface
391
+ */
392
+ export interface ISwitchProtocolClient {
393
+ turnOn(entityId: string): Promise<void>;
394
+ turnOff(entityId: string): Promise<void>;
395
+ toggle(entityId: string): Promise<void>;
396
+ getState(entityId: string): Promise<ISwitchState>;
397
+ }
398
+
399
+ /**
400
+ * Lock protocol client interface
401
+ */
402
+ export interface ILockProtocolClient {
403
+ lock(entityId: string): Promise<void>;
404
+ unlock(entityId: string): Promise<void>;
405
+ open(entityId: string): Promise<void>; // Physical open if supported
406
+ getState(entityId: string): Promise<ILockStateInfo>;
407
+ }
408
+
409
+ /**
410
+ * Fan protocol client interface
411
+ */
412
+ export interface IFanProtocolClient {
413
+ turnOn(entityId: string, percentage?: number): Promise<void>;
414
+ turnOff(entityId: string): Promise<void>;
415
+ toggle(entityId: string): Promise<void>;
416
+ setPercentage(entityId: string, percentage: number): Promise<void>;
417
+ setPresetMode(entityId: string, mode: string): Promise<void>;
418
+ setOscillating(entityId: string, oscillating: boolean): Promise<void>;
419
+ setDirection(entityId: string, direction: TFanDirection): Promise<void>;
420
+ getState(entityId: string): Promise<IFanState>;
421
+ }
package/ts/paths.ts ADDED
@@ -0,0 +1,5 @@
1
+ import * as plugins from './plugins.js';
2
+ export const packageDir = plugins.path.join(
3
+ plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
4
+ '../'
5
+ );
package/ts/plugins.ts ADDED
@@ -0,0 +1,41 @@
1
+ // native scope
2
+ import * as path from 'path';
3
+ import * as net from 'net';
4
+ import * as dgram from 'dgram';
5
+ import * as events from 'events';
6
+
7
+ export { path, net, dgram, events };
8
+
9
+ // @push.rocks scope
10
+ import * as smartpath from '@push.rocks/smartpath';
11
+ import * as smartpromise from '@push.rocks/smartpromise';
12
+ import * as smartdelay from '@push.rocks/smartdelay';
13
+ import * as smartnetwork from '@push.rocks/smartnetwork';
14
+
15
+ // Re-export SmartRequest for HTTP
16
+ import { SmartRequest } from '@push.rocks/smartrequest';
17
+ export { SmartRequest };
18
+
19
+ export {
20
+ smartpath,
21
+ smartpromise,
22
+ smartdelay,
23
+ smartnetwork,
24
+ };
25
+
26
+ // third party
27
+ import * as bonjourService from 'bonjour-service';
28
+ import ipp from 'ipp';
29
+ import nodeSsdpModule from 'node-ssdp';
30
+ import * as netSnmp from 'net-snmp';
31
+ import * as sonos from 'sonos';
32
+ import * as castv2Client from 'castv2-client';
33
+ import WebSocket from 'ws';
34
+
35
+ // node-ssdp exports Client/Server under default in ESM
36
+ const nodeSsdp = {
37
+ Client: nodeSsdpModule.Client,
38
+ Server: nodeSsdpModule.Server,
39
+ };
40
+
41
+ export { bonjourService, ipp, nodeSsdp, netSnmp, sonos, castv2Client, WebSocket };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Protocol implementations
3
+ * All network communication protocols for device interaction
4
+ */
5
+
6
+ // eSCL/AirScan scanner protocol
7
+ export { EsclProtocol } from './protocol.escl.js';
8
+
9
+ // SANE network scanner protocol
10
+ export { SaneProtocol } from './protocol.sane.js';
11
+
12
+ // IPP printer protocol
13
+ export { IppProtocol } from './protocol.ipp.js';
14
+
15
+ // SNMP query protocol
16
+ export {
17
+ SnmpProtocol,
18
+ SNMP_OIDS,
19
+ type TSnmpValueType,
20
+ type ISnmpVarbind,
21
+ type ISnmpOptions,
22
+ } from './protocol.snmp.js';
23
+
24
+ // Network UPS Tools protocol
25
+ export {
26
+ NutProtocol,
27
+ NUT_VARIABLES,
28
+ NUT_COMMANDS,
29
+ type TNutStatusFlag,
30
+ type INutUpsInfo,
31
+ type INutVariable,
32
+ } from './protocol.nut.js';
33
+
34
+ // UPnP/DLNA SOAP protocol
35
+ export {
36
+ UpnpSoapClient,
37
+ UPNP_SERVICE_TYPES,
38
+ UPNP_DEVICE_TYPES,
39
+ type TDlnaTransportState,
40
+ type TDlnaTransportStatus,
41
+ type IDlnaPositionInfo,
42
+ type IDlnaTransportInfo,
43
+ type IDlnaMediaInfo,
44
+ type IDlnaContentItem,
45
+ type IDlnaBrowseResult,
46
+ } from './protocol.upnp.js';
47
+
48
+ // UPS SNMP (UPS-MIB RFC 1628)
49
+ export {
50
+ UpsSnmpHandler,
51
+ UPS_SNMP_OIDS,
52
+ type TUpsBatteryStatus,
53
+ type TUpsOutputSource,
54
+ type TUpsTestResult,
55
+ type IUpsSnmpStatus,
56
+ } from './protocol.upssnmp.js';
57
+
58
+ // Home Assistant WebSocket protocol
59
+ export { HomeAssistantProtocol } from './protocol.homeassistant.js';