@@ -648,7 +648,6 @@ def __init__(
648648 self .enlighten_user = enlighten_user
649649 self .enlighten_pass = enlighten_pass
650650 self .commissioned = commissioned
651- self .envoy_token_fetch_attempted = False
652651 self .enlighten_serial_num = enlighten_serial_num
653652 self .token_refresh_buffer_seconds = token_refresh_buffer_seconds
654653 self .token_type = None
@@ -887,7 +886,6 @@ async def _fetch_envoy_token_json(self):
887886
888887 async def _get_enphase_token (self ):
889888 self ._token = await self ._fetch_envoy_token_json ()
890- self .envoy_token_fetch_attempted = True
891889
892890 _LOGGER .debug ("Envoy Token" )
893891 if self ._is_enphase_token_expired (self ._token ):
@@ -947,6 +945,7 @@ def _is_enphase_token_expired(self, token):
947945
948946 if decode .get ("enphaseUser" , None ) != None :
949947 self .token_type = decode ["enphaseUser" ] # owner or installer
948+ _LOGGER .debug ("TOKEN TYPE: %s" , self .token_type )
950949
951950 exp_epoch = decode ["exp" ]
952951 # allow a buffer so we can try and grab it sooner
@@ -1073,9 +1072,8 @@ async def update_endpoints(self, endpoints=None):
10731072 _LOGGER .error (f"No settings found for uri { endpoint } " )
10741073 continue
10751074
1076- if endpoint_settings .get ("installer_required" , False ) and (
1077- (self .token_type != "installer" and self .envoy_token_fetch_attempted )
1078- or self .disable_installer_account_use
1075+ if endpoint_settings ["installer_required" ] and (
1076+ self .token_type != "installer" or self .disable_installer_account_use
10791077 ):
10801078 _LOGGER .info (
10811079 "Skipping installer endpoint %s (got token %s and "
@@ -1103,8 +1101,8 @@ async def update_endpoints(self, endpoints=None):
11031101 time .time () - endpoint_settings ["last_fetch" ],
11041102 )
11051103
1106- if self .data :
1107- self .data .set_endpoint_data (endpoint , getattr (self , endpoint ))
1104+ if self .data :
1105+ self .data .set_endpoint_data (endpoint , getattr (self , endpoint ))
11081106
11091107 async def get_data (self , get_inverters = True ):
11101108 """
0 commit comments