homebridge-myplace 2.2.0 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  ### Homebridge-myplace - An independent plugin for Homebridge bringing Advantage Air MyPlace system, its smaller siblings (E-zone, MyAir, MyAir4, etc) and its cousins (e.g. Fujitsu AnywAir) to Homekit
2
- ##### v2.2.0 (2025-06-27)
2
+ ##### v2.2.2 (2025-06-29)
3
3
 
4
- ###### (1) Simplified the setup process
4
+ ###### (1) Fixed an issue affecting some users who has temperature controlled zone
5
+ ###### (2) Fixed other minor bugs
@@ -1,4 +1,13 @@
1
1
  ### Homebridge-myplace - An independent plugin for Homebridge bringing Advantage Air MyPlace system, its smaller siblings (E-zone, MyAir, MyAir4, etc) and its cousins (e.g. Fujitsu AnywAir) to Homekit
2
+ ##### v2.2.2 (2025-06-29)
3
+
4
+ ###### (1) Fixed an issue affecting some users who has temperature controlled zone
5
+ ###### (2) Fixed other minor bugs
6
+
7
+ ##### v2.2.1 (2025-06-28)
8
+
9
+ ###### (1) Fixed buffer overflow for large system
10
+
2
11
  ##### v2.2.0 (2025-06-27)
3
12
 
4
13
  ###### (1) Simplified the setup process
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-myplace",
3
3
  "description": "Exec Plugin bringing Advanatge Air MyPlace system to Homekit",
4
- "version": "2.2.0",
4
+ "version": "2.2.2",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Ung Sing"
@@ -24,7 +24,7 @@
24
24
  "fakegato-history": ">=0.6.1",
25
25
  "github-version-checker": ">=2.2.0",
26
26
  "latest-version": "^5.1.0",
27
- "moment": "*",
27
+ "moment": ">=2.29.4",
28
28
  "path": "^0.12.7",
29
29
  "userid": "^1.0.0",
30
30
  "which": "^2.0.2"
@@ -60,7 +60,7 @@
60
60
  "tools": "tools",
61
61
  "Screenshots": "Screenshots",
62
62
  "lib": "lib",
63
- "utils": "utils"
63
+ "utils": "utils"
64
64
  },
