homebridge-philips-air-purifier-complete 3.2.3 → 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 +17 -0
- package/homebridge-ui/public/index.html +8 -2
- package/homebridge-ui/server.js +49 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,23 @@ 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
|
+
|
|
9
26
|
## [3.2.3] — 15/06/2026
|
|
10
27
|
|
|
11
28
|
### Changed
|
|
@@ -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/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",
|