Closed gbassaragh closed 3 years ago
It looks like it's retrieving cloud data (I see the PowerLine and the SelfPowered info), but not anything from the local Powerwall. The local API requires authentication as of several firmware updates ago; previously, it allowed unauthenticated access from the local network for most things. Have you provided the password for your local Powerwall as well? Can you log into the Powerwall's web portal with that password?
(I would expect it to be directing you to the authentication page in that case, however.)
Yes, I tried a couple different iterations. I initially supplied the local password in the config file. Then I commented it out and supplied it on the auth page. I was able to successfully log into the local Powerwall with that password; I will confirm again today when I return home in a few hours.
I did note that local password is saved in the local token file, and I no longer get the prompt after visiting the auth page; however still exhibiting same behavior.
Hm. Well, if the correct password is in localpw.json
, next step would be adding debug: true
to the config file and watching the output from the MagicMirror server-side process.
was able to capture some items in the MagicMirror-out log:
[30.09.2021 18:25.54.203] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [30.09.2021 18:25.54.205] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [30.09.2021 18:25.54.207] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [30.09.2021 18:25.54.209] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid [30.09.2021 18:25.54.210] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operation [30.09.2021 18:25.54.276] [LOG] MMM-Powerwall: 10.1.3.231 error: aggregates failed: Error: Request failed with status code 403 [30.09.2021 18:25.54.349] [LOG] MMM-Powerwall: 10.1.3.231 error: soe failed: Error: Request failed with status code 403 [30.09.2021 18:25.54.350] [LOG] MMM-Powerwall: 10.1.3.231 error: grid failed: Error: Request failed with status code 403 [30.09.2021 18:25.54.356] [LOG] MMM-Powerwall: 10.1.3.231 error: operation failed: Error: Request failed with status code 403
403 means that you're signed in, but the Powerwall doesn't consider you authorized to access the information (as opposed to 401, which says you need to sign in first). Clearly you are signed in -- it almost makes me wonder whether we're missing part of the Cookie that's being set.
Does it continue to give 403s on subsequent attempts, then?
Actually, I was noticing how close these are to each other; can you try the request_waits
branch? I wonder if it's making the requests while the authentication is still in progress, so it's requesting without credentials.
i am working on how to switch to a different branch and i will let you know how it goes.
switched to the request_waits branch (i think) git status shows that....
still same behavior, and to your question about the subsequent attempts, yes log is filled with the same entries.
anything else i can check to help troubleshoot?
thanks for your all help and this great module you've but together!
[05.10.2021 18:14.09.069] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/products returned {"response":[{"energy_site_id":197169198447,"resource_type":$ [05.10.2021 18:14.09.072] [LOG] MMM-Powerwall: Inferred site ID 197169198447 [05.10.2021 18:14.09.074] [LOG] MMM-Powerwall: Found siteID 197169198447 [05.10.2021 18:14.09.116] [LOG] MMM-Powerwall: UpdateEnergy{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [05.10.2021 18:14.09.120] [LOG] MMM-Powerwall: UpdateSelfConsumption{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [05.10.2021 18:14.09.145] [LOG] MMM-Powerwall: UpdatePowerHistory{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [05.10.2021 18:14.09.148] [LOG] MMM-Powerwall: UpdateStormWatch{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [05.10.2021 18:14.09.151] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [05.10.2021 18:14.09.153] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregateshttps://10.1.3.231/api/meters/aggregates [05.10.2021 18:14.09.156] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soehttps://10.1.3.231/api/system_status/soe [05.10.2021 18:14.09.158] [LOG] MMM-Powerwall: 10.1.3.231: Requesting gridhttps://10.1.3.231/api/system_status/grid_status [05.10.2021 18:14.09.171] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operationhttps://10.1.3.231/api/operation [05.10.2021 18:14.09.538] [LOG] MMM-Powerwall: 10.1.3.231 error: aggregates failed: Error: Request failed with status code 403 [05.10.2021 18:14.09.543] [LOG] MMM-Powerwall: 10.1.3.231 error: soe failed: Error: Request failed with status code 403 [05.10.2021 18:14.09.551] [LOG] MMM-Powerwall: 10.1.3.231 error: grid failed: Error: Request failed with status code 403 [05.10.2021 18:14.09.560] [LOG] MMM-Powerwall: 10.1.3.231 error: operation failed: Error: Request failed with status code 403 [05.10.2021 18:14.09.562] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [05.10.2021 18:14.09.563] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregateshttps://10.1.3.231/api/meters/aggregates [05.10.2021 18:14.09.565] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soehttps://10.1.3.231/api/system_status/soe [05.10.2021 18:14.09.568] [LOG] MMM-Powerwall: 10.1.3.231: Requesting gridhttps://10.1.3.231/api/system_status/grid_status [05.10.2021 18:14.09.571] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operationhttps://10.1.3.231/api/operation [05.10.2021 18:14.09.655] [LOG] MMM-Powerwall: 10.1.3.231 error: aggregates failed: Error: Request failed with status code 403 [05.10.2021 18:14.09.659] [LOG] MMM-Powerwall: 10.1.3.231 error: soe failed: Error: Request failed with status code 403 [05.10.2021 18:14.09.663] [LOG] MMM-Powerwall: 10.1.3.231 error: grid failed: Error: Request failed with status code 403 [05.10.2021 18:14.09.665] [LOG] MMM-Powerwall: 10.1.3.231 error: operation failed: Error: Request failed with status code 403
Can you try the 403_needs_auth
branch? I don't know that it will fix it, but hopefully it will fail more informatively.
using that branch have more info in the logs, seems that even though the login is successful, the tokens are rejected? see below: [06.10.2021 13:11.12.419] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 13:11.12.422] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 13:11.12.427] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [06.10.2021 13:11.12.431] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid [06.10.2021 13:11.12.437] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operation [06.10.2021 13:11.12.518] [LOG] MMM-Powerwall: 10.1.3.231: Tokens rejected; need to log in again [06.10.2021 13:11.12.519] [LOG] MMM-Powerwall: 10.1.3.231: Beginning login attempt [06.10.2021 13:11.12.573] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?kind=self_consumption&period=day returned {"$ [06.10.2021 13:11.12.678] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?period=day&kind=energy returned {"response":$ [06.10.2021 13:11.12.693] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?period=day&kind=power returned {"response":{$ [06.10.2021 13:11.12.748] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/live_status returned {"response":{"solar_power":6966$ [06.10.2021 13:11.13.182] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 13:11.13.185] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 13:11.13.186] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [06.10.2021 13:11.13.188] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid [06.10.2021 13:11.13.189] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operation [06.10.2021 13:11.13.323] [LOG] MMM-Powerwall: 10.1.3.231: Tokens rejected; need to log in again [06.10.2021 13:11.13.324] [LOG] MMM-Powerwall: 10.1.3.231: Beginning login attempt [06.10.2021 13:11.13.397] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?kind=backup returned {"response":{"events":[$ [06.10.2021 13:11.13.618] [LOG] MMM-Formula1 is returning DRIVER standings for the current season [06.10.2021 13:11.13.951] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 13:11.13.968] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 13:11.13.969] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [06.10.2021 13:11.13.971] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid [06.10.2021 13:11.13.973] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operation [06.10.2021 13:11.14.089] [LOG] MMM-Powerwall: 10.1.3.231: Tokens rejected; need to log in again [06.10.2021 13:11.14.092] [LOG] MMM-Powerwall: 10.1.3.231: Beginning login attempt [06.10.2021 13:11.14.746] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 13:11.14.756] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 13:11.14.759] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [06.10.2021 13:11.14.760] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid
Okay, so I clearly need to add a delay to keep from reauthenticating too frequently in this instance regardless. But I can't figure out why your Powerwall would allow you to log in but then not allow you to fetch data from the APIs.
Delay is added to that branch; it won't attempt to log in more often than every 30 seconds. It almost seems like the cookie from the login response isn't being populated on the request; I've added a commit to that branch which logs the cookies received and sent, just so we can see if it makes sense.
Looks like the cookies are empty? See below for captured log:
[06.10.2021 14:01.55.988] [LOG] Launching application. [06.10.2021 14:01.56.985] [LOG] MMM-Powerwall: Read Tesla API tokens from file [06.10.2021 14:01.56.989] [LOG] MMM-Powerwall: {"gharib85@gmail.com":{"access_token":XXXXXXXXX - manually removed to post","token_ty$ [06.10.2021 14:01.57.291] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 14:01.57.293] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 14:01.57.294] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 14:01.57.295] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 14:01.57.296] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 14:01.57.668] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 14:01.58.197] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/vehicles returned {"response":[],"count":0} [06.10.2021 14:01.58.213] [LOG] MMM-Powerwall: 10.1.3.231: Beginning login attempt [06.10.2021 14:01.58.355] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/login/Basic: [06.10.2021 14:02.00.063] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 14:02.00.152] [LOG] MMM-DailyBibleVerse node helper received a socket notification: START - Payload: CEV [06.10.2021 14:02.00.466] [INFO] [MMM-DynamicWeather] Getting Holiday data [06.10.2021 14:02.00.479] [INFO] [MMM-DynamicWeather] Getting Weather API data [06.10.2021 14:02.00.485] [LOG] Create new calendarfetcher for url: http://localhost:8080/MMM-Formula1/schedule.ics - Interval: 300000 [06.10.2021 14:02.00.529] [LOG] MMM-Formula1 received a notification: CONFIG [06.10.2021 14:02.00.591] [LOG] MMM-Formula1 is fetching the race schedule for the current season [06.10.2021 14:02.00.626] [LOG] MMM-Formula1 is fetching DRIVER standings for the current season [06.10.2021 14:02.00.643] [INFO] Checking git for module: MMM-Formula1 [06.10.2021 14:02.00.662] [LOG] MMM-Powerwall: Configure-TeslaAPI{"siteID":null,"teslaAPIUsername":"gharib85@gmail.com"} [06.10.2021 14:02.00.663] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 14:02.00.665] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 14:02.00.667] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [06.10.2021 14:02.00.669] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid [06.10.2021 14:02.00.670] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operation [06.10.2021 14:02.00.683] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/meters/aggregates: [06.10.2021 14:02.00.689] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/soe: [06.10.2021 14:02.00.693] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/grid_status: [06.10.2021 14:02.00.697] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/operation: [06.10.2021 14:02.00.800] [INFO] Checking git for module: MMM-Remote-Control [06.10.2021 14:02.00.916] [LOG] MMM-Powerwall: Read Tesla API tokens from file [06.10.2021 14:02.00.917] [LOG] MMM-Powerwall: {"gharib85@gmail.com":{"access_token":"qts-849e2621ea50fdb78a3d5b25db3c72b1248bff97e4b759da241e71e57f218ca4","token_ty$ [06.10.2021 14:02.00.926] [LOG] Serving the race schedule iCal [06.10.2021 14:02.00.945] [INFO] Checking git for module: calendar_monthly [06.10.2021 14:02.01.013] [INFO] Calendar-Fetcher: Broadcasting 0 events. [06.10.2021 14:02.01.028] [INFO] Checking git for module: MMM-SystemStats [06.10.2021 14:02.01.104] [LOG] MMM-Powerwall: 10.1.3.231: Tokens rejected; need to log in again [06.10.2021 14:02.01.105] [LOG] MMM-Powerwall: 10.1.3.231: Login already in progress; deferring to that attempt [06.10.2021 14:02.01.347] [INFO] Checking git for module: MMM-Powerwall
[06.10.2021 14:05.04.380] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/grid_status: [06.10.2021 14:05.04.385] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/operation: [06.10.2021 14:05.04.433] [LOG] MMM-Powerwall: 10.1.3.231: Tokens rejected; need to log in again [06.10.2021 14:05.34.355] [LOG] MMM-Powerwall: 10.1.3.231: Beginning login attempt [06.10.2021 14:05.34.377] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/login/Basic: [06.10.2021 14:05.35.087] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 14:05.35.097] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 14:05.35.109] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [06.10.2021 14:05.35.115] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid [06.10.2021 14:05.35.122] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operation [06.10.2021 14:05.35.127] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/meters/aggregates: [06.10.2021 14:05.35.138] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/soe: [06.10.2021 14:05.35.152] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/grid_status: [06.10.2021 14:05.35.164] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/operation: [06.10.2021 14:05.35.608] [LOG] MMM-Powerwall: 10.1.3.231: Tokens rejected; need to log in again [06.10.2021 14:06.05.103] [LOG] MMM-Powerwall: 10.1.3.231: Beginning login attempt [06.10.2021 14:06.05.121] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/login/Basic: [06.10.2021 14:06.05.740] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 14:06.05.750] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 14:06.05.753] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [06.10.2021 14:06.05.755] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid [06.10.2021 14:06.05.757] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operation [06.10.2021 14:06.05.762] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/meters/aggregates: [06.10.2021 14:06.05.770] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/soe: [06.10.2021 14:06.05.775] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/grid_status: [06.10.2021 14:06.05.780] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/operation: [06.10.2021 14:06.05.827] [LOG] MMM-Powerwall: 10.1.3.231: Tokens rejected; need to log in again
Okay, so the Cookies being sent are empty, which explains the 403. There's no indication that a Cookie is being received in the login response at all, which is strange. I've added another commit to log the headers in the login response. Is there a Set-Cookie
header there?
(Wait, I need to fix that....)
Okay, now it's actually dumping headers. Let's see if the header is actually coming back, then.
See below: [06.10.2021 15:09.00.375] [LOG] MMM-Powerwall: Configure-TeslaAPI{"siteID":null,"teslaAPIUsername":"gharib85@gmail.com"} [06.10.2021 15:09.00.377] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 15:09.00.379] [LOG] MMM-Powerwall: 10.1.3.231 error: not authenticated [06.10.2021 15:09.00.482] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 15:09.00.483] [LOG] MMM-Powerwall: 10.1.3.231 error: not authenticated [06.10.2021 15:09.00.485] [LOG] MMM-Powerwall: UpdateSelfConsumption{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [06.10.2021 15:09.00.486] [LOG] MMM-Powerwall: UpdatePowerHistory{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [06.10.2021 15:09.00.487] [LOG] MMM-Powerwall: UpdateStormWatch{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [06.10.2021 15:09.00.537] [INFO] Checking git for module: MMM-Remote-Control [06.10.2021 15:09.00.612] [LOG] MMM-Powerwall: 10.1.3.231: Login headers: {"cache-control":"no-cache, no-store","set-cookie":["AuthCookie=Pv45mdZ-zYS4RRFgIuDY5TqFu0B$ [06.10.2021 15:09.00.615] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 15:09.00.767] [LOG] MMM-Powerwall: Read Tesla API tokens from file [06.10.2021 15:09.00.769] [LOG] MMM-Powerwall: {"gharib85@gmail.com":{"access_token":"xxxxxxxx","token_ty$ [06.10.2021 15:09.01.100] [LOG] MMM-Powerwall: Attempting to infer siteID [06.10.2021 15:09.01.103] [LOG] MMM-Powerwall: Fetching products list [06.10.2021 15:09.01.393] [INFO] Checking git for module: MMM-Powerwall [06.10.2021 15:09.01.498] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?kind=self_consumption&period=day returned {"$ [06.10.2021 15:09.01.594] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/live_status returned {"response":{"solar_power":1478$ [06.10.2021 15:09.01.684] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?period=day&kind=power returned {"response":{$ [06.10.2021 15:09.01.733] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 15:09.01.735] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates
[06.10.2021 15:09.30.637] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/login/Basic: [06.10.2021 15:09.31.277] [LOG] MMM-Powerwall: 10.1.3.231: Login headers: {"cache-control":"no-cache, no-store","set-cookie":["AuthCookie=0EqY1IhI4zdh7G_R-9S_DH2-0Jh$ [06.10.2021 15:09.31.280] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 15:09.31.285] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 15:09.31.290] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe
See below, empty cookie still being returned, think the header is there.
[06.10.2021 15:09.00.375] [LOG] MMM-Powerwall: Configure-TeslaAPI{"siteID":null,"teslaAPIUsername":"gharib85@gmail.com"} [06.10.2021 15:09.00.377] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 15:09.00.379] [LOG] MMM-Powerwall: 10.1.3.231 error: not authenticated [06.10.2021 15:09.00.482] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 15:09.00.483] [LOG] MMM-Powerwall: 10.1.3.231 error: not authenticated [06.10.2021 15:09.00.485] [LOG] MMM-Powerwall: UpdateSelfConsumption{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [06.10.2021 15:09.00.486] [LOG] MMM-Powerwall: UpdatePowerHistory{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [06.10.2021 15:09.00.487] [LOG] MMM-Powerwall: UpdateStormWatch{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [06.10.2021 15:09.00.537] [INFO] Checking git for module: MMM-Remote-Control [06.10.2021 15:09.00.612] [LOG] MMM-Powerwall: 10.1.3.231: Login headers: {"cache-control":"no-cache, no-store","set-cookie":["AuthCookie=Pv45mdZ-zYS4RRFgIuDY5TqFu0B$ [06.10.2021 15:09.00.615] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 15:09.00.767] [LOG] MMM-Powerwall: Read Tesla API tokens from file [06.10.2021 15:09.00.769] [LOG] MMM-Powerwall: {"gharib85@gmail.com":{"access_token":"xxxxxxxx","token_ty$ [06.10.2021 15:09.01.100] [LOG] MMM-Powerwall: Attempting to infer siteID [06.10.2021 15:09.01.103] [LOG] MMM-Powerwall: Fetching products list [06.10.2021 15:09.01.393] [INFO] Checking git for module: MMM-Powerwall [06.10.2021 15:09.01.498] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?kind=self_consumption&period=day returned {"$ [06.10.2021 15:09.01.594] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/live_status returned {"response":{"solar_power":1478$ [06.10.2021 15:09.01.684] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?period=day&kind=power returned {"response":{$ [06.10.2021 15:09.01.733] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 15:09.01.735] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates
[06.10.2021 15:09.30.637] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/login/Basic: [06.10.2021 15:09.31.277] [LOG] MMM-Powerwall: 10.1.3.231: Login headers: {"cache-control":"no-cache, no-store","set-cookie":["AuthCookie=0EqY1IhI4zdh7G_R-9S_DH2-0Jh$ [06.10.2021 15:09.31.280] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 15:09.31.285] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 15:09.31.290] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe
Grabbed from the actual log files vs copying from the terminal :
[06.10.2021 15:09.00.375] [LOG] MMM-Powerwall: Configure-TeslaAPI{"siteID":null,"teslaAPIUsername":"gharib85@gmail.com"} [06.10.2021 15:09.00.377] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 15:09.00.379] [LOG] MMM-Powerwall: 10.1.3.231 error: not authenticated [06.10.2021 15:09.00.482] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 15:09.00.483] [LOG] MMM-Powerwall: 10.1.3.231 error: not authenticated [06.10.2021 15:09.00.485] [LOG] MMM-Powerwall: UpdateSelfConsumption{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [06.10.2021 15:09.00.486] [LOG] MMM-Powerwall: UpdatePowerHistory{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [06.10.2021 15:09.00.487] [LOG] MMM-Powerwall: UpdateStormWatch{"username":"gharib85@gmail.com","siteID":197169198447,"updateInterval":299500} [06.10.2021 15:09.00.537] [INFO] Checking git for module: MMM-Remote-Control [06.10.2021 15:09.00.612] [LOG] MMM-Powerwall: 10.1.3.231: Login headers: {"cache-control":"no-cache, no-store","set-cookie":["AuthCookie=Pv45mdZ-zYS4RRFgIuDY5TqFu0BYNvUj4FTdYvV83aF3muA3U9UCH9Jf_pxnhZr49EnU32InekoWJvUEjCtikg==; Path=/","UserRecord=eyJlbWFpbCI6IiIsImZpcnN0bmFtZSI6IlRlc2xhIiwibGFzdG5hbWUiOiJFbmVyZ3kiLCJyb2xlcyI6WyJIb21lX093bmVyIl0sInRva2VuIjoiUHY0NW1kWi16WVM0UlJGZ0l1RFk1VHFGdTBCWU52VWo0RlRkWXZWODNhRjNtdUEzVTlVQ0g5SmZfcHhuaFpyNDlFblUzMkluZWtvV0p2VUVqQ3Rpa2c9PSIsInByb3ZpZGVyIjoiQmFzaWMiLCJsb2dpblRpbWUiOiIyMDIxLTEwLTA2VDE1OjA5OjAwLjAwNzE2NTQ1NS0wNDowMCJ9; Path=/"],"date":"Wed, 06 Oct 2021 19:09:00 GMT","content-length":"243","content-type":"text/plain; charset=utf-8"} [06.10.2021 15:09.00.615] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 15:09.00.767] [LOG] MMM-Powerwall: Read Tesla API tokens from file [06.10.2021 15:09.00.769] [LOG] MMM-Powerwall: {"gharib85@gmail.com":{"access_token":"qts-xxxxx4","token_type":"bearer","expires_in":3888000,"created_at":1632538416.036}} [06.10.2021 15:09.00.791] [LOG] Serving the race schedule iCal [06.10.2021 15:09.01.100] [LOG] MMM-Powerwall: Attempting to infer siteID [06.10.2021 15:09.01.103] [LOG] MMM-Powerwall: Fetching products list [06.10.2021 15:09.01.223] [INFO] Checking git for module: MMM-BMW-OW [06.10.2021 15:09.01.393] [INFO] Checking git for module: MMM-Powerwall [06.10.2021 15:09.01.498] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?kind=self_consumption&period=day returned {"response":{"period":"day","time_series":[{"timestamp":"2021-10-05T00:00:00-04:00","solar":34.69208883131939,"battery":15.874502745388948},{"timestam [06.10.2021 15:09.01.594] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/live_status returned {"response":{"solar_power":1478,"energy_left":18710.947368421057,"total_pack_energy":55732,"percentage_charged":33.57307717006577,"backup_capable":tru [06.10.2021 15:09.01.684] [LOG] MMM-Powerwall: https://owner-api.teslamotors.com/api/1/energy_sites/197169198447/history?period=day&kind=power returned {"response":{"serial_number":"1232100-00-E--TG121009001SBA","time_series":[{"timestamp":"2021-10-05T00:00:00-04:00","solar_power":0,"battery_power":0, [06.10.2021 15:09.01.733] [LOG] MMM-Powerwall: UpdateLocal{"powerwallIP":"10.1.3.231","twcManagerIP":null,"twcManagerPort":8080,"updateInterval":9500} [06.10.2021 15:09.01.735] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 15:09.01.740] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [06.10.2021 15:09.01.748] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid [06.10.2021 15:09.01.750] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operation [06.10.2021 15:09.01.779] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/meters/aggregates: [06.10.2021 15:09.01.803] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/soe: [06.10.2021 15:09.01.813] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/grid_status: [06.10.2021 15:09.01.819] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/operation:
[06.10.2021 15:09.30.621] [LOG] MMM-Powerwall: 10.1.3.231: Beginning login attempt [06.10.2021 15:09.30.637] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/login/Basic: [06.10.2021 15:09.31.277] [LOG] MMM-Powerwall: 10.1.3.231: Login headers: {"cache-control":"no-cache, no-store","set-cookie":["AuthCookie=0EqY1IhI4zdh7G_R-9S_DH2-0JhLehmhroVbn6Y87SCONPk8Y-jcU6VtpXLXf3lyi6eHTsgLkAZrmqEetooJnQ==; Path=/","UserRecord=eyJlbWFpbCI6IiIsImZpcnN0bmFtZSI6IlRlc2xhIiwibGFzdG5hbWUiOiJFbmVyZ3kiLCJyb2xlcyI6WyJIb21lX093bmVyIl0sInRva2VuIjoiMEVxWTFJaEk0emRoN0dfUi05U19ESDItMEpoTGVobWhyb1ZibjZZODdTQ09OUGs4WS1qY1U2VnRwWExYZjNseWk2ZUhUc2dMa0Facm1xRWV0b29KblE9PSIsInByb3ZpZGVyIjoiQmFzaWMiLCJsb2dpblRpbWUiOiIyMDIxLTEwLTA2VDE1OjA5OjMxLjI3Mzg0ODU0OC0wNDowMCJ9; Path=/"],"date":"Wed, 06 Oct 2021 19:09:31 GMT","content-length":"243","content-type":"text/plain; charset=utf-8"} [06.10.2021 15:09.31.280] [LOG] MMM-Powerwall: Successfully logged into 10.1.3.231 [06.10.2021 15:09.31.285] [LOG] MMM-Powerwall: 10.1.3.231: Requesting aggregates [06.10.2021 15:09.31.290] [LOG] MMM-Powerwall: 10.1.3.231: Requesting soe [06.10.2021 15:09.31.296] [LOG] MMM-Powerwall: 10.1.3.231: Requesting grid [06.10.2021 15:09.31.306] [LOG] MMM-Powerwall: 10.1.3.231: Requesting operation [06.10.2021 15:09.31.325] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/meters/aggregates: [06.10.2021 15:09.31.334] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/soe: [06.10.2021 15:09.31.343] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/system_status/grid_status: [06.10.2021 15:09.31.349] [LOG] MMM-Powerwall: 10.1.3.231: Cookie for https://10.1.3.231/api/operation: [06.10.2021 15:09.31.420] [LOG] MMM-Powerwall: 10.1.3.231: Tokens rejected; need to log in again [06.10.2021 15:10.01.287] [LOG] MMM-Powerwall: 10.1.3.231: Beginning login attempt
So on the plus side, the Powerwall is sending you a valid cookie. That means it should be fixable in the module code. I don't understand why the Cookie isn't being captured on your system. However, there's a simpler way to do it -- we really only care about capturing Set-Cookie when we're logging in. Let me try moving that handler into the login method and see if that works better for you.
Actually, I think I found it. Go back to master
and run npm install
, see if it starts working afterward.
Still getting the 403 error.
tried git reset --hard
and got the following response
HEAD is now at 4353287 Missing dependency: tough-cookie
i did run npm install and subsequently npm audit
glob-parent <5.1.2
Severity: moderate
Regular expression denial of service - https://npmjs.com/advisories/1751
fix available via npm audit fix
node_modules/glob-stream/node_modules/glob-parent
glob-stream >=5.3.0
Depends on vulnerable versions of glob-parent
node_modules/glob-stream
help-me 1.0.0 - 1.1.0
Depends on vulnerable versions of glob-stream
node_modules/help-me
mqtt 1.14.1 - 4.2.6
Depends on vulnerable versions of help-me
node_modules/mqtt
4 moderate severity vulnerabilities
should i run audit fix?
Don't worry about audit fix
for now; that's something for me to deal with. Try what's in the 403_needs_auth
branch again, then. I don't understand why your Cookies aren't being stored, but let's try to have it in a different code path.
I can't explain it exactly, but after pulling 403_needs_auth, it started working. pulled the latest #73 not debug and its working also...
Thank you for all your hard work on this module! its the reason I built my MM to begin with
So if that last commit worked for you, it means that for some reason, the interceptor on responses wasn't running to pick up the cookie. I don't know why that would be, but since the only place it's actually expected to acquire a new cookie is the /login
response, it doesn't hurt anything to explicitly retrieve and set the cookie in that exchange instead.
Thanks for your kind words -- obviously I built this for myself to begin with, but I'm delighted others are using it too!
I see you're not using it with TWCManager; if you have a Tesla vehicle as well, I'd be interested in your observations on how well taking data from the API to reflect car charging works. That's a code path that doesn't get exercised at home for me.
Good morning, Some time ago my MM stopped updating. I rebuilt it yesterday and updated the modules, however I find the powerwall is still not updating. the auth seems to work correctly. i see the 2 tokens in the folder with data. any thoughts on what I'm seeing?