fkhera / powerwallCloud

30 stars 6 forks source link

Error starting powellwallDriver.py (from youtube) #9

Closed gdotp01 closed 3 years ago

gdotp01 commented 3 years ago

Hi. I reported this initially via youtube and you suggested sensibility that we continue the discussion here:

I've set up a new Pi Zero (for testing). Installed all the relevant packages (as far as I can't tell) and set up a recaptcha account from your link. I've added the API key from my recaptcha into recaptchasolver.py as below: (I've anominised the Key)

"API_KEY = 'b349e080ca4e1ea3e447724bfa5aaXXX' # Your 2captcha API KEY CAPTCHA_ENABLE = True"

When I try and run "powerwallDriver.py backup" I get the following errors (Keys analonomised again) which seems to fail with an "list index out of range" error. Any help would be greatly appreciated as my lack of control of the Powerwall at the moment is very frustrating as it gets its APOI guess wrong almost every day at the moment on how to charge from off-peak (UK user)

Processing: grahampowell@email.com Invoking mode: backup ('back up attempts count: ', 0) authenticating ('token auth attempts count: ', 0) authenticating authenticate method getting url https://auth.tesla.com/oauth2/v3/authorize?code_challenge=hFuP9jZsXqWNeUIooUjcSV6NLuCXD8XXXX-QKOfcBY&client_id=ownerapi&state=tesla_exporter&redirect_uri=https%3A%2F%2Fauth.tesla.com%2Fvoid%2Fcallback&response_type=code&code_challenge_method=S256&scope=openid+email+offline_access captcha sitekey: 6LdUQhgUAAAAAEe8NWX3Rur9bQRqq-2RUPhthXXX auth url: https://auth.tesla.com/oauth2/v3/authorize?code_challenge=hFuP9jZsXqWNeUIooUjcSV6NLuCXD8X6XXX-QKOfcBY&client_id=ownerapi&state=tesla_exporter&redirect_uri=https%3A%2F%2Fauth.tesla.com%2Fvoid%2Fcallback&response_type=code&code_challenge_method=S256&scope=openid+email+offline_access Getting captcha Traceback (most recent call last): File "/home/pi/authtoken.py", line 207, in authenticate captchacode = recaptchasolver.main(recaptcha_site_key, auth_url) File "/home/pi/recaptchasolver.py", line 37, in main captcha_id = resp.text.split('|')[1] IndexError: list index out of range Traceback (most recent call last): File "/home/pi/powerwallBackup.py", line 70, in main tpw.productlist() File "/home/pi/powerwallBackup.py", line 137, in productlist count = int(result["count"]) KeyError: 'count'

gdotp01 commented 3 years ago

Is it necessary to put a credit balance on 2captcha. I have not at the moment as I assumed I did not have to to test it out.

fkhera commented 3 years ago

Yes of course you need some credits for API key otherwise it cannot make the calls.

On Mon, Oct 18, 2021 at 1:37 AM gdotp01 @.***> wrote:

Is it necessary to put a credit balance on 2captcha. I have not at the moment as I assumed I did not have to to test it out.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/fkhera/powerwallCloud/issues/9*issuecomment-945534629__;Iw!!IKRxdwAv5BmarQ!KrYRwrgcV_z58vhPCCOZ6anc5tz0CMEiBQcPw1IOzS_q5m-1xOIAbEo4lon6vw$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ABU4JYBYFOGVLTY3FUV5QTTUHPMDZANCNFSM5GDPQ66Q__;!!IKRxdwAv5BmarQ!KrYRwrgcV_z58vhPCCOZ6anc5tz0CMEiBQcPw1IOzS_q5m-1xOIAbErr4yWuKA$ . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!IKRxdwAv5BmarQ!KrYRwrgcV_z58vhPCCOZ6anc5tz0CMEiBQcPw1IOzS_q5m-1xOIAbEpxyCA8ig$ or Android https://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!IKRxdwAv5BmarQ!KrYRwrgcV_z58vhPCCOZ6anc5tz0CMEiBQcPw1IOzS_q5m-1xOIAbEqmt79GHQ$.

gdotp01 commented 3 years ago

Yes but that's not the error Im getting. The2capture API returns error codes and I'm not getting one in the above.

"File "/home/pi/authtoken.py", line 207, in authenticate" is a call to 2capture but their documentation says that it will return a code of "No Credit" if that's the case

gdotp01 commented 3 years ago

Happy of course to put some credit on but i'd like to know that is the issue :-)

fkhera commented 3 years ago

Is it possible they are using the old captcha. What happens if you visit the auth link in the output, do you see a image, or do you see re-captcha?

Also can you print what you are sending out to 2Capture API?

On Mon, Oct 18, 2021 at 9:47 AM gdotp01 @.***> wrote:

Yes but that's not the error Im getting. The2capture API returns error codes and I'm not getting one in the above.

"File "/home/pi/authtoken.py", line 207, in authenticate" is a call to 2capture but their documentation says that it will return a code of "No Credit" if that's the case

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/fkhera/powerwallCloud/issues/9*issuecomment-945965689__;Iw!!IKRxdwAv5BmarQ!I1U0EwRhQGls4UbIHSeof2T8Ava3GVi3gZx90APL7zfNEyfdJkZ3MzlKbOb4ug$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ABU4JYGTSLEOWRC3ENXS2PLUHRFR5ANCNFSM5GDPQ66Q__;!!IKRxdwAv5BmarQ!I1U0EwRhQGls4UbIHSeof2T8Ava3GVi3gZx90APL7zfNEyfdJkZ3MzndB3pbeg$ . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!IKRxdwAv5BmarQ!I1U0EwRhQGls4UbIHSeof2T8Ava3GVi3gZx90APL7zfNEyfdJkZ3MzmNRUSCNQ$ or Android https://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!IKRxdwAv5BmarQ!I1U0EwRhQGls4UbIHSeof2T8Ava3GVi3gZx90APL7zfNEyfdJkZ3Mzl7KizArA$.

