daikin-airbase 0.1.3 → 0.1.4

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 CHANGED
@@ -70,7 +70,7 @@ var API = class {
70
70
  for (const key in parameters) {
71
71
  const value = parameters[key];
72
72
  if (value === void 0) continue;
73
- const encoded = encodeURIComponent(`${value || ""}`);
73
+ const encoded = encodeURIComponent(`${value ?? ""}`);
74
74
  queries.push(`${key}=${encoded}`);
75
75
  }
76
76
  }
@@ -287,11 +287,12 @@ var DaikinClient = class {
287
287
  const info = await this.getControlInfo();
288
288
  return {
289
289
  speed: info.fanSpeed,
290
- auto: info.fanAuto
290
+ auto: info.fanAuto,
291
+ airside: info.fanAirside
291
292
  };
292
293
  }
293
294
  async setFan(fan) {
294
- return await this.setControlInfo({ fanSpeed: fan.speed, fanAuto: fan.auto });
295
+ return await this.setControlInfo({ fanSpeed: fan.speed, fanAuto: fan.auto, fanAirside: fan.airside ?? false });
295
296
  }
296
297
  async getTargetTemperature() {
297
298
  return (await this.getControlInfo()).targetTemperature;
@@ -310,15 +311,21 @@ var DaikinClient = class {
310
311
  const update = { ...latest, ...info };
311
312
  const int = (v) => Math.round(v);
312
313
  const bool = (v) => v ? 1 : 0;
313
- const response = await set_control_info(this.api, {
314
- f_airside: bool(update.fanAirside),
314
+ const params = {
315
+ f_airside: 0,
315
316
  f_auto: bool(update.fanAuto),
316
317
  f_dir: bool(update.swinging),
317
318
  f_rate: int(update.fanSpeed),
318
319
  mode: int(update.mode),
319
320
  pow: bool(update.power),
320
321
  stemp: int(update.targetTemperature)
321
- });
322
+ };
323
+ if (update.fanAirside) {
324
+ params.f_airside = 1;
325
+ params.f_auto = 0;
326
+ params.f_dir = 0;
327
+ }
328
+ const response = await set_control_info(this.api, params);
322
329
  if (response.ret !== "OK")
323
330
  throw new Error(`Failed to update control info: ${response.ret}`);
324
331
  this.cachedControlInfo = update;
package/dist/index.d.mts CHANGED
@@ -156,6 +156,7 @@ type DaikinClientOptions = (DeviceOption | HostOption) & {
156
156
  type Fan = {
157
157
  speed: FanSpeed;
158
158
  auto: boolean;
159
+ airside?: boolean;
159
160
  };
160
161
  declare class DaikinClient {
161
162
  private readonly options;
package/dist/index.d.ts CHANGED
@@ -156,6 +156,7 @@ type DaikinClientOptions = (DeviceOption | HostOption) & {
156
156
  type Fan = {
157
157
  speed: FanSpeed;
158
158
  auto: boolean;
159
+ airside?: boolean;
159
160
  };
160
161
  declare class DaikinClient {
161
162
  private readonly options;
package/dist/index.mjs CHANGED
@@ -30,7 +30,7 @@ var API = class {
30
30
  for (const key in parameters) {
31
31
  const value = parameters[key];
32
32
  if (value === void 0) continue;
33
- const encoded = encodeURIComponent(`${value || ""}`);
33
+ const encoded = encodeURIComponent(`${value ?? ""}`);
34
34
  queries.push(`${key}=${encoded}`);
35
35
  }
36
36
  }
@@ -247,11 +247,12 @@ var DaikinClient = class {
247
247
  const info = await this.getControlInfo();
248
248
  return {
249
249
  speed: info.fanSpeed,
250
- auto: info.fanAuto
250
+ auto: info.fanAuto,
251
+ airside: info.fanAirside
251
252
  };
252
253
  }
253
254
  async setFan(fan) {
254
- return await this.setControlInfo({ fanSpeed: fan.speed, fanAuto: fan.auto });
255
+ return await this.setControlInfo({ fanSpeed: fan.speed, fanAuto: fan.auto, fanAirside: fan.airside ?? false });
255
256
  }
256
257
  async getTargetTemperature() {
257
258
  return (await this.getControlInfo()).targetTemperature;
@@ -270,15 +271,21 @@ var DaikinClient = class {
270
271
  const update = { ...latest, ...info };
271
272
  const int = (v) => Math.round(v);
272
273
  const bool = (v) => v ? 1 : 0;
273
- const response = await set_control_info(this.api, {
274
- f_airside: bool(update.fanAirside),
274
+ const params = {
275
+ f_airside: 0,
275
276
  f_auto: bool(update.fanAuto),
276
277
  f_dir: bool(update.swinging),
277
278
  f_rate: int(update.fanSpeed),
278
279
  mode: int(update.mode),
279
280
  pow: bool(update.power),
280
281
  stemp: int(update.targetTemperature)
281
- });
282
+ };
283
+ if (update.fanAirside) {
284
+ params.f_airside = 1;
285
+ params.f_auto = 0;
286
+ params.f_dir = 0;
287
+ }
288
+ const response = await set_control_info(this.api, params);
282
289
  if (response.ret !== "OK")
283
290
  throw new Error(`Failed to update control info: ${response.ret}`);
284
291
  this.cachedControlInfo = update;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daikin-airbase",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",