65
65
  "engines": {
66
66
  "homebridge": "^1.8.0 || ^2.0.0-beta.0",
@@ -94,7 +94,7 @@
94
94
  "pretest": "if [ ! -d 'node_modules' ];then printf ' test is only done in a development environment\n';exit 1; fi",
95
95
  "precheck": "if [ ! -d 'node_modules' ];then printf ' check is only done in a development environment\n';exit 1; fi",
96
96
  "check": "shellcheck MyPlace.sh test/*.bats test/StartServer test/StopServer",
97
- "testjs": "node_modules/.bin/mocha ",
97
+ "testjs": "mocha ",
98
98
  "allBats": "a(){ npm run doBats test/StartServer test/*.bats test/StopServer; };a",
99
99
  "doBats": "export PORT=2025; bats",
100
100
  "bats": "a(){ npm run doBats test/StartServer $* test/StopServer; };a",
@@ -5,10 +5,10 @@
5
5
 
6
6
  // Read CLI args
7
7
  // Input arguments (typically from process.argv)
8
- let AAIP = process.argv[2];
9
- let AAname = process.argv[3];
8
+ let AAIP1 = process.argv[2];
9
+ let AAname1 = process.argv[3];
10
10
  let extraTimers1 = process.argv[4];
11
- let AAdebug = process.argv[5];
11
+ let AAdebug1 = process.argv[5];
12
12
  let AAIP2 = process.argv[6];
13
13
  let AAname2 = process.argv[7];
14
14
  let extraTimers2 = process.argv[8];
@@ -26,11 +26,6 @@ let myPlaceConstants = { constants: [] };
26
26
  let myPlaceQueueTypes = { queueTypes: [] };
27
27
  let myPlaceAccessories = { accessories: [] };
28
28
 
29
- // Set some BOOLEAN variables
30
- let hasAircons = false;
31
- let hasLights = false;
32
- let hasThings = false;
33
-
34
29
  // Declare an ID array
35
30
  let id = [];
36
31
 
@@ -139,7 +134,7 @@ function createLinkedTypesFanSpeed(name, motherAcc, ac, ip) {
139
134
  myPlaceAccessories.accessories.push(motherAcc);
140
135
  }
141
136
 
142
- function createFanSwitch(name, nameA, ac, ip) {
137
+ function createFanSwitch(name, AAname, ac, ip) {
143
138
  let ac_l = ` ${ac}`;
144
139
  if (ac_l === " ac1") ac_l = "";
145
140
 
@@ -158,7 +153,7 @@ function createFanSwitch(name, nameA, ac, ip) {
158
153
  };
159
154
 
160
155
  // Attach the fan speed type to this switch as a linkedType
161
- createLinkedTypesFanSpeed(`${nameA} FanSpeed`, myPlaceFanSwitch, ac, ip);
156
+ createLinkedTypesFanSpeed(`${AAname} FanSpeed`, myPlaceFanSwitch, ac, ip);
162
157
  }
163
158
 
164
159
  function createTimerLightbulb(name, suffix, ac, ip) {
@@ -217,7 +212,7 @@ function createZoneFan(name, zoneStr, ac, ip) {
217
212
  myPlaceAccessories.accessories.push(myPlaceZoneFan);
218
213
  }
219
214
 
220
- function createZoneFanv2(name, nameZ, zoneStr, ac, ip) {
215
+ function createZoneFanv2(name, thisZoneName, zoneStr, ac, ip) {
221
216
  let ac_l = ` ${ac}`;
222
217
  if (ac_l === " ac1") ac_l = "";
223
218
 
@@ -246,7 +241,7 @@ function createZoneFanv2(name, nameZ, zoneStr, ac, ip) {
246
241
  };
247
242
 
248
243
  // Call the external function to generate the linked thermostat accessory
249
- const myPlaceZoneThermostatLinkedTypes = createZoneThermostat(`${nameZ} Thermostat`, zoneStr, ac, ip);
244
+ const myPlaceZoneThermostatLinkedTypes = createZoneThermostat(`${thisZoneName} Thermostat`, zoneStr, ac, ip);
250
245
 
251
246
  // Append linked thermostat
252
247
  myPlaceZoneFanv2.linkedTypes.push(myPlaceZoneThermostatLinkedTypes);
@@ -261,7 +256,7 @@ function createZoneThermostat(name, zone, ac, ip) {
261
256
  if (zone !== "") zone = `${zone} `;
262
257
 
263
258
  // Construct the thermostat object
264
- const myPlaceZoneThermostat = {
259
+ return {
265
260
  type: "Thermostat",
266
261
  displayName: name,
267
262
  currentHeatingCoolingState: "OFF",
@@ -286,11 +281,9 @@ function createZoneThermostat(name, zone, ac, ip) {
286
281
  state_cmd: `'${MYPLACE_SH_PATH}'`,
287
282
  state_cmd_suffix: `${zone}${ip}${ac_l}`
288
283
  };
289
-
290
- return myPlaceZoneThermostat;
291
284
  }
292
285
 
293
- function createZoneFanv2noRotationDirection(name, nameZ, zoneStr, ac, ip) {
286
+ function createZoneFanv2noRotationDirection(name, thisZoneName, zoneStr, ac, ip) {
294
287
  let ac_l = ` ${ac}`;
295
288
  if (ac_l === " ac1") ac_l = "";
296
289
 
@@ -317,7 +310,7 @@ function createZoneFanv2noRotationDirection(name, nameZ, zoneStr, ac, ip) {
317
310
  };
318
311
 
319
312
  // Generate linked thermostat accessory
320
- const myPlaceZoneThermostatLinkedtypes = createZoneThermostat(`${nameZ} Thermostat`, zoneStr, ac, ip);
313
+ const myPlaceZoneThermostatLinkedTypes = createZoneThermostat(`${thisZoneName} Thermostat`, zoneStr, ac, ip);
321
314
 
322
315
  // Add linked thermostat
323
316
  myPlaceZoneFanv2noRotationDirection.linkedTypes.push(myPlaceZoneThermostatLinkedTypes);
@@ -451,7 +444,7 @@ function assembleMyPlaceConfig() {
451
444
  }
452
445
 
453
446
  async function main({
454
- AAIP, AAname, extraTimers1, AAdebug,
447
+ AAIP1, AAname1, extraTimers1, AAdebug1,
455
448
  AAIP2, AAname2, extraTimers2, AAdebug2,
456
449
  AAIP3, AAname3, extraTimers3, AAdebug3,
457
450
  MYPLACE_SH_PATH
@@ -469,7 +462,7 @@ async function main({
469
462
  }
470
463
 
471
464
  try {
472
- AAIP = normalizeIP(AAIP);
465
+ AAIP1 = normalizeIP(AAIP1);
473
466
  AAIP2 = normalizeIP(AAIP2);
474
467
  AAIP3 = normalizeIP(AAIP3);
475
468
  } catch (err) {
@@ -479,7 +472,7 @@ async function main({
479
472
 
480
473
  // Determine number of tablets/devices
481
474
  let noOfTablets = 0;
482
- if (AAIP) noOfTablets = 1;
475
+ if (AAIP1) noOfTablets = 1;
483
476
  if (AAIP2) noOfTablets = 2;
484
477
  if (AAIP3) noOfTablets = 3;
485
478
 
@@ -487,26 +480,26 @@ async function main({
487
480
  // createBasicKeys, myPlaceConstants, myPlaceQueueTypes, myPlaceModelQueue, myPlaceAccessories, myPlaceConfig
488
481
 
489
482
  for (let n = 1; n <= noOfTablets; n++) {
490
- let ip, IPA, nameA, extraTimers, debug, queue;
483
+ let ip, IPA, AAname, extraTimers, debug, queue;
491
484
 
492
485
  if (n === 1) {
493
- ip = "\${AAIP}";
494
- IPA = AAIP;
495
- nameA = AAname;
486
+ ip = "\${AAIP1}";
487
+ IPA = AAIP1;
488
+ AAname = AAname1;
496
489
  extraTimers = extraTimers1;
497
- debug = AAdebug;
490
+ debug = AAdebug1;
498
491
  queue = "AAA";
499
492
  } else if (n === 2) {
500
493
  ip = "\${AAIP2}";
501
494
  IPA = AAIP2;
502
- nameA = AAname2;
495
+ AAname = AAname2;
503
496
  extraTimers = extraTimers2;
504
497
  debug = AAdebug2;
505
498
  queue = "AAB";
506
499
  } else if (n === 3) {
507
500
  ip = "\${AAIP3}";
508
501
  IPA = AAIP3;
509
- nameA = AAname3;
502
+ AAname = AAname3;
510
503
  extraTimers = extraTimers3;
511
504
  debug = AAdebug3;
512
505
  queue = "AAC";
@@ -538,7 +531,7 @@ async function main({
538
531
  const hasThings = myAirData.system?.hasThings ?? false;
539
532
 
540
533
  // Set debugMyPlace flag based on any debug true
541
- const debugMyPlace = (AAdebug === "true" || AAdebug2 === "true" || AAdebug3 === "true");
534
+ const debugMyPlace = (AAdebug1 === "true" || AAdebug2 === "true" || AAdebug3 === "true");
542
535
 
543
536
  // Create basic keys, constants and queueTypes
544
537
  createBasicKeys(debugMyPlace);
@@ -566,32 +559,34 @@ async function main({
566
559
  }
567
560
 
568
561
  if (a >= 2) {
569
- nameA = `${nameA} ${ac}`;
562
+ thisAAname = `${AAname}${a}`;
563
+ } else {
564
+ thisAAname = AAname;
570
565
  }
571
- const zoneA = zoneSetTemp ? "" : "noOtherThermostat";
566
+ const AAzone = zoneSetTemp ? "" : "noOtherThermostat";
572
567
 
573
568
  // Create aircon configs
574
- createThermostat(nameA, zoneA, ac, ip);
575
- createFanSwitch(`${nameA} Fan`, nameA, ac, ip);
576
- createTimerLightbulb(`${nameA} Timer`, "timer", ac, ip);
569
+ createThermostat(thisAAname, AAzone, ac, ip);
570
+ createFanSwitch(`${thisAAname} Fan`, AAname, ac, ip);
571
+ createTimerLightbulb(`${thisAAname} Timer`, "timer", ac, ip);
577
572
  if (extraTimers === "true") {
578
- createTimerLightbulb(`${nameA} Fan Timer`, "fanTimer", ac, ip);
579
- createTimerLightbulb(`${nameA} Cool Timer`, "coolTimer", ac, ip);
580
- createTimerLightbulb(`${nameA} Heat Timer`, "heatTimer", ac, ip);
573
+ createTimerLightbulb(`${thisAAname} Fan Timer`, "fanTimer", ac, ip);
574
+ createTimerLightbulb(`${thisAAname} Cool Timer`, "coolTimer", ac, ip);
575
+ createTimerLightbulb(`${thisAAname} Heat Timer`, "heatTimer", ac, ip);
581
576
  }
582
577
 
583
578
  // Create zone configs
584
579
  const myZoneValue = aircon.myZone ?? 0;
585
580
  for (let b = 1; b <= nZones; b++) {
586
581
  const zoneStr = `z${String(b).padStart(2, "0")}`;
587
- const nameZ = myAirData.aircons?.[ac]?.zones?.[zoneStr]?.name ?? "";
582
+ const thisZoneName = myAirData.aircons?.[ac]?.zones?.[zoneStr]?.name ?? "";
588
583
  const rssi = myAirData.aircons?.[ac]?.zones?.[zoneStr]?.rssi ?? 0;
589
584
  if (rssi === 0) {
590
- createZoneFan(`${nameZ} Zone`, zoneStr, ac, ip);
585
+ createZoneFan(`${thisZoneName} Zone`, zoneStr, ac, ip);
591
586
  } else if (myZoneValue !== 0) {
592
- createZoneFanv2(`${nameZ} Zone`, nameZ, zoneStr, ac, ip);
587
+ createZoneFanv2(`${thisZoneName} Zone`, thisZoneName, zoneStr, ac, ip);
593
588
  } else {
594
- createZoneFanv2noRotationDirection(`${nameZ} Zone`, nameZ, zoneStr, ac, ip);
589
+ createZoneFanv2noRotationDirection(`${thisZoneName} Zone`, thisZoneName, zoneStr, ac, ip);
595
590
  }
596
591
  }
597
592
  }
@@ -636,12 +631,12 @@ async function main({
636
631
  const myPlaceConfig = assembleMyPlaceConfig();
637
632
 
638
633
  console.log("DONE! createMyPlaceConfig completed successfully!");
639
- console.log(JSON.stringify(myPlaceConfig, null, 2));
634
+ console.log(JSON.stringify(myPlaceConfig));
640
635
  process.exit(0);
641
636
  }
642
637
 
643
638
  main({
644
- AAIP, AAname, extraTimers1, AAdebug,
639
+ AAIP1, AAname1, extraTimers1, AAdebug1,
645
640
  AAIP2, AAname2, extraTimers2, AAdebug2,
646
641
  AAIP3, AAname3, extraTimers3, AAdebug3,
647
642
  MYPLACE_SH_PATH