Hoffmann77 / home_assistant_enphase_gateway

A custom integration for Home Assistant to read data from your Enphase Gateway.
Apache License 2.0
0 stars 0 forks source link

After initial 401 Error while trying to update token: 'GatewayReader' object has no attribute 'enphase_token' #4

Closed catsmanac closed 1 year ago

catsmanac commented 1 year ago

When integration is starting getting production.json a 401 is returned and code is trying to update token an error is returned:

2023-07-03 19:33:07.657 DEBUG (MainThread) [custom_components.enphase_gateway.enphase_token] Checking Enphase token: None
2023-07-03 19:33:07.657 DEBUG (MainThread) [custom_components.enphase_gateway.enphase_token] Found empty token: {self._token}
2023-07-03 19:33:07.662 DEBUG (MainThread) [custom_components.enphase_gateway.enphase_token] HTTP POST Attempt: #1: https://enlighten.enphaseenergy.com/login/login.json?
2023-07-03 19:33:11.452 DEBUG (MainThread) [custom_components.enphase_gateway.enphase_token] HTTP POST https://enlighten.enphaseenergy.com/login/login.json?: <Response [200 OK]>: {"message":"success","session_id":"1b9605845574b3b031f375486731976b","manager_token":"<token>","is_consumer":true}
2023-07-03 19:33:11.453 DEBUG (MainThread) [custom_components.enphase_gateway.enphase_token] HTTP POST Cookie: <Cookies[<Cookie locale=en for enlighten.enphaseenergy.com />, <Cookie _enlighten_4_session=1b9605845574b3b031f375486731976b for enlighten.enphaseenergy.com />]>
2023-07-03 19:33:11.455 DEBUG (MainThread) [custom_components.enphase_gateway.enphase_token] HTTP POST Attempt: #1: https://entrez.enphaseenergy.com/tokens
2023-07-03 19:33:12.052 DEBUG (MainThread) [custom_components.enphase_gateway.enphase_token] HTTP POST https://entrez.enphaseenergy.com/tokens: <Response [200 OK]>: <token>
2023-07-03 19:33:12.052 DEBUG (MainThread) [custom_components.enphase_gateway.enphase_token] HTTP POST Cookie: <Cookies[]>
2023-07-03 19:33:12.054 DEBUG (MainThread) [custom_components.enphase_gateway.enphase_token] New Enphase Token valid until: 2024-07-02 17:33:11+00:00
2023-07-03 19:33:12.054 DEBUG (MainThread) [custom_components.enphase_gateway.gateway_reader.gateway_reader] Setup Enphase gateway
2023-07-03 19:33:12.054 DEBUG (MainThread) [custom_components.enphase_gateway.gateway_reader.gateway_reader] HTTP GET Attempt #1: https://192.168.3.112/production.json: Header:{'Authorization': 'Bearer <token>'}
2023-07-03 19:33:12.296 DEBUG (MainThread) [custom_components.enphase_gateway.gateway_reader.gateway_reader] Received status_code 401 from Gateway.
2023-07-03 19:33:12.296 DEBUG (MainThread) [custom_components.enphase_gateway.gateway_reader.gateway_reader] Request header: {'Authorization': 'Bearer <token>'}.
2023-07-03 19:33:12.296 DEBUG (MainThread) [custom_components.enphase_gateway.gateway_reader.gateway_reader] Trying to update token.
2023-07-03 19:33:12.296 DEBUG (MainThread) [custom_components.enphase_gateway.gateway_reader.gateway_reader] Error while trying to update token: 'GatewayReader' object has no attribute 'enphase_token'
2023-07-03 19:33:12.298 DEBUG (MainThread) [custom_components.enphase_gateway.gateway_reader.gateway_reader] Raising initial 401 Error:

home-assistant-v012-beta.log