From 8b2f8ce1c3162ed357e20dfe2066f99dd56f4113 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 7 Nov 2026 11:48:45 +0100 Subject: [PATCH] README: two-step token copy that also works in Firefox Firefox's console copy() only records a helper result that is read when the command returns, so calling it from the token promise copied nothing. Store the token in window.pdToken, then copy(pdToken) in a second command, which every browser supports. Co-authored-by: Cursor --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fbdb7f7..8e7cbdb 100644 --- a/README.md +++ b/README.md @@ -48,19 +48,20 @@ The integration needs a one-time verification token from PerfectDraft's website. 3. Paste this command at the console prompt and press **Enter** — once, not as a "Live expression", which re-runs it over and over: ```javascript -(c => grecaptcha.enterprise.execute('6LcZQiUoAAAAAAO3JUjLiT470c-pNXbWyepuvMtV', {action: 'Magento/login'}).then(t => { c(t); console.log('Token copied to clipboard') }))(copy) +grecaptcha.enterprise.execute('6LcZQiUoAAAAAAO3JUjLiT470c-pNXbWyepuvMtV', {action: 'Magento/login'}).then(t => { window.pdToken = t; console.log('Token ready. Now run: copy(pdToken)') }) ``` -4. When **Token copied to clipboard** appears, the token is on your clipboard -5. Paste it into the Home Assistant setup dialog -6. Click **Submit** within 2 minutes (the token expires) - -If your browser reports that `copy` is not defined, use this version instead, then select and copy the long string it prints: +4. When **Token ready** appears, run this second command to copy the token to your clipboard: ```javascript -grecaptcha.enterprise.execute('6LcZQiUoAAAAAAO3JUjLiT470c-pNXbWyepuvMtV', {action: 'Magento/login'}).then(t => console.log(t)) +copy(pdToken) ``` +5. Paste the token into the Home Assistant setup dialog +6. Click **Submit** within 2 minutes (the token expires) + +If your browser reports that `copy` is not defined, run `pdToken` instead, then select and copy the long string it prints. + That's it! The integration will authenticate and start polling your PerfectDraft Pro. Token refresh is automatic — you should not need to repeat this step. If the session does eventually expire, Home Assistant will prompt you to re-authenticate. (This is a new integration, so the exact session lifespan is still being determined — it's at least 30 days and may well be indefinite.) ### Step 3: Configure polling