@@ -621,15 +621,16 @@ def __init__(self, region):
621621 # ugly hack
622622 os .environ ['OAUTHLIB_INSECURE_TRANSPORT' ] = '1'
623623
624- def login (self ):
625- """Login with cached credentials."""
626- return self .login (self ._username , self ._password )
627-
628- def login (self , username , password ):
629- # Cache credentials
630- self ._username = username
631- self ._password = password
632-
624+ def login (self , username = None , password = None ):
625+ if username is not None and password is not None :
626+ # Cache credentials
627+ self ._username = username
628+ self ._password = password
629+ else :
630+ # Use cached credentials
631+ username = self ._username
632+ password = self ._password
633+
633634 # Reset session
634635 self .session = requests .session ()
635636
@@ -751,10 +752,16 @@ def session(self):
751752 def __init__ (self , data , user_id ):
752753 self .user_id = user_id
753754 self .vin = data ['vin' ].upper ()
754- self .features = [
755- Feature (str (u ['id' ]))
756- for u in data .get ('services' , [])
757- if u ['activationState' ] == "ACTIVATED" ]
755+ self .features = []
756+
757+ # Try to parse every feature, but dont fail if we dont recognise one
758+ for u in data .get ('services' , []):
759+ if u ['activationState' ] == "ACTIVATED" :
760+ try :
761+ self .features .append (Feature (str (u ['id' ])))
762+ except ValueError :
763+ pass
764+
758765 self .can_generation = data .get ('canGeneration' )
759766 self .color = data .get ('color' )
760767 self .energy = data .get ('energy' )
@@ -1094,6 +1101,9 @@ def unlock(self, srp: str, group: LockableDoorGroup=None):
10941101 return self .lock_unlock (srp , 'unlock' , group )
10951102
10961103 def fetch_hvac_status (self ):
1104+ if Feature .INTERIOR_TEMP_SETTINGS not in self .features and Feature .TEMPERATURE not in self .features :
1105+ return
1106+
10971107 resp = self ._get (
10981108 '{}v1/cars/{}/hvac-status' .format (self .session .settings ['car_adapter_base_url' ], self .vin ),
10991109 headers = {'Content-Type' : 'application/vnd.api+json' }
0 commit comments