Open smshapiro85 opened 2 years ago
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: https://github.com/jeffkowalski/sunpower/issues/5
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.
Describe The Bug: When activating the plugin, receiving an error "Unexpected end of JSON"
To Reproduce:
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": "XXXXXX@gmail.com", "password": "XXXXXXXXXX", "platform": "Sunpower", "_bridge": { "username": "0E:4C:57:83:29:94", "port": 38164 } }
Screenshots: N/A
Environment: