homebridge-lg-thinq-2 2.0.17 → 2.0.18
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 +12 -0
- package/README.md +24 -1
- package/homebridge-ui/public/index.html +46 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## v2.0.18
|
|
4
|
+
|
|
5
|
+
### Homebridge UI
|
|
6
|
+
|
|
7
|
+
* The guide link in **Other login methods** now opens in a new browser tab. It opened inside the settings window, where GitHub refuses to be shown ("This content is blocked").
|
|
8
|
+
* The link now goes to a new [Other sign-in methods](README.md#other-sign-in-methods) section of the README instead of the original project's wiki, which told users to install the original package.
|
|
9
|
+
* **Other login methods** has a field to paste a refresh token from the `thinq` command and use it, instead of editing the config JSON.
|
|
10
|
+
|
|
11
|
+
### Documentation
|
|
12
|
+
|
|
13
|
+
* Added the Other sign-in methods section to the README: getting a refresh token with `npx -y -p homebridge-lg-thinq-2 thinq ... auth` (works with Google, Apple, and Facebook accounts), and using a second LG account.
|
|
14
|
+
|
|
3
15
|
## v2.0.17
|
|
4
16
|
|
|
5
17
|
### Login
|
package/README.md
CHANGED
|
@@ -108,7 +108,30 @@ The device cache is stored in a new folder, so the first start can take a little
|
|
|
108
108
|
|
|
109
109
|
If no devices are listed in the configuration, all supported devices in the LG account are added. Add device entries only to rename devices, change device options, or add only some devices.
|
|
110
110
|
|
|
111
|
-
If you sign in to LG with Google, Apple, or
|
|
111
|
+
If you sign in to LG with Google, Apple, or Facebook, or the sign-in does not work for your account, see [Other sign-in methods](#other-sign-in-methods).
|
|
112
|
+
|
|
113
|
+
### Other sign-in methods
|
|
114
|
+
|
|
115
|
+
#### Get a refresh token with the `thinq` command
|
|
116
|
+
|
|
117
|
+
The command opens LG's own sign-in page, so it works with Google, Apple, and Facebook accounts, and with any verification LG asks for. You need Node.js 22 or later on any computer.
|
|
118
|
+
|
|
119
|
+
1. Run the command with your account's country and language, for example for Spain:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
npx -y -p homebridge-lg-thinq-2 thinq -c ES -l es-ES auth
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
2. Open the link that the command prints, and sign in to LG.
|
|
126
|
+
3. When the sign-in finishes, the browser goes to a page that may be blank or show an error. Copy the full address from the address bar and paste it in the terminal.
|
|
127
|
+
4. The command prints `Your refresh_token: ...`.
|
|
128
|
+
5. In the plugin settings, open **Other login methods**, paste the token, and click **Use Token**. Then click **Save** and restart Homebridge.
|
|
129
|
+
|
|
130
|
+
Keep the refresh token private: it gives access to your LG devices.
|
|
131
|
+
|
|
132
|
+
#### Use a second LG account
|
|
133
|
+
|
|
134
|
+
Accounts created with Google, Apple, or Facebook have no password that the plugin can use. Create a second LG account with an email and password, share your home with it from the LG ThinQ app, and sign in with that account in the plugin settings. LG treats it as a separate account, even with the same email address.
|
|
112
135
|
|
|
113
136
|
### Manual configuration
|
|
114
137
|
|
|
@@ -290,7 +290,19 @@
|
|
|
290
290
|
</div>
|
|
291
291
|
<div aria-labelledby="headingTwo" class="collapse" id="collapseTwo">
|
|
292
292
|
<div class="card-body">
|
|
293
|
-
<p>
|
|
293
|
+
<p>
|
|
294
|
+
If you sign in to LG with Google, Apple, or Facebook, or prefer not to enter your password here,
|
|
295
|
+
get a refresh token with the <code>thinq</code> command and paste it below. The
|
|
296
|
+
<a href="https://github.com/santiagosony/homebridge-lg-thinq-2#other-sign-in-methods" target="_blank" rel="noopener noreferrer"><b>Other sign-in methods</b></a>
|
|
297
|
+
guide explains how.
|
|
298
|
+
</p>
|
|
299
|
+
<div class="mb-3">
|
|
300
|
+
<label class="form-label" for="refreshTokenInput">Refresh token</label>
|
|
301
|
+
<input autocomplete="off" class="form-control" id="refreshTokenInput" spellcheck="false" type="password">
|
|
302
|
+
</div>
|
|
303
|
+
<div class="text-center mt-3">
|
|
304
|
+
<button class="btn btn-primary" id="useTokenButton" type="button">Use Token</button>
|
|
305
|
+
</div>
|
|
294
306
|
</div>
|
|
295
307
|
</div>
|
|
296
308
|
</div>
|
|
@@ -351,6 +363,18 @@
|
|
|
351
363
|
return error?.error || error?.message || fallback;
|
|
352
364
|
}
|
|
353
365
|
|
|
366
|
+
// Stores a refresh token in the config and shows the settings, as after a successful login.
|
|
367
|
+
async function applyRefreshToken(configuration, refreshToken) {
|
|
368
|
+
configuration.auth_mode = 'token';
|
|
369
|
+
configuration.refresh_token = refreshToken;
|
|
370
|
+
await homebridge.updatePluginConfig([configuration]);
|
|
371
|
+
homebridge.enableSaveButton();
|
|
372
|
+
|
|
373
|
+
await renderConfigForm(configuration, { hideDevices: true });
|
|
374
|
+
hideElement(byId('loginForm'));
|
|
375
|
+
showSaveNotice();
|
|
376
|
+
}
|
|
377
|
+
|
|
354
378
|
function setLoginButtonLoading(btn, label) {
|
|
355
379
|
btn.disabled = true;
|
|
356
380
|
btn.innerHTML = '<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>';
|
|
@@ -688,6 +712,26 @@
|
|
|
688
712
|
await homebridge.updatePluginConfig([configuration]);
|
|
689
713
|
});
|
|
690
714
|
|
|
715
|
+
byId('useTokenButton').addEventListener('click', async (e) => {
|
|
716
|
+
e.preventDefault();
|
|
717
|
+
const refreshToken = byId('refreshTokenInput').value.trim();
|
|
718
|
+
if (!refreshToken) {
|
|
719
|
+
homebridge.toast.error('Paste the refresh token from the thinq command first.', 'Error');
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
const btn = e.currentTarget;
|
|
724
|
+
btn.disabled = true;
|
|
725
|
+
try {
|
|
726
|
+
await applyRefreshToken(configuration, refreshToken);
|
|
727
|
+
byId('refreshTokenInput').value = '';
|
|
728
|
+
}
|
|
729
|
+
catch (error) {
|
|
730
|
+
homebridge.toast.error(requestErrorMessage(error, 'Unable to save the refresh token.'), 'Error');
|
|
731
|
+
btn.disabled = false;
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
|
|
691
735
|
byId('getTokenButton').addEventListener('click', async (e) => {
|
|
692
736
|
e.preventDefault();
|
|
693
737
|
const username = byId('usernameInput').value;
|
|
@@ -710,7 +754,6 @@
|
|
|
710
754
|
resetLoginButton(btn);
|
|
711
755
|
}
|
|
712
756
|
else {
|
|
713
|
-
configuration.refresh_token = data.token;
|
|
714
757
|
if (byId('rememberUsername').checked) {
|
|
715
758
|
configuration.username = username;
|
|
716
759
|
configuration.password = password;
|
|
@@ -720,12 +763,7 @@
|
|
|
720
763
|
configuration.password = '';
|
|
721
764
|
}
|
|
722
765
|
|
|
723
|
-
await
|
|
724
|
-
homebridge.enableSaveButton();
|
|
725
|
-
|
|
726
|
-
await renderConfigForm(configuration, { hideDevices: true });
|
|
727
|
-
hideElement(byId('loginForm'));
|
|
728
|
-
showSaveNotice();
|
|
766
|
+
await applyRefreshToken(configuration, data.token);
|
|
729
767
|
btn.disabled = true;
|
|
730
768
|
btn.textContent = 'Get Token';
|
|
731
769
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Homebridge LG ThinQ 2",
|
|
3
3
|
"name": "homebridge-lg-thinq-2",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.18",
|
|
5
5
|
"description": "Community-maintained continuation of homebridge-lg-thinq: a Homebridge plugin for controlling/monitoring LG ThinQ devices via the LG ThinQ platform.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"type": "module",
|