gdotp01 commented 3 years ago

No. If I use the Auth link I get "Page not Found" assuming that the auth link is the one following 'auth url :"

gdotp01 commented 3 years ago

How do i print what I'm sending out to 2capture

gdotp01 commented 3 years ago

Ok. So I guess the issue is the "page not found" at Teslas end. When I change the password to something that is wrong I get the same response.

I can log into tesla.com with the credentials I am supplying and see my account with 2FA turned off. However I can't see any details of the powerwall in the account, should i see these somewhere?

I can log into the Tesla mobile app of course with the same credentials and do see it there which suggests it is assigned to my account

Logging in on my Phone via the Tesla app I get the "Pictures" 2capture challenge.

gdotp01 commented 3 years ago

I tried pasting the Auth link into a chrome private window and i see the following Untitled .

fkhera commented 3 years ago

Okay when you submit captcha, the logs should say waiting, waiting, solving right? Do they solve it?

On Mon, Oct 18, 2021 at 10:57 AM gdotp01 @.***> wrote:

I tried pasting the Auth link into a chrome private window and i see the following [image: Untitled] https://urldefense.com/v3/__https://user-images.githubusercontent.com/50060482/137782722-f44c233e-a089-4098-a23d-2d5671de87f3.jpg__;!!IKRxdwAv5BmarQ!ODWOUfaCQbvWh00k3igzZFvbW1evRFvhxwh-rJR7zcWY-dsDiJXfsM-Syhs9Aw$ .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/fkhera/powerwallCloud/issues/9*issuecomment-946021311__;Iw!!IKRxdwAv5BmarQ!ODWOUfaCQbvWh00k3igzZFvbW1evRFvhxwh-rJR7zcWY-dsDiJXfsM9ONhFWZw$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ABU4JYB4ZCY53CLQKZUOZODUHRNXRANCNFSM5GDPQ66Q__;!!IKRxdwAv5BmarQ!ODWOUfaCQbvWh00k3igzZFvbW1evRFvhxwh-rJR7zcWY-dsDiJXfsM8xwDTzWA$ . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!IKRxdwAv5BmarQ!ODWOUfaCQbvWh00k3igzZFvbW1evRFvhxwh-rJR7zcWY-dsDiJXfsM93m5ESNw$ or Android https://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!IKRxdwAv5BmarQ!ODWOUfaCQbvWh00k3igzZFvbW1evRFvhxwh-rJR7zcWY-dsDiJXfsM-na9TS7A$.

gdotp01 commented 3 years ago

Sorry being a bit dense. What do you mean? I don't see anything that looks like "waiting, waiting, solving" it errors immediately after the line that says "Getting captcha" which is right at the moment in the Youtube tutorial that you blank out the screen (I presume because of the keys).

Getting captcha Traceback (most recent call last): File "/home/pi/authtoken.py", line 207, in authenticate captchacode = recaptchasolver.main(recaptcha_site_key, auth_url) File "/home/pi/recaptchasolver.py", line 37, in main captcha_id = resp.text.split('|')[1] IndexError: list index out of range Traceback (most recent call last): File "/home/pi/powerwallBackup.py", line 70, in main tpw.productlist() File "/home/pi/powerwallBackup.py", line 137, in productlist count = int(result["count"]) KeyError: 'count'

gdotp01 commented 3 years ago

Ok I think i solved it. Its the same issue as the first in your closed list https://github.com/fkhera/powerwallCloud/issues/1.

A credit needed to be applied to 2capture, the error does not show that this is the issue but now I've done this and manually set to backup it set that on the app.

Thanks for sticking with it. Now I'll try adding in CRON !

fkhera commented 3 years ago

So was main problem no credits in 2capture?

On Mon, Oct 18, 2021 at 2:53 PM gdotp01 @.***> wrote:

Ok I think i solved it. Its the same issue as the first in your closed list #1 https://urldefense.com/v3/__https://github.com/fkhera/powerwallCloud/issues/1__;!!IKRxdwAv5BmarQ!P7iEhQVCWjQf3enfLPwLBMpjrnfN3D-yPiryZOrGUmSUB2uMaZ04EzApMLjp2g$ .

A credit needed to be applied to 2capture, the error does not show that this is the issue but now I've done this and manually set to backup it set that on the app.

Thanks for sticking with it. Now I'll try adding in CRON !

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/fkhera/powerwallCloud/issues/9*issuecomment-946196453__;Iw!!IKRxdwAv5BmarQ!P7iEhQVCWjQf3enfLPwLBMpjrnfN3D-yPiryZOrGUmSUB2uMaZ04EzDF7QK6gA$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ABU4JYHM22XH6FY57TCSVXTUHSJMRANCNFSM5GDPQ66Q__;!!IKRxdwAv5BmarQ!P7iEhQVCWjQf3enfLPwLBMpjrnfN3D-yPiryZOrGUmSUB2uMaZ04EzD_X_vQjA$ . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!IKRxdwAv5BmarQ!P7iEhQVCWjQf3enfLPwLBMpjrnfN3D-yPiryZOrGUmSUB2uMaZ04EzAmo1ycMw$ or Android https://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!IKRxdwAv5BmarQ!P7iEhQVCWjQf3enfLPwLBMpjrnfN3D-yPiryZOrGUmSUB2uMaZ04EzDVtWjm6A$.

gdotp01 commented 3 years ago

Yes. Would be good if the script returned the error code from 2capture and printed it so it would then be obvious. Thx