homebridge-philips-air-purifier-complete 3.2.2 → 3.2.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/CHANGELOG.md +29 -0
- package/README.md +8 -0
- package/homebridge-ui/public/index.html +8 -2
- package/homebridge-ui/server.js +49 -6
- package/index.js +17 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,35 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [3.2.4] — 15/06/2026
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Air+ Cloud login: detect and handle the Philips consent proxy page URL
|
|
14
|
+
(`accounts.home.id/authui/client/proxy?mode=afterConsent&…`) that some browsers navigate to
|
|
15
|
+
instead of the `com.philips.air://loginredirect?code=…` deep-link redirect. The server now
|
|
16
|
+
fetches the proxy page server-side and attempts to extract the authorisation code automatically.
|
|
17
|
+
If the code cannot be extracted, a clear error explains exactly where to find the correct URL.
|
|
18
|
+
- Air+ Cloud login: rewrote the step-by-step instructions to explain that the browser will try to
|
|
19
|
+
open the Philips Air app, that the address bar will show the `com.philips.air://` URL at that
|
|
20
|
+
moment, and that both the deep-link URL and the Philips proxy page URL can be pasted.
|
|
21
|
+
- Air+ Cloud login: improved the generic "No authorisation code found" error to include specific
|
|
22
|
+
guidance on what URL to look for and where.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## [3.2.3] — 15/06/2026
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Legacy top-level `accessories[]` entries are no longer served by default. The compatibility shim
|
|
31
|
+
now logs a migration error and returns no HomeKit services, which stops old accessory config from
|
|
32
|
+
keeping duplicate or orphaned purifiers alive after migrating to the v3 platform.
|
|
33
|
+
- Added `PHILIPS_AIR_ALLOW_LEGACY_ACCESSORY=1` as a temporary rollback switch for users who need
|
|
34
|
+
one more start on the old accessory path while moving config into `platforms[].devices[]`.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
9
38
|
## [3.2.2] — 15/06/2026
|
|
10
39
|
|
|
11
40
|
### Fixed
|
package/README.md
CHANGED
|
@@ -149,6 +149,14 @@ v3.0.0 changes the plugin type from `accessory` to `platform`. Update your Homeb
|
|
|
149
149
|
|
|
150
150
|
3. Restart Homebridge.
|
|
151
151
|
|
|
152
|
+
From v3.2.3, old top-level `"accessory": "PhilipsAirPurifier"` entries are not loaded by
|
|
153
|
+
default. If Homebridge logs `Loading 1 accessories...` followed by
|
|
154
|
+
`Legacy accessories[] config detected`, the old entry is still present in the full Homebridge
|
|
155
|
+
`config.json` even if this plugin's platform settings modal only shows `{ "platform":
|
|
156
|
+
"PhilipsAirPurifier" }`. Remove the old object from the top-level `"accessories"` array and keep
|
|
157
|
+
the device under `"platforms"[]."devices"` instead. For temporary rollback only, set
|
|
158
|
+
`PHILIPS_AIR_ALLOW_LEGACY_ACCESSORY=1` before starting Homebridge.
|
|
159
|
+
|
|
152
160
|
### Migration examples
|
|
153
161
|
|
|
154
162
|
#### CoAP device
|
|
@@ -262,9 +262,15 @@
|
|
|
262
262
|
|
|
263
263
|
<div id="airplus-flow" hidden>
|
|
264
264
|
<div id="airplus-step-1" class="airplus-step">
|
|
265
|
-
<
|
|
265
|
+
<ol style="color: var(--muted); font-size: 13px; padding-left: 20px; margin: 0 0 14px; line-height: 1.7;">
|
|
266
|
+
<li><a id="auth-link" href="#" target="_blank" rel="noopener">Open the Philips login page</a> (a new tab will open automatically — click the link if it didn't).</li>
|
|
267
|
+
<li>Log in to your Philips account and approve access when prompted.</li>
|
|
268
|
+
<li>Your browser will try to open the Philips Air app. If it can't, it will show an error or a Philips page — this is expected.</li>
|
|
269
|
+
<li>Check your browser's <strong style="color: var(--text);">address bar</strong> at that moment. It should show a URL starting with <code style="background:#1a1a1a; padding: 1px 4px; border-radius: 3px; font-size: 12px;">com.philips.air://loginredirect?code=…</code> — copy and paste that here.</li>
|
|
270
|
+
<li>If your address bar shows a Philips website (like <em>accounts.home.id</em>), paste that URL here instead — we'll try to extract the code automatically.</li>
|
|
271
|
+
</ol>
|
|
266
272
|
<div class="field">
|
|
267
|
-
<label for="redirect-url">Redirect URL</label>
|
|
273
|
+
<label for="redirect-url">Redirect URL (from your browser's address bar)</label>
|
|
268
274
|
<textarea id="redirect-url" placeholder="com.philips.air://loginredirect?code=..."></textarea>
|
|
269
275
|
</div>
|
|
270
276
|
<div class="toolbar">
|
package/homebridge-ui/server.js
CHANGED
|
@@ -59,12 +59,43 @@ class AirPlusSetupServer extends HomebridgePluginUiServer {
|
|
|
59
59
|
throw new Error('Redirect URL is required');
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
let code = null;
|
|
63
|
+
|
|
64
|
+
if (redirectUrl.includes('accounts.home.id/authui/client/proxy')) {
|
|
65
|
+
// User pasted the Philips consent proxy page URL instead of the final deep-link redirect.
|
|
66
|
+
// Fetch the proxy page and try to extract com.philips.air://loginredirect?code=... from the HTML.
|
|
67
|
+
try {
|
|
68
|
+
const proxyUrl = new URL(redirectUrl);
|
|
69
|
+
const html = await this._httpsGetRaw({
|
|
70
|
+
hostname: proxyUrl.hostname,
|
|
71
|
+
path: proxyUrl.pathname + proxyUrl.search,
|
|
72
|
+
headers: { 'User-Agent': USER_AGENT, Accept: 'text/html' },
|
|
73
|
+
});
|
|
74
|
+
const m = html.match(/com\.philips\.air:\/\/loginredirect[^\s"'\\]*code=([^&\s"'\\]+)/);
|
|
75
|
+
if (m) code = decodeURIComponent(m[1]);
|
|
76
|
+
} catch (_) { /* fall through to descriptive error */ }
|
|
77
|
+
|
|
78
|
+
if (!code) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
'This is the Philips login confirmation page, not the final redirect URL. ' +
|
|
81
|
+
'After approving access your browser will try to open the Philips Air app — ' +
|
|
82
|
+
'look at your address bar at that moment; it will show a URL starting with ' +
|
|
83
|
+
'"com.philips.air://loginredirect?code=…". Copy that URL and paste it here.'
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
// Normal path: user pasted the com.philips.air:// deep-link URL (or similar)
|
|
88
|
+
const parseable = redirectUrl.replace(/^com\.philips\.air:\/\//, 'https://x/');
|
|
89
|
+
let parsed;
|
|
90
|
+
try { parsed = new URL(parseable); } catch (_) { parsed = null; }
|
|
91
|
+
code = parsed && parsed.searchParams.get('code');
|
|
92
|
+
if (!code) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
'No authorisation code found in redirect URL. ' +
|
|
95
|
+
'Paste the full URL from your browser’s address bar after approving access — ' +
|
|
96
|
+
'it should start with “com.philips.air://loginredirect?code=…”.'
|
|
97
|
+
);
|
|
98
|
+
}
|
|
68
99
|
}
|
|
69
100
|
|
|
70
101
|
const tokenBody = new URLSearchParams({
|
|
@@ -178,6 +209,18 @@ class AirPlusSetupServer extends HomebridgePluginUiServer {
|
|
|
178
209
|
req.end();
|
|
179
210
|
});
|
|
180
211
|
}
|
|
212
|
+
|
|
213
|
+
_httpsGetRaw(options) {
|
|
214
|
+
return new Promise((resolve, reject) => {
|
|
215
|
+
const req = https.request(options, (res) => {
|
|
216
|
+
const chunks = [];
|
|
217
|
+
res.on('data', (chunk) => chunks.push(chunk));
|
|
218
|
+
res.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
|
219
|
+
});
|
|
220
|
+
req.on('error', reject);
|
|
221
|
+
req.end();
|
|
222
|
+
});
|
|
223
|
+
}
|
|
181
224
|
}
|
|
182
225
|
|
|
183
226
|
new AirPlusSetupServer();
|
package/index.js
CHANGED
|
@@ -875,14 +875,27 @@ class PhilipsAirPurifierAccessory {
|
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
877
|
|
|
878
|
-
class PhilipsAirPurifierLegacyAccessory
|
|
878
|
+
class PhilipsAirPurifierLegacyAccessory {
|
|
879
879
|
constructor(log, config, api) {
|
|
880
|
-
|
|
881
|
-
|
|
880
|
+
this.accessory = null;
|
|
881
|
+
|
|
882
|
+
if (process.env.PHILIPS_AIR_ALLOW_LEGACY_ACCESSORY !== '1') {
|
|
883
|
+
log.error('[PhilipsAir] Legacy accessories[] config detected and will not be loaded. Move this entry into platforms[].devices[] and remove the top-level accessories[] entry. Set PHILIPS_AIR_ALLOW_LEGACY_ACCESSORY=1 only as a temporary rollback.');
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
log.warn('[PhilipsAir] Legacy accessories[] config enabled by PHILIPS_AIR_ALLOW_LEGACY_ACCESSORY=1. This compatibility path is deprecated; migrate to platforms[].devices[].');
|
|
888
|
+
this.accessory = new PhilipsAirPurifierAccessory(log, config, api, new LegacyPlatformAccessory(api));
|
|
882
889
|
}
|
|
883
890
|
|
|
884
891
|
getServices() {
|
|
885
|
-
return this.platformAcc.getServices();
|
|
892
|
+
return this.accessory ? this.accessory.platformAcc.getServices() : [];
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
identify() {
|
|
896
|
+
if (this.accessory) {
|
|
897
|
+
this.accessory.identify();
|
|
898
|
+
}
|
|
886
899
|
}
|
|
887
900
|
}
|
|
888
901
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-philips-air-purifier-complete",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"customUi": true,
|
|
5
5
|
"description": "Homebridge plugin for Philips Air Purifier with bundled CoAP control library and Python 3.12+/Node.js 24 support",
|
|
6
6
|
"main": "index.js",
|