daikin-airbase 0.2.0 → 0.3.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.
- package/dist/index.cjs +64 -4
- package/dist/index.d.mts +57 -3
- package/dist/index.d.ts +57 -3
- package/dist/index.mjs +64 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -344,6 +344,7 @@ var DaikinClient = class {
|
|
|
344
344
|
api;
|
|
345
345
|
zones;
|
|
346
346
|
cachedControlInfo;
|
|
347
|
+
cachedSensorInfo;
|
|
347
348
|
constructor(options) {
|
|
348
349
|
this.options = options;
|
|
349
350
|
if ("host" in options) {
|
|
@@ -353,6 +354,10 @@ var DaikinClient = class {
|
|
|
353
354
|
}
|
|
354
355
|
this.zones = new Zones(this);
|
|
355
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Gets the current state of the aircon.
|
|
359
|
+
* @returns the current state of the aircon.
|
|
360
|
+
*/
|
|
356
361
|
async getControlInfo() {
|
|
357
362
|
const response = await get_control_info(this.api);
|
|
358
363
|
const responseValues = Object.entries(response);
|
|
@@ -362,7 +367,7 @@ var DaikinClient = class {
|
|
|
362
367
|
fanAuto: response.f_auto != 0,
|
|
363
368
|
fanAirside: response.f_airside != 0,
|
|
364
369
|
targetTemperature: response.stemp,
|
|
365
|
-
|
|
370
|
+
controlTemperature: responseValues.filter(([k, v]) => k.startsWith("dt")).map(([k, v]) => +v),
|
|
366
371
|
power: response.pow != 0,
|
|
367
372
|
status: Number(response.operate),
|
|
368
373
|
swinging: response.f_dir != 0,
|
|
@@ -371,21 +376,40 @@ var DaikinClient = class {
|
|
|
371
376
|
remoteControlType: Number(response.remo)
|
|
372
377
|
};
|
|
373
378
|
}
|
|
379
|
+
/** Gets the cached state of the aircon. */
|
|
374
380
|
getCachedControlInfo() {
|
|
375
381
|
return this.cachedControlInfo;
|
|
376
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* Retrieves the power state of the unit.
|
|
385
|
+
*/
|
|
377
386
|
async getPowered() {
|
|
378
387
|
return (await this.getControlInfo()).power;
|
|
379
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* Sets the powered state of the unit.
|
|
391
|
+
* @param state true to turn the unit on.
|
|
392
|
+
*/
|
|
380
393
|
async setPowered(state) {
|
|
381
394
|
return await this.setControlInfo({ power: state });
|
|
382
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* Gets the current mode of the unit.
|
|
398
|
+
*/
|
|
383
399
|
async getMode() {
|
|
384
400
|
return (await this.getControlInfo()).mode;
|
|
385
401
|
}
|
|
402
|
+
/**
|
|
403
|
+
* Sets the mode of the unit.
|
|
404
|
+
* @param mode The mode to set
|
|
405
|
+
*/
|
|
386
406
|
async setMode(mode) {
|
|
387
407
|
return await this.setControlInfo({ mode });
|
|
388
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* Gets the current fan settings of the unit.
|
|
411
|
+
* @returns the current fan settings.
|
|
412
|
+
*/
|
|
389
413
|
async getFan() {
|
|
390
414
|
const info = await this.getControlInfo();
|
|
391
415
|
return {
|
|
@@ -394,21 +418,31 @@ var DaikinClient = class {
|
|
|
394
418
|
airside: info.fanAirside
|
|
395
419
|
};
|
|
396
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* Sets the fan settings of the unit.
|
|
423
|
+
* @param fan the fan settings to set.
|
|
424
|
+
*/
|
|
397
425
|
async setFan(fan) {
|
|
398
426
|
return await this.setControlInfo({ fanSpeed: fan.speed, fanAuto: fan.auto, fanAirside: fan.airside ?? false });
|
|
399
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* Gets the current target temperature of the unit
|
|
430
|
+
*/
|
|
400
431
|
async getTargetTemperature() {
|
|
401
432
|
return (await this.getControlInfo()).targetTemperature;
|
|
402
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Sets the target temperature of the unit.
|
|
436
|
+
* @param temperature the temperature to set. This is rounded to the nearest integer.
|
|
437
|
+
*/
|
|
403
438
|
async setTargetTemperature(temperature) {
|
|
404
439
|
return await this.setControlInfo({ targetTemperature: temperature });
|
|
405
440
|
}
|
|
406
|
-
|
|
407
|
-
return (await this.getControlInfo()).sensorTemperatures;
|
|
408
|
-
}
|
|
441
|
+
/** Gets the current status of the unit. */
|
|
409
442
|
async getStatus() {
|
|
410
443
|
return (await this.getControlInfo()).status;
|
|
411
444
|
}
|
|
445
|
+
/** Sets the control state of the unit. */
|
|
412
446
|
async setControlInfo(info) {
|
|
413
447
|
const latest = await this.getControlInfo();
|
|
414
448
|
const update = { ...latest, ...info };
|
|
@@ -431,6 +465,32 @@ var DaikinClient = class {
|
|
|
431
465
|
throw new Error(`Failed to update control info: ${response.ret}`);
|
|
432
466
|
this.cachedControlInfo = update;
|
|
433
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* Get the current reading of the temperature sensors.
|
|
470
|
+
*/
|
|
471
|
+
async getSensorInfo() {
|
|
472
|
+
const response = await get_sensor_info(this.api);
|
|
473
|
+
return this.cachedSensorInfo = {
|
|
474
|
+
insideTemperature: response.htemp,
|
|
475
|
+
outsideTemperature: response.otemp === "-" ? void 0 : response.otemp
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
/** Gets the current indoor temperature reading. */
|
|
479
|
+
async getInsideTemperature() {
|
|
480
|
+
return (await this.getSensorInfo()).insideTemperature;
|
|
481
|
+
}
|
|
482
|
+
/** Gets the current outdoor temperature reading. */
|
|
483
|
+
async getOutsideTemperature() {
|
|
484
|
+
return (await this.getSensorInfo()).outsideTemperature;
|
|
485
|
+
}
|
|
486
|
+
/** Gets the cached state of the sensor info. */
|
|
487
|
+
getCachedSensorInfo() {
|
|
488
|
+
return this.cachedSensorInfo;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Gets the basic information about the aircon.
|
|
492
|
+
* @returns the basic information about the aircon.
|
|
493
|
+
*/
|
|
434
494
|
async getBasicInfo() {
|
|
435
495
|
const response = await basic_info(this.api);
|
|
436
496
|
return {
|
package/dist/index.d.mts
CHANGED
|
@@ -307,7 +307,7 @@ type ControlInfo = {
|
|
|
307
307
|
fanAuto: boolean;
|
|
308
308
|
fanAirside: boolean;
|
|
309
309
|
targetTemperature: number;
|
|
310
|
-
|
|
310
|
+
controlTemperature: number[];
|
|
311
311
|
power: boolean;
|
|
312
312
|
status: Status;
|
|
313
313
|
swinging: boolean;
|
|
@@ -315,6 +315,10 @@ type ControlInfo = {
|
|
|
315
315
|
isCentrallyControlled: boolean;
|
|
316
316
|
remoteControlType: RemoteType;
|
|
317
317
|
};
|
|
318
|
+
type SensorInfo = {
|
|
319
|
+
insideTemperature: number;
|
|
320
|
+
outsideTemperature: number | undefined;
|
|
321
|
+
};
|
|
318
322
|
|
|
319
323
|
type DeviceOption = {
|
|
320
324
|
device: DiscoveredDevice;
|
|
@@ -335,23 +339,73 @@ declare class DaikinClient {
|
|
|
335
339
|
readonly api: Client;
|
|
336
340
|
readonly zones: Zones;
|
|
337
341
|
private cachedControlInfo;
|
|
342
|
+
private cachedSensorInfo;
|
|
338
343
|
constructor(options: DaikinClientOptions);
|
|
344
|
+
/**
|
|
345
|
+
* Gets the current state of the aircon.
|
|
346
|
+
* @returns the current state of the aircon.
|
|
347
|
+
*/
|
|
339
348
|
getControlInfo(): Promise<ControlInfo>;
|
|
349
|
+
/** Gets the cached state of the aircon. */
|
|
340
350
|
getCachedControlInfo(): ControlInfo | undefined;
|
|
351
|
+
/**
|
|
352
|
+
* Retrieves the power state of the unit.
|
|
353
|
+
*/
|
|
341
354
|
getPowered(): Promise<boolean>;
|
|
355
|
+
/**
|
|
356
|
+
* Sets the powered state of the unit.
|
|
357
|
+
* @param state true to turn the unit on.
|
|
358
|
+
*/
|
|
342
359
|
setPowered(state: boolean): Promise<void>;
|
|
360
|
+
/**
|
|
361
|
+
* Gets the current mode of the unit.
|
|
362
|
+
*/
|
|
343
363
|
getMode(): Promise<ControlMode>;
|
|
364
|
+
/**
|
|
365
|
+
* Sets the mode of the unit.
|
|
366
|
+
* @param mode The mode to set
|
|
367
|
+
*/
|
|
344
368
|
setMode(mode: ControlMode): Promise<void>;
|
|
369
|
+
/**
|
|
370
|
+
* Gets the current fan settings of the unit.
|
|
371
|
+
* @returns the current fan settings.
|
|
372
|
+
*/
|
|
345
373
|
getFan(): Promise<Fan>;
|
|
374
|
+
/**
|
|
375
|
+
* Sets the fan settings of the unit.
|
|
376
|
+
* @param fan the fan settings to set.
|
|
377
|
+
*/
|
|
346
378
|
setFan(fan: Fan): Promise<void>;
|
|
379
|
+
/**
|
|
380
|
+
* Gets the current target temperature of the unit
|
|
381
|
+
*/
|
|
347
382
|
getTargetTemperature(): Promise<number>;
|
|
383
|
+
/**
|
|
384
|
+
* Sets the target temperature of the unit.
|
|
385
|
+
* @param temperature the temperature to set. This is rounded to the nearest integer.
|
|
386
|
+
*/
|
|
348
387
|
setTargetTemperature(temperature: number): Promise<void>;
|
|
349
|
-
|
|
388
|
+
/** Gets the current status of the unit. */
|
|
350
389
|
getStatus(): Promise<Status>;
|
|
390
|
+
/** Sets the control state of the unit. */
|
|
351
391
|
setControlInfo(info: Partial<ControlInfo>): Promise<void>;
|
|
392
|
+
/**
|
|
393
|
+
* Get the current reading of the temperature sensors.
|
|
394
|
+
*/
|
|
395
|
+
getSensorInfo(): Promise<SensorInfo>;
|
|
396
|
+
/** Gets the current indoor temperature reading. */
|
|
397
|
+
getInsideTemperature(): Promise<number>;
|
|
398
|
+
/** Gets the current outdoor temperature reading. */
|
|
399
|
+
getOutsideTemperature(): Promise<number | undefined>;
|
|
400
|
+
/** Gets the cached state of the sensor info. */
|
|
401
|
+
getCachedSensorInfo(): SensorInfo | undefined;
|
|
402
|
+
/**
|
|
403
|
+
* Gets the basic information about the aircon.
|
|
404
|
+
* @returns the basic information about the aircon.
|
|
405
|
+
*/
|
|
352
406
|
getBasicInfo(): Promise<BasicInfo>;
|
|
353
407
|
/** Broadcasts a request to discover devices on the network. */
|
|
354
408
|
static discover(timeoutMs?: number): Promise<DiscoveredDevice[]>;
|
|
355
409
|
}
|
|
356
410
|
|
|
357
|
-
export { type BasicInfo, type BasicInfoResponse, Client, type ControlInfo, type ControlInfoRequestParam, type ControlInfoResponse, ControlMode, DaikinClient, type DaikinClientOptions, type DaikinError, type DaikinResponse, type DateTimeResponse, type DealerInfoResponse, type DiscoveredDevice, type Fan, FanSpeed, type ModelInfoResponse, type NetworkSettingResponse, type QuickTimerResponse, RemoteType, type SensorInfoResponse, Status, type WifiSettingResponse, type Zone, type ZoneSettingRequestParam, type ZoneSettingResponse, Zones, basic_info, discover, getNetwork_setting, get_control_info, get_datetime, get_dealer_info, get_model_info, get_quick_timer, get_sensor_info, get_wifi_setting, get_zone_settings, set_control_info, set_zone_setting };
|
|
411
|
+
export { type BasicInfo, type BasicInfoResponse, Client, type ControlInfo, type ControlInfoRequestParam, type ControlInfoResponse, ControlMode, DaikinClient, type DaikinClientOptions, type DaikinError, type DaikinResponse, type DateTimeResponse, type DealerInfoResponse, type DiscoveredDevice, type Fan, FanSpeed, type ModelInfoResponse, type NetworkSettingResponse, type QuickTimerResponse, RemoteType, type SensorInfo, type SensorInfoResponse, Status, type WifiSettingResponse, type Zone, type ZoneSettingRequestParam, type ZoneSettingResponse, Zones, basic_info, discover, getNetwork_setting, get_control_info, get_datetime, get_dealer_info, get_model_info, get_quick_timer, get_sensor_info, get_wifi_setting, get_zone_settings, set_control_info, set_zone_setting };
|
package/dist/index.d.ts
CHANGED
|
@@ -307,7 +307,7 @@ type ControlInfo = {
|
|
|
307
307
|
fanAuto: boolean;
|
|
308
308
|
fanAirside: boolean;
|
|
309
309
|
targetTemperature: number;
|
|
310
|
-
|
|
310
|
+
controlTemperature: number[];
|
|
311
311
|
power: boolean;
|
|
312
312
|
status: Status;
|
|
313
313
|
swinging: boolean;
|
|
@@ -315,6 +315,10 @@ type ControlInfo = {
|
|
|
315
315
|
isCentrallyControlled: boolean;
|
|
316
316
|
remoteControlType: RemoteType;
|
|
317
317
|
};
|
|
318
|
+
type SensorInfo = {
|
|
319
|
+
insideTemperature: number;
|
|
320
|
+
outsideTemperature: number | undefined;
|
|
321
|
+
};
|
|
318
322
|
|
|
319
323
|
type DeviceOption = {
|
|
320
324
|
device: DiscoveredDevice;
|
|
@@ -335,23 +339,73 @@ declare class DaikinClient {
|
|
|
335
339
|
readonly api: Client;
|
|
336
340
|
readonly zones: Zones;
|
|
337
341
|
private cachedControlInfo;
|
|
342
|
+
private cachedSensorInfo;
|
|
338
343
|
constructor(options: DaikinClientOptions);
|
|
344
|
+
/**
|
|
345
|
+
* Gets the current state of the aircon.
|
|
346
|
+
* @returns the current state of the aircon.
|
|
347
|
+
*/
|
|
339
348
|
getControlInfo(): Promise<ControlInfo>;
|
|
349
|
+
/** Gets the cached state of the aircon. */
|
|
340
350
|
getCachedControlInfo(): ControlInfo | undefined;
|
|
351
|
+
/**
|
|
352
|
+
* Retrieves the power state of the unit.
|
|
353
|
+
*/
|
|
341
354
|
getPowered(): Promise<boolean>;
|
|
355
|
+
/**
|
|
356
|
+
* Sets the powered state of the unit.
|
|
357
|
+
* @param state true to turn the unit on.
|
|
358
|
+
*/
|
|
342
359
|
setPowered(state: boolean): Promise<void>;
|
|
360
|
+
/**
|
|
361
|
+
* Gets the current mode of the unit.
|
|
362
|
+
*/
|
|
343
363
|
getMode(): Promise<ControlMode>;
|
|
364
|
+
/**
|
|
365
|
+
* Sets the mode of the unit.
|
|
366
|
+
* @param mode The mode to set
|
|
367
|
+
*/
|
|
344
368
|
setMode(mode: ControlMode): Promise<void>;
|
|
369
|
+
/**
|
|
370
|
+
* Gets the current fan settings of the unit.
|
|
371
|
+
* @returns the current fan settings.
|
|
372
|
+
*/
|
|
345
373
|
getFan(): Promise<Fan>;
|
|
374
|
+
/**
|
|
375
|
+
* Sets the fan settings of the unit.
|
|
376
|
+
* @param fan the fan settings to set.
|
|
377
|
+
*/
|
|
346
378
|
setFan(fan: Fan): Promise<void>;
|
|
379
|
+
/**
|
|
380
|
+
* Gets the current target temperature of the unit
|
|
381
|
+
*/
|
|
347
382
|
getTargetTemperature(): Promise<number>;
|
|
383
|
+
/**
|
|
384
|
+
* Sets the target temperature of the unit.
|
|
385
|
+
* @param temperature the temperature to set. This is rounded to the nearest integer.
|
|
386
|
+
*/
|
|
348
387
|
setTargetTemperature(temperature: number): Promise<void>;
|
|
349
|
-
|
|
388
|
+
/** Gets the current status of the unit. */
|
|
350
389
|
getStatus(): Promise<Status>;
|
|
390
|
+
/** Sets the control state of the unit. */
|
|
351
391
|
setControlInfo(info: Partial<ControlInfo>): Promise<void>;
|
|
392
|
+
/**
|
|
393
|
+
* Get the current reading of the temperature sensors.
|
|
394
|
+
*/
|
|
395
|
+
getSensorInfo(): Promise<SensorInfo>;
|
|
396
|
+
/** Gets the current indoor temperature reading. */
|
|
397
|
+
getInsideTemperature(): Promise<number>;
|
|
398
|
+
/** Gets the current outdoor temperature reading. */
|
|
399
|
+
getOutsideTemperature(): Promise<number | undefined>;
|
|
400
|
+
/** Gets the cached state of the sensor info. */
|
|
401
|
+
getCachedSensorInfo(): SensorInfo | undefined;
|
|
402
|
+
/**
|
|
403
|
+
* Gets the basic information about the aircon.
|
|
404
|
+
* @returns the basic information about the aircon.
|
|
405
|
+
*/
|
|
352
406
|
getBasicInfo(): Promise<BasicInfo>;
|
|
353
407
|
/** Broadcasts a request to discover devices on the network. */
|
|
354
408
|
static discover(timeoutMs?: number): Promise<DiscoveredDevice[]>;
|
|
355
409
|
}
|
|
356
410
|
|
|
357
|
-
export { type BasicInfo, type BasicInfoResponse, Client, type ControlInfo, type ControlInfoRequestParam, type ControlInfoResponse, ControlMode, DaikinClient, type DaikinClientOptions, type DaikinError, type DaikinResponse, type DateTimeResponse, type DealerInfoResponse, type DiscoveredDevice, type Fan, FanSpeed, type ModelInfoResponse, type NetworkSettingResponse, type QuickTimerResponse, RemoteType, type SensorInfoResponse, Status, type WifiSettingResponse, type Zone, type ZoneSettingRequestParam, type ZoneSettingResponse, Zones, basic_info, discover, getNetwork_setting, get_control_info, get_datetime, get_dealer_info, get_model_info, get_quick_timer, get_sensor_info, get_wifi_setting, get_zone_settings, set_control_info, set_zone_setting };
|
|
411
|
+
export { type BasicInfo, type BasicInfoResponse, Client, type ControlInfo, type ControlInfoRequestParam, type ControlInfoResponse, ControlMode, DaikinClient, type DaikinClientOptions, type DaikinError, type DaikinResponse, type DateTimeResponse, type DealerInfoResponse, type DiscoveredDevice, type Fan, FanSpeed, type ModelInfoResponse, type NetworkSettingResponse, type QuickTimerResponse, RemoteType, type SensorInfo, type SensorInfoResponse, Status, type WifiSettingResponse, type Zone, type ZoneSettingRequestParam, type ZoneSettingResponse, Zones, basic_info, discover, getNetwork_setting, get_control_info, get_datetime, get_dealer_info, get_model_info, get_quick_timer, get_sensor_info, get_wifi_setting, get_zone_settings, set_control_info, set_zone_setting };
|
package/dist/index.mjs
CHANGED
|
@@ -289,6 +289,7 @@ var DaikinClient = class {
|
|
|
289
289
|
api;
|
|
290
290
|
zones;
|
|
291
291
|
cachedControlInfo;
|
|
292
|
+
cachedSensorInfo;
|
|
292
293
|
constructor(options) {
|
|
293
294
|
this.options = options;
|
|
294
295
|
if ("host" in options) {
|
|
@@ -298,6 +299,10 @@ var DaikinClient = class {
|
|
|
298
299
|
}
|
|
299
300
|
this.zones = new Zones(this);
|
|
300
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Gets the current state of the aircon.
|
|
304
|
+
* @returns the current state of the aircon.
|
|
305
|
+
*/
|
|
301
306
|
async getControlInfo() {
|
|
302
307
|
const response = await get_control_info(this.api);
|
|
303
308
|
const responseValues = Object.entries(response);
|
|
@@ -307,7 +312,7 @@ var DaikinClient = class {
|
|
|
307
312
|
fanAuto: response.f_auto != 0,
|
|
308
313
|
fanAirside: response.f_airside != 0,
|
|
309
314
|
targetTemperature: response.stemp,
|
|
310
|
-
|
|
315
|
+
controlTemperature: responseValues.filter(([k, v]) => k.startsWith("dt")).map(([k, v]) => +v),
|
|
311
316
|
power: response.pow != 0,
|
|
312
317
|
status: Number(response.operate),
|
|
313
318
|
swinging: response.f_dir != 0,
|
|
@@ -316,21 +321,40 @@ var DaikinClient = class {
|
|
|
316
321
|
remoteControlType: Number(response.remo)
|
|
317
322
|
};
|
|
318
323
|
}
|
|
324
|
+
/** Gets the cached state of the aircon. */
|
|
319
325
|
getCachedControlInfo() {
|
|
320
326
|
return this.cachedControlInfo;
|
|
321
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Retrieves the power state of the unit.
|
|
330
|
+
*/
|
|
322
331
|
async getPowered() {
|
|
323
332
|
return (await this.getControlInfo()).power;
|
|
324
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Sets the powered state of the unit.
|
|
336
|
+
* @param state true to turn the unit on.
|
|
337
|
+
*/
|
|
325
338
|
async setPowered(state) {
|
|
326
339
|
return await this.setControlInfo({ power: state });
|
|
327
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Gets the current mode of the unit.
|
|
343
|
+
*/
|
|
328
344
|
async getMode() {
|
|
329
345
|
return (await this.getControlInfo()).mode;
|
|
330
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Sets the mode of the unit.
|
|
349
|
+
* @param mode The mode to set
|
|
350
|
+
*/
|
|
331
351
|
async setMode(mode) {
|
|
332
352
|
return await this.setControlInfo({ mode });
|
|
333
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Gets the current fan settings of the unit.
|
|
356
|
+
* @returns the current fan settings.
|
|
357
|
+
*/
|
|
334
358
|
async getFan() {
|
|
335
359
|
const info = await this.getControlInfo();
|
|
336
360
|
return {
|
|
@@ -339,21 +363,31 @@ var DaikinClient = class {
|
|
|
339
363
|
airside: info.fanAirside
|
|
340
364
|
};
|
|
341
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Sets the fan settings of the unit.
|
|
368
|
+
* @param fan the fan settings to set.
|
|
369
|
+
*/
|
|
342
370
|
async setFan(fan) {
|
|
343
371
|
return await this.setControlInfo({ fanSpeed: fan.speed, fanAuto: fan.auto, fanAirside: fan.airside ?? false });
|
|
344
372
|
}
|
|
373
|
+
/**
|
|
374
|
+
* Gets the current target temperature of the unit
|
|
375
|
+
*/
|
|
345
376
|
async getTargetTemperature() {
|
|
346
377
|
return (await this.getControlInfo()).targetTemperature;
|
|
347
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* Sets the target temperature of the unit.
|
|
381
|
+
* @param temperature the temperature to set. This is rounded to the nearest integer.
|
|
382
|
+
*/
|
|
348
383
|
async setTargetTemperature(temperature) {
|
|
349
384
|
return await this.setControlInfo({ targetTemperature: temperature });
|
|
350
385
|
}
|
|
351
|
-
|
|
352
|
-
return (await this.getControlInfo()).sensorTemperatures;
|
|
353
|
-
}
|
|
386
|
+
/** Gets the current status of the unit. */
|
|
354
387
|
async getStatus() {
|
|
355
388
|
return (await this.getControlInfo()).status;
|
|
356
389
|
}
|
|
390
|
+
/** Sets the control state of the unit. */
|
|
357
391
|
async setControlInfo(info) {
|
|
358
392
|
const latest = await this.getControlInfo();
|
|
359
393
|
const update = { ...latest, ...info };
|
|
@@ -376,6 +410,32 @@ var DaikinClient = class {
|
|
|
376
410
|
throw new Error(`Failed to update control info: ${response.ret}`);
|
|
377
411
|
this.cachedControlInfo = update;
|
|
378
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* Get the current reading of the temperature sensors.
|
|
415
|
+
*/
|
|
416
|
+
async getSensorInfo() {
|
|
417
|
+
const response = await get_sensor_info(this.api);
|
|
418
|
+
return this.cachedSensorInfo = {
|
|
419
|
+
insideTemperature: response.htemp,
|
|
420
|
+
outsideTemperature: response.otemp === "-" ? void 0 : response.otemp
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
/** Gets the current indoor temperature reading. */
|
|
424
|
+
async getInsideTemperature() {
|
|
425
|
+
return (await this.getSensorInfo()).insideTemperature;
|
|
426
|
+
}
|
|
427
|
+
/** Gets the current outdoor temperature reading. */
|
|
428
|
+
async getOutsideTemperature() {
|
|
429
|
+
return (await this.getSensorInfo()).outsideTemperature;
|
|
430
|
+
}
|
|
431
|
+
/** Gets the cached state of the sensor info. */
|
|
432
|
+
getCachedSensorInfo() {
|
|
433
|
+
return this.cachedSensorInfo;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Gets the basic information about the aircon.
|
|
437
|
+
* @returns the basic information about the aircon.
|
|
438
|
+
*/
|
|
379
439
|
async getBasicInfo() {
|
|
380
440
|
const response = await basic_info(this.api);
|
|
381
441
|
return {
|