edilkamin 1.8.0 → 1.10.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.
@@ -13,9 +13,17 @@ interface TemperaturesType {
13
13
  board: number;
14
14
  enviroment: number;
15
15
  }
16
+ interface GeneralFlagsType {
17
+ is_pellet_in_reserve: boolean;
18
+ }
19
+ interface PelletAutonomyType {
20
+ autonomy_time: number;
21
+ }
16
22
  interface StatusType {
17
23
  commands: CommandsType;
18
24
  temperatures: TemperaturesType;
25
+ flags: GeneralFlagsType;
26
+ pellet: PelletAutonomyType;
19
27
  }
20
28
  interface UserParametersType {
21
29
  enviroment_1_temperature: number;
@@ -23,6 +31,14 @@ interface UserParametersType {
23
31
  enviroment_3_temperature: number;
24
32
  is_auto: boolean;
25
33
  is_sound_active: boolean;
34
+ manual_power: number;
35
+ fan_1_ventilation: number;
36
+ fan_2_ventilation: number;
37
+ fan_3_ventilation: number;
38
+ is_standby_active: boolean;
39
+ standby_waiting_time: number;
40
+ is_fahrenheit: boolean;
41
+ language: number;
26
42
  }
27
43
  interface DeviceInfoType {
28
44
  status: StatusType;
@@ -83,4 +99,4 @@ interface DiscoveredDevice {
83
99
  /** Signal strength in dBm (optional, not all platforms provide this) */
84
100
  rssi?: number;
85
101
  }
86
- export type { BufferEncodedType, CommandsType, DeviceAssociationBody, DeviceAssociationResponse, DeviceInfoRawType, DeviceInfoType, DiscoveredDevice, EditDeviceAssociationBody, StatusType, TemperaturesType, UserParametersType, };
102
+ export type { BufferEncodedType, CommandsType, DeviceAssociationBody, DeviceAssociationResponse, DeviceInfoRawType, DeviceInfoType, DiscoveredDevice, EditDeviceAssociationBody, GeneralFlagsType, PelletAutonomyType, StatusType, TemperaturesType, UserParametersType, };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edilkamin",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "",
5
5
  "main": "dist/cjs/src/index.js",
6
6
  "module": "dist/esm/src/index.js",
@@ -70,9 +70,9 @@
70
70
  "@eslint/eslintrc": "^3.2.0",
71
71
  "@eslint/js": "^9.16.0",
72
72
  "@types/mocha": "^10.0.10",
73
- "@types/node": "^25.0.2",
73
+ "@types/node": "^24",
74
74
  "@types/pako": "^2.0.4",
75
- "@types/sinon": "^17.0.3",
75
+ "@types/sinon": "^21.0.0",
76
76
  "@types/web-bluetooth": "^0.0.21",
77
77
  "@typescript-eslint/eslint-plugin": "^8.17.0",
78
78
  "@typescript-eslint/parser": "^8.17.0",
@@ -84,7 +84,7 @@
84
84
  "mocha": "^11.7.5",
85
85
  "nyc": "^17.1.0",
86
86
  "prettier": "^3.7.4",
87
- "sinon": "^19.0.2",
87
+ "sinon": "^21.0.1",
88
88
  "ts-node": "^10.9.1",
89
89
  "typedoc": "^0.28.15",
90
90
  "typescript": "^5.7.2"
@@ -147,15 +147,80 @@ const createProgram = () => {
147
147
  description: "Retrieve device power status",
148
148
  getter: (api, jwtToken, mac) => api.getPower(jwtToken, mac),
149
149
  },
150
+ {
151
+ commandName: "getPowerLevel",
152
+ description: "Retrieve manual power level (1-5)",
153
+ getter: (api, jwtToken, mac) => api.getPowerLevel(jwtToken, mac),
154
+ },
150
155
  {
151
156
  commandName: "getEnvironmentTemperature",
152
157
  description: "Retrieve environment temperature",
153
158
  getter: (api, jwtToken, mac) => api.getEnvironmentTemperature(jwtToken, mac),
154
159
  },
155
160
  {
156
- commandName: "getTargetTemperature",
157
- description: "Retrieve target temperature",
158
- getter: (api, jwtToken, mac) => api.getTargetTemperature(jwtToken, mac),
161
+ commandName: "getEnvironment1Temperature",
162
+ description: "Retrieve Environment 1 target temperature",
163
+ getter: (api, jwtToken, mac) => api.getEnvironment1Temperature(jwtToken, mac),
164
+ },
165
+ {
166
+ commandName: "getFan1Speed",
167
+ description: "Retrieve fan 1 speed",
168
+ getter: (api, jwtToken, mac) => api.getFan1Speed(jwtToken, mac),
169
+ },
170
+ {
171
+ commandName: "getFan2Speed",
172
+ description: "Retrieve fan 2 speed",
173
+ getter: (api, jwtToken, mac) => api.getFan2Speed(jwtToken, mac),
174
+ },
175
+ {
176
+ commandName: "getFan3Speed",
177
+ description: "Retrieve fan 3 speed",
178
+ getter: (api, jwtToken, mac) => api.getFan3Speed(jwtToken, mac),
179
+ },
180
+ {
181
+ commandName: "getStandby",
182
+ description: "Retrieve Standby mode status",
183
+ getter: (api, jwtToken, mac) => api.getStandby(jwtToken, mac),
184
+ },
185
+ {
186
+ commandName: "getStandbyTime",
187
+ description: "Retrieve standby waiting time in minutes",
188
+ getter: (api, jwtToken, mac) => api.getStandbyTime(jwtToken, mac),
189
+ },
190
+ {
191
+ commandName: "getAuto",
192
+ description: "Retrieve Auto mode status",
193
+ getter: (api, jwtToken, mac) => api.getAuto(jwtToken, mac),
194
+ },
195
+ {
196
+ commandName: "getEnvironment2Temperature",
197
+ description: "Retrieve Environment 2 target temperature",
198
+ getter: (api, jwtToken, mac) => api.getEnvironment2Temperature(jwtToken, mac),
199
+ },
200
+ {
201
+ commandName: "getEnvironment3Temperature",
202
+ description: "Retrieve Environment 3 target temperature",
203
+ getter: (api, jwtToken, mac) => api.getEnvironment3Temperature(jwtToken, mac),
204
+ },
205
+ {
206
+ commandName: "getMeasureUnit",
207
+ description: "Retrieve temperature unit (true=Fahrenheit, false=Celsius)",
208
+ getter: (api, jwtToken, mac) => api.getMeasureUnit(jwtToken, mac),
209
+ },
210
+ {
211
+ commandName: "getLanguage",
212
+ description: "Retrieve display language code (0-9)",
213
+ getter: (api, jwtToken, mac) => api.getLanguage(jwtToken, mac),
214
+ },
215
+ {
216
+ commandName: "getPelletInReserve",
217
+ description: "Retrieve pellet reserve status (true=low/reserve, false=ok)",
218
+ getter: (api, jwtToken, mac) => api.getPelletInReserve(jwtToken, mac),
219
+ },
220
+ {
221
+ commandName: "getPelletAutonomyTime",
222
+ description: "Retrieve estimated pellet autonomy time",
223
+ getter: (api, jwtToken, mac) => api.getPelletAutonomyTime(jwtToken, mac),
159
224
  },
160
225
  ].forEach(({ commandName, description, getter }) => {
161
226
  addLegacyOption(addMacOption(addAuthOptions(program.command(commandName).description(description)))).action((options) => executeGetter(options, getter));
@@ -168,13 +233,176 @@ const createProgram = () => {
168
233
  setter: (api, jwtToken, mac, value) => api.setPower(jwtToken, mac, value),
169
234
  },
170
235
  {
171
- commandName: "setTargetTemperature",
172
- description: "Set the target temperature (degree celsius) for a device",
173
- setter: (api, jwtToken, mac, value) => api.setTargetTemperature(jwtToken, mac, value),
236
+ commandName: "setPowerLevel",
237
+ description: "Set manual power level (1-5)",
238
+ setter: (api, jwtToken, mac, value) => api.setPowerLevel(jwtToken, mac, value),
239
+ },
240
+ {
241
+ commandName: "setEnvironment1Temperature",
242
+ description: "Set Environment 1 target temperature (degrees Celsius)",
243
+ setter: (api, jwtToken, mac, value) => api.setEnvironment1Temperature(jwtToken, mac, value),
244
+ },
245
+ {
246
+ commandName: "setFan1Speed",
247
+ description: "Set fan 1 speed (0-5)",
248
+ setter: (api, jwtToken, mac, value) => api.setFan1Speed(jwtToken, mac, value),
249
+ },
250
+ {
251
+ commandName: "setFan2Speed",
252
+ description: "Set fan 2 speed (0-5)",
253
+ setter: (api, jwtToken, mac, value) => api.setFan2Speed(jwtToken, mac, value),
254
+ },
255
+ {
256
+ commandName: "setFan3Speed",
257
+ description: "Set fan 3 speed (0-5)",
258
+ setter: (api, jwtToken, mac, value) => api.setFan3Speed(jwtToken, mac, value),
259
+ },
260
+ {
261
+ commandName: "setAirkare",
262
+ description: "Enable/disable Airkare mode (1=on, 0=off)",
263
+ setter: (api, jwtToken, mac, value) => api.setAirkare(jwtToken, mac, value === 1),
264
+ },
265
+ {
266
+ commandName: "setRelax",
267
+ description: "Enable/disable Relax mode (1=on, 0=off)",
268
+ setter: (api, jwtToken, mac, value) => api.setRelax(jwtToken, mac, value === 1),
269
+ },
270
+ {
271
+ commandName: "setStandby",
272
+ description: "Enable/disable Standby mode (1=on, 0=off)",
273
+ setter: (api, jwtToken, mac, value) => api.setStandby(jwtToken, mac, value === 1),
274
+ },
275
+ {
276
+ commandName: "setStandbyTime",
277
+ description: "Set standby waiting time in minutes",
278
+ setter: (api, jwtToken, mac, value) => api.setStandbyTime(jwtToken, mac, value),
279
+ },
280
+ {
281
+ commandName: "setAuto",
282
+ description: "Enable/disable Auto mode (1=on, 0=off)",
283
+ setter: (api, jwtToken, mac, value) => api.setAuto(jwtToken, mac, value === 1),
284
+ },
285
+ {
286
+ commandName: "setEnvironment2Temperature",
287
+ description: "Set Environment 2 target temperature (degrees Celsius)",
288
+ setter: (api, jwtToken, mac, value) => api.setEnvironment2Temperature(jwtToken, mac, value),
289
+ },
290
+ {
291
+ commandName: "setEnvironment3Temperature",
292
+ description: "Set Environment 3 target temperature (degrees Celsius)",
293
+ setter: (api, jwtToken, mac, value) => api.setEnvironment3Temperature(jwtToken, mac, value),
294
+ },
295
+ {
296
+ commandName: "setMeasureUnit",
297
+ description: "Set temperature unit (1=Fahrenheit, 0=Celsius)",
298
+ setter: (api, jwtToken, mac, value) => api.setMeasureUnit(jwtToken, mac, value === 1),
299
+ },
300
+ {
301
+ commandName: "setLanguage",
302
+ description: "Set display language (0=IT,1=FR,2=EN,3=ES,4=PT,5=DA,6=NL,7=DE,8=HU,9=PL)",
303
+ setter: (api, jwtToken, mac, value) => api.setLanguage(jwtToken, mac, value),
174
304
  },
175
305
  ].forEach(({ commandName, description, setter }) => {
176
306
  addLegacyOption(addMacOption(addAuthOptions(program.command(commandName).description(description)).requiredOption("-v, --value <number>", "Value to set", parseFloat))).action((options) => executeSetter(options, setter));
177
307
  });
308
+ // Indexed getter commands (require --index parameter)
309
+ addLegacyOption(addMacOption(addAuthOptions(program
310
+ .command("getFanSpeed")
311
+ .description("Retrieve fan speed by index (1-3)")).requiredOption("-i, --index <number>", "Fan index (1, 2, or 3)", parseInt))).action((options) => __awaiter(void 0, void 0, void 0, function* () {
312
+ const { username, password, mac, index, legacy = false } = options;
313
+ const normalizedMac = mac.replace(/:/g, "");
314
+ const storage = createFileStorage();
315
+ configureAmplify(storage);
316
+ let jwtToken;
317
+ try {
318
+ jwtToken = yield getSession(false, legacy);
319
+ }
320
+ catch (_a) {
321
+ if (!username) {
322
+ throw new Error("No session found. Please provide --username to sign in.");
323
+ }
324
+ const pwd = password || (yield promptPassword());
325
+ jwtToken = yield signIn(username, pwd, legacy);
326
+ }
327
+ const apiUrl = legacy ? OLD_API_URL : NEW_API_URL;
328
+ const api = configure(apiUrl);
329
+ const result = yield api.getFanSpeed(jwtToken, normalizedMac, index);
330
+ console.log(JSON.stringify(result, null, 2));
331
+ }));
332
+ addLegacyOption(addMacOption(addAuthOptions(program
333
+ .command("getTargetTemperature")
334
+ .description("Retrieve target temperature by environment index (1-3)")).requiredOption("-i, --index <number>", "Environment index (1, 2, or 3)", parseInt))).action((options) => __awaiter(void 0, void 0, void 0, function* () {
335
+ const { username, password, mac, index, legacy = false } = options;
336
+ const normalizedMac = mac.replace(/:/g, "");
337
+ const storage = createFileStorage();
338
+ configureAmplify(storage);
339
+ let jwtToken;
340
+ try {
341
+ jwtToken = yield getSession(false, legacy);
342
+ }
343
+ catch (_a) {
344
+ if (!username) {
345
+ throw new Error("No session found. Please provide --username to sign in.");
346
+ }
347
+ const pwd = password || (yield promptPassword());
348
+ jwtToken = yield signIn(username, pwd, legacy);
349
+ }
350
+ const apiUrl = legacy ? OLD_API_URL : NEW_API_URL;
351
+ const api = configure(apiUrl);
352
+ const result = yield api.getTargetTemperature(jwtToken, normalizedMac, index);
353
+ console.log(JSON.stringify(result, null, 2));
354
+ }));
355
+ // Indexed setter commands (require --index and --value parameters)
356
+ addLegacyOption(addMacOption(addAuthOptions(program
357
+ .command("setFanSpeed")
358
+ .description("Set fan speed by index (1-3)"))
359
+ .requiredOption("-i, --index <number>", "Fan index (1, 2, or 3)", parseInt)
360
+ .requiredOption("-v, --value <number>", "Fan speed (0-5)", parseFloat))).action((options) => __awaiter(void 0, void 0, void 0, function* () {
361
+ const { username, password, mac, index, value, legacy = false } = options;
362
+ const normalizedMac = mac.replace(/:/g, "");
363
+ const storage = createFileStorage();
364
+ configureAmplify(storage);
365
+ let jwtToken;
366
+ try {
367
+ jwtToken = yield getSession(false, legacy);
368
+ }
369
+ catch (_a) {
370
+ if (!username) {
371
+ throw new Error("No session found. Please provide --username to sign in.");
372
+ }
373
+ const pwd = password || (yield promptPassword());
374
+ jwtToken = yield signIn(username, pwd, legacy);
375
+ }
376
+ const apiUrl = legacy ? OLD_API_URL : NEW_API_URL;
377
+ const api = configure(apiUrl);
378
+ const result = yield api.setFanSpeed(jwtToken, normalizedMac, index, value);
379
+ console.log(JSON.stringify(result, null, 2));
380
+ }));
381
+ addLegacyOption(addMacOption(addAuthOptions(program
382
+ .command("setTargetTemperature")
383
+ .description("Set target temperature by environment index (1-3)"))
384
+ .requiredOption("-i, --index <number>", "Environment index (1, 2, or 3)", parseInt)
385
+ .requiredOption("-v, --value <number>", "Temperature in degrees Celsius", parseFloat))).action((options) => __awaiter(void 0, void 0, void 0, function* () {
386
+ const { username, password, mac, index, value, legacy = false } = options;
387
+ const normalizedMac = mac.replace(/:/g, "");
388
+ const storage = createFileStorage();
389
+ configureAmplify(storage);
390
+ let jwtToken;
391
+ try {
392
+ jwtToken = yield getSession(false, legacy);
393
+ }
394
+ catch (_a) {
395
+ if (!username) {
396
+ throw new Error("No session found. Please provide --username to sign in.");
397
+ }
398
+ const pwd = password || (yield promptPassword());
399
+ jwtToken = yield signIn(username, pwd, legacy);
400
+ }
401
+ const apiUrl = legacy ? OLD_API_URL : NEW_API_URL;
402
+ const api = configure(apiUrl);
403
+ const result = yield api.setTargetTemperature(jwtToken, normalizedMac, index, value);
404
+ console.log(JSON.stringify(result, null, 2));
405
+ }));
178
406
  // Command: register
179
407
  addLegacyOption(addAuthOptions(program
180
408
  .command("register")
@@ -4,4 +4,4 @@ export { API_URL, NEW_API_URL, OLD_API_URL } from "./constants";
4
4
  export { configure, getSession, signIn } from "./library";
5
5
  export { serialNumberDisplay, serialNumberFromHex, serialNumberToHex, } from "./serial-utils";
6
6
  export { BufferEncodedType, CommandsType, DeviceAssociationBody, DeviceAssociationResponse, DeviceInfoRawType, DeviceInfoType, DiscoveredDevice, EditDeviceAssociationBody, StatusType, TemperaturesType, UserParametersType, } from "./types";
7
- export declare const deviceInfo: (jwtToken: string, macAddress: string) => Promise<import("./types").DeviceInfoType>, registerDevice: (jwtToken: string, macAddress: string, serialNumber: string, deviceName?: string, deviceRoom?: string) => Promise<import("./types").DeviceAssociationResponse>, editDevice: (jwtToken: string, macAddress: string, deviceName?: string, deviceRoom?: string) => Promise<import("./types").DeviceAssociationResponse>, setPower: (jwtToken: string, macAddress: string, value: number) => Promise<unknown>, setPowerOff: (jwtToken: string, macAddress: string) => Promise<unknown>, setPowerOn: (jwtToken: string, macAddress: string) => Promise<unknown>, getPower: (jwtToken: string, macAddress: string) => Promise<boolean>, getEnvironmentTemperature: (jwtToken: string, macAddress: string) => Promise<number>, getTargetTemperature: (jwtToken: string, macAddress: string) => Promise<number>, setTargetTemperature: (jwtToken: string, macAddress: string, temperature: number) => Promise<unknown>;
7
+ export declare const deviceInfo: (jwtToken: string, macAddress: string) => Promise<import("./types").DeviceInfoType>, registerDevice: (jwtToken: string, macAddress: string, serialNumber: string, deviceName?: string, deviceRoom?: string) => Promise<import("./types").DeviceAssociationResponse>, editDevice: (jwtToken: string, macAddress: string, deviceName?: string, deviceRoom?: string) => Promise<import("./types").DeviceAssociationResponse>, setPower: (jwtToken: string, macAddress: string, value: number) => Promise<unknown>, setPowerOff: (jwtToken: string, macAddress: string) => Promise<unknown>, setPowerOn: (jwtToken: string, macAddress: string) => Promise<unknown>, getPower: (jwtToken: string, macAddress: string) => Promise<boolean>, getEnvironmentTemperature: (jwtToken: string, macAddress: string) => Promise<number>, getTargetTemperature: (jwtToken: string, macAddress: string, envIndex: 1 | 2 | 3) => Promise<number>, setTargetTemperature: (jwtToken: string, macAddress: string, envIndex: 1 | 2 | 3, temperature: number) => Promise<unknown>;
@@ -48,8 +48,38 @@ declare const configure: (baseURL?: string) => {
48
48
  setPowerOff: (jwtToken: string, macAddress: string) => Promise<unknown>;
49
49
  setPowerOn: (jwtToken: string, macAddress: string) => Promise<unknown>;
50
50
  getPower: (jwtToken: string, macAddress: string) => Promise<boolean>;
51
+ setPowerLevel: (jwtToken: string, macAddress: string, level: number) => Promise<unknown>;
52
+ getPowerLevel: (jwtToken: string, macAddress: string) => Promise<number>;
53
+ setFanSpeed: (jwtToken: string, macAddress: string, fanIndex: 1 | 2 | 3, speed: number) => Promise<unknown>;
54
+ getFanSpeed: (jwtToken: string, macAddress: string, fanIndex: 1 | 2 | 3) => Promise<number>;
55
+ setFan1Speed: (jwtToken: string, macAddress: string, speed: number) => Promise<unknown>;
56
+ setFan2Speed: (jwtToken: string, macAddress: string, speed: number) => Promise<unknown>;
57
+ setFan3Speed: (jwtToken: string, macAddress: string, speed: number) => Promise<unknown>;
58
+ getFan1Speed: (jwtToken: string, macAddress: string) => Promise<number>;
59
+ getFan2Speed: (jwtToken: string, macAddress: string) => Promise<number>;
60
+ getFan3Speed: (jwtToken: string, macAddress: string) => Promise<number>;
61
+ setAirkare: (jwtToken: string, macAddress: string, enabled: boolean) => Promise<unknown>;
62
+ setRelax: (jwtToken: string, macAddress: string, enabled: boolean) => Promise<unknown>;
63
+ setStandby: (jwtToken: string, macAddress: string, enabled: boolean) => Promise<unknown>;
64
+ getStandby: (jwtToken: string, macAddress: string) => Promise<boolean>;
65
+ setStandbyTime: (jwtToken: string, macAddress: string, minutes: number) => Promise<unknown>;
66
+ getStandbyTime: (jwtToken: string, macAddress: string) => Promise<number>;
67
+ setAuto: (jwtToken: string, macAddress: string, enabled: boolean) => Promise<unknown>;
68
+ getAuto: (jwtToken: string, macAddress: string) => Promise<boolean>;
51
69
  getEnvironmentTemperature: (jwtToken: string, macAddress: string) => Promise<number>;
52
- getTargetTemperature: (jwtToken: string, macAddress: string) => Promise<number>;
53
- setTargetTemperature: (jwtToken: string, macAddress: string, temperature: number) => Promise<unknown>;
70
+ getTargetTemperature: (jwtToken: string, macAddress: string, envIndex: 1 | 2 | 3) => Promise<number>;
71
+ setTargetTemperature: (jwtToken: string, macAddress: string, envIndex: 1 | 2 | 3, temperature: number) => Promise<unknown>;
72
+ setEnvironment1Temperature: (jwtToken: string, macAddress: string, temperature: number) => Promise<unknown>;
73
+ getEnvironment1Temperature: (jwtToken: string, macAddress: string) => Promise<number>;
74
+ setEnvironment2Temperature: (jwtToken: string, macAddress: string, temperature: number) => Promise<unknown>;
75
+ getEnvironment2Temperature: (jwtToken: string, macAddress: string) => Promise<number>;
76
+ setEnvironment3Temperature: (jwtToken: string, macAddress: string, temperature: number) => Promise<unknown>;
77
+ getEnvironment3Temperature: (jwtToken: string, macAddress: string) => Promise<number>;
78
+ setMeasureUnit: (jwtToken: string, macAddress: string, isFahrenheit: boolean) => Promise<unknown>;
79
+ getMeasureUnit: (jwtToken: string, macAddress: string) => Promise<boolean>;
80
+ setLanguage: (jwtToken: string, macAddress: string, languageCode: number) => Promise<unknown>;
81
+ getLanguage: (jwtToken: string, macAddress: string) => Promise<number>;
82
+ getPelletInReserve: (jwtToken: string, macAddress: string) => Promise<boolean>;
83
+ getPelletAutonomyTime: (jwtToken: string, macAddress: string) => Promise<number>;
54
84
  };
55
85
  export { configure, configureAmplify, createAuthService, getSession, headers, signIn, };