homebridge-blueair-purifier 1.0.10 → 1.0.12

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 ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ # v1.0.11
4
+ ## 2024-07-21
5
+ - fix: added Canada to the custom UI
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "pollingInterval": {
48
48
  "title": "Polling Interval",
49
- "description": "Interval in miliseconds to poll the BlueAir API for updates. It's recommended to keep this at least 5 seconds (5000 miliseconds).",
49
+ "description": "Interval in miliseconds to poll the BlueAir API for updates. It's recommended to keep this at least 15 seconds (15000 miliseconds).",
50
50
  "type": "number"
51
51
  },
52
52
  "devices": {
@@ -117,16 +117,7 @@
117
117
  "expandable": true,
118
118
  "expanded": true,
119
119
  "title": "Common Settings",
120
- "items": [
121
- "name",
122
- "username",
123
- "password",
124
- "region",
125
- "accountUuid",
126
- "verboseLogging",
127
- "uiDebug",
128
- "pollingInterval"
129
- ]
120
+ "items": ["name", "username", "password", "region", "accountUuid", "verboseLogging", "uiDebug", "pollingInterval"]
130
121
  },
131
122
  {
132
123
  "key": "devices",
@@ -24,7 +24,7 @@ exports.defaultConfig = {
24
24
  password: '',
25
25
  accountUuid: '',
26
26
  region: Region.EU,
27
- pollingInterval: 5000,
27
+ pollingInterval: 15000,
28
28
  devices: [],
29
29
  };
30
30
  exports.defaultDeviceConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"platformUtils.js","sourceRoot":"","sources":["../src/platformUtils.ts"],"names":[],"mappings":";;;AA2BA,IAAY,MAMX;AAND,WAAY,MAAM;IAChB,4CAAkC,CAAA;IAClC,0BAAgB,CAAA;IAChB,sBAAY,CAAA;IACZ,uBAAa,CAAA;IACb,oBAAU,CAAA;AACZ,CAAC,EANW,MAAM,sBAAN,MAAM,QAMjB;AAEY,QAAA,SAAS,GAAG;IACvB,CAAC,MAAM,CAAC,EAAE,CAAC,EAA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;IACjB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI;IACjB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI;CAClB,CAAC;AAEW,QAAA,aAAa,GAAW;IACnC,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,KAAK;IACd,cAAc,EAAE,KAAK;IACrB,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,EAAE;IACf,MAAM,EAAE,MAAM,CAAC,EAAE;IACjB,eAAe,EAAE,KAAK;IACtB,OAAO,EAAE,EAAE;CACZ,CAAC;AAEW,QAAA,mBAAmB,GAAiB;IAC/C,EAAE,EAAE,EAAE;IACN,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,YAAY,EAAE,EAAE;IAChB,iBAAiB,EAAE,EAAE;IACrB,GAAG,EAAE,KAAK;IACV,gBAAgB,EAAE,KAAK;IACvB,SAAS,EAAE,KAAK;IAChB,iBAAiB,EAAE,KAAK;IACxB,cAAc,EAAE,KAAK;IACrB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;CACjB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  <link href="css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous" />
2
2
  <script src="js/bootstrap.min.js" crossorigin="anonymous"></script>
3
-
3
+
4
4
  <div id="main" data-bs-theme="dark">
5
5
  <div class="card">
6
-
6
+
7
7
  <div class="card-header" id="uiButtons">
8
8
  <h5 class="mb-0 text-center">
9
9
  <button class="btn btn-primary" data-bs-toggle="collapse" data-bs-target="#discoverDevices"
@@ -12,7 +12,7 @@
12
12
  </button>
13
13
  </h5>
14
14
  </div>
15
-
15
+
16
16
  <div class="collapse" id="discoverDevices">
17
17
  <div class="card-body">
18
18
  <form>
@@ -32,7 +32,7 @@
32
32
  <option value="Australia">Australia</option>
33
33
  <option value="China">China</option>
34
34
  <option value="Russia">Russia</option>
35
- <option value="USA">USA</option>
35
+ <option value="USA">USA/Canada</option>
36
36
  </select>
37
37
  </div>
38
38
  <button class="btn btn-primary btn-login" type="submit" id="discoverBtn" style="border: 0;">
@@ -59,49 +59,49 @@
59
59
  </div>
60
60
  </div>
61
61
  </div>
62
-
62
+
63
63
  </div>
64
-
64
+
65
65
  <style>
66
-
66
+
67
67
  .hide {
68
68
  display: none;
69
69
  }
70
-
70
+
71
71
  .disabled {
72
72
  pointer-events: none;
73
73
  opacity: 0.5;
74
74
  }
75
75
  </style>
76
-
77
-
76
+
77
+
78
78
  <script>
79
-
79
+
80
80
  (async () => {
81
81
  /*********************************************************************
82
82
  * Initialize Javascript supporting code
83
83
  */
84
84
  homebridge.showSpinner();
85
-
85
+
86
86
  const { defaultConfig, defaultDeviceConfig } = await homebridge.request('/getDefaults');
87
87
  const pluginConfig = await homebridge.getPluginConfig();
88
88
  const configSchema = await homebridge.getPluginConfigSchema();
89
-
89
+
90
90
  if (!pluginConfig.length) {
91
91
  pluginConfig.push({});
92
92
  }
93
93
  let configuration = pluginConfig[0];
94
-
94
+
95
95
  // Helper funcion to contol debug messages
96
96
  function debugLog(s) {
97
97
  if (configuration.uiDebug) {
98
98
  console.debug(s);
99
99
  }
100
100
  }
101
-
101
+
102
102
  debugLog(`Plugin Config:\n${JSON.stringify(configuration, null, 2)}`);
103
103
  configuration = await homebridge.request('/mergeToDefault', { config: configuration });
104
-
104
+
105
105
  /*********************************************************************
106
106
  * showToast event listener
107
107
  * Provides information from server-side to the end user.
@@ -114,13 +114,13 @@
114
114
  homebridge.toast.error(event.data.msg);
115
115
  }
116
116
  });
117
-
117
+
118
118
  /*********************************************************************
119
119
  * filterOutDefaults
120
120
  * returns object for config.json that has default values removed
121
121
  */
122
122
  function filterOutDefaults(object, defaults) {
123
-
123
+
124
124
  function deleteEmptyObjects(object) {
125
125
  for (const [k, v] of Object.entries(object)) {
126
126
  if (!v || typeof v !== 'object' || v === null) {
@@ -133,7 +133,7 @@
133
133
  }
134
134
  return object;
135
135
  }
136
-
136
+
137
137
  let newObject = {};
138
138
  for (const [k, v] of Object.entries(object)) {
139
139
  if (k === 'devices') {
@@ -150,7 +150,7 @@
150
150
  }
151
151
  return deleteEmptyObjects(newObject);
152
152
  }
153
-
153
+
154
154
  /*********************************************************************
155
155
  * createForm
156
156
  * Update the plugin config GUI. Does not save to config.json
@@ -163,22 +163,22 @@
163
163
  await homebridge.updatePluginConfig([changes]);
164
164
  });
165
165
  }
166
-
166
+
167
167
  createForm(configSchema, configuration);
168
168
  homebridge.hideSpinner();
169
-
169
+
170
170
  /*********************************************************************
171
171
  * Discover button clicked....
172
172
  */
173
173
  document.getElementById('discoverBtn').addEventListener('click', async (e) => {
174
174
  e.preventDefault();
175
-
175
+
176
176
  const username = document.getElementById('username').value;
177
177
  const password = document.getElementById('password').value;
178
178
  const region = document.getElementById('region').value;
179
-
179
+
180
180
  homebridge.showSpinner();
181
-
181
+
182
182
  console.info(`Request login...`);
183
183
  try {
184
184
  const devices = await homebridge.request('/discover', { username, password, region });
@@ -209,7 +209,7 @@
209
209
  const td = tr.insertCell();
210
210
  td.appendChild(document.createTextNode(state.name));
211
211
  td.setAttribute('scope', 'row');
212
-
212
+
213
213
  tr.insertCell().appendChild(document.createTextNode(device.uuid));
214
214
  tr.insertCell().appendChild(document.createTextNode(device.mac));
215
215
 
@@ -227,7 +227,7 @@
227
227
  id: device.uuid,
228
228
  name: state.name
229
229
  };
230
-
230
+
231
231
  configuration.devices.push({
232
232
  ...defaultDeviceConfig,
233
233
  ...newDevice
@@ -235,10 +235,10 @@
235
235
  debugLog(`Adding new device:\n${JSON.stringify({ ...defaultDeviceConfig, ...newDevice }, null, 2)}`);
236
236
  // refresh view
237
237
  createForm(configSchema, configuration);
238
-
238
+
239
239
  addCell.removeChild(button);
240
240
  addCell.appendChild(document.createTextNode('Added'));
241
-
241
+
242
242
  homebridge.toast.success('Device added');
243
243
  });
244
244
  addCell.appendChild(button);
@@ -248,17 +248,17 @@
248
248
  table.innerHTML += `<tr><td>No devices found!</td></tr>`;
249
249
  }
250
250
  document.getElementById('discoverTableWrapper').style.display = 'block';
251
-
251
+
252
252
  homebridge.hideSpinner();
253
253
 
254
254
  } catch (e) {
255
255
  homebridge.toast.error(e.message);
256
256
  homebridge.hideSpinner();
257
257
  return;
258
-
258
+
259
259
  }
260
260
 
261
261
  });
262
262
  })();
263
-
264
- </script>
263
+
264
+ </script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Homebridge BlueAir Platform",
3
3
  "name": "homebridge-blueair-purifier",
4
- "version": "1.0.10",
4
+ "version": "1.0.12",
5
5
  "description": "Homebridge plugin for BlueAir purifiers",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -23,8 +23,8 @@
23
23
  }
24
24
  ],
25
25
  "engines": {
26
- "node": "^18.17.0 || ^20.9.0",
27
- "homebridge": "^1.6.0"
26
+ "node": "^18.20.4 || ^20.16.0 || ^22.6.0",
27
+ "homebridge": "^1.8.0 || ^2.0.0-beta.0"
28
28
  },
29
29
  "main": "dist/index.js",
30
30
  "scripts": {
@@ -54,7 +54,7 @@
54
54
  "eslint": "^8.57.0",
55
55
  "eslint-config-prettier": "^9.1.0",
56
56
  "eslint-plugin-prettier": "^5.1.3",
57
- "homebridge": "^1.8.1",
57
+ "homebridge": "^1.8.4",
58
58
  "nodemon": "^3.1.0",
59
59
  "prettier": "^3.2.5",
60
60
  "rimraf": "^5.0.5",
@@ -65,5 +65,8 @@
65
65
  "@homebridge/plugin-ui-utils": "^1.0.3",
66
66
  "async-mutex": "^0.5.0",
67
67
  "lodash": "^4.17.21"
68
+ },
69
+ "volta": {
70
+ "node": "20.18.0"
68
71
  }
69
72
  }