Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected end of JSON #8

Open
smshapiro85 opened this issue Jun 28, 2022 · 2 comments
Open

Unexpected end of JSON #8

smshapiro85 opened this issue Jun 28, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@smshapiro85
Copy link

Describe The Bug:
When activating the plugin, receiving an error "Unexpected end of JSON"

To Reproduce:

  1. Install plugin with sunpower username and password
  2. Save/activate plugin
  3. Restart homebridge
  4. View log error

Expected behavior:
Plugin activates without error

Logs:

[6/28/2022, 11:26:36 AM] Homebridge v1.5.0 (HAP v0.10.2) (Sunpower) is running on port 38164.
FetchError: invalid json response body at https://elhapi.edp.sunpower.com/v1/elh/authenticate reason: Unexpected end of JSON input
at /homebridge/node_modules/homebridge-sunpower/node_modules/node-fetch/lib/index.js:273:32
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Timeout._onTimeout (/homebridge/node_modules/homebridge-sunpower/src/platform.ts:98:26)
[6/28/2022, 11:27:07 AM] [Sunpower] Child bridge process ended
[6/28/2022, 11:27:07 AM] [Sunpower] Process Ended. Code: 1, Signal: null
[6/28/2022, 11:27:14 AM] [Sunpower] Restarting Process...
[6/28/2022, 11:27:15 AM] [Sunpower] Launched child bridge with PID 3964
[6/28/2022, 11:27:15 AM] Registering platform 'homebridge-sunpower.Sunpower'
[6/28/2022, 11:27:15 AM] [Sunpower] Loaded homebridge-sunpower v0.1.3 child bridge successfully
[6/28/2022, 11:27:15 AM] Loaded 4 cached accessories from cachedAccessories.0E4C57832994.
[6/28/2022, 11:27:15 AM] [Sunpower] Loading accessory from cache: Current Export
[6/28/2022, 11:27:15 AM] [Sunpower] Loading accessory from cache: Current Import
[6/28/2022, 11:27:15 AM] [Sunpower] Loading accessory from cache: Daily Export
[6/28/2022, 11:27:15 AM] [Sunpower] Loading accessory from cache: Daily Import
[6/28/2022, 11:27:15 AM] [Sunpower] Restoring existing accessory from cache: Current Export
[6/28/2022, 11:27:15 AM] [Sunpower] Restoring existing accessory from cache: Current Import
[6/28/2022, 11:27:15 AM] [Sunpower] Restoring existing accessory from cache: Daily Export
[6/28/2022, 11:27:15 AM] [Sunpower] Restoring existing accessory from cache: Daily Import
[6/28/2022, 11:27:15 AM] Homebridge v1.5.0 (HAP v0.10.2) (Sunpower) is running on port 38164.

Plugin Config:

{
"name": "Sunpower",
"username": "[email protected]",
"password": "XXXXXXXXXX",
"platform": "Sunpower",
"_bridge": {
"username": "0E:4C:57:83:29:94",
"port": 38164
}
}

Screenshots:
N/A

Environment:

  • Plugin Version: homebridge-sunpower v0.1.3
  • Homebridge Version: v1.5.0
  • Node.js Version: v16.15.1
  • NPM Version: Unknown
  • Operating System: Docker/Synology DSM 7
@smshapiro85 smshapiro85 added the bug Something isn't working label Jun 28, 2022
@rgallo
Copy link
Owner

rgallo commented Jun 28, 2022

Sunpower changed their API details and endpoints last year, and after not finding documentation at the time I haven't revisited if it's been documented anywhere since. Definitely open to getting this working again if I'm able to find up to date API docs.

Some further details here: jeffkowalski/sunpower#5

@rgallo
Copy link
Owner

rgallo commented Sep 16, 2022

If anyone comes across this, I took another look at this and I'm able to get a session token posting to https://login.mysunpower.com/api/v1/authn with {"password":"passwordhere","username":"username here","options":{"warnBeforePasswordExpired":True,"multiOptionalFactorEnroll":True}}, I followed a couple session cookie redirect page urls, but I can't figure out how the value of document.cookie gets set to the browser, which is what gets passed into the graphql endpoint to get the data series. If this is resolved I should be able to make the changes needed to update this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants