Skip to content

Commit

Permalink
Merge pull request #2863 from rleidner/soc_bmw_p7
Browse files Browse the repository at this point in the history
soc_i3: fix issue with uninitialized session_id
  • Loading branch information
benderl authored Jan 6, 2025
2 parents 0a05738 + 0854bd1 commit 10c2f13
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/soc_i3/i3soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,16 +455,16 @@ def main():
load_store()
now = int(time.time())
_debug('main0: store=\n' + json.dumps(store, indent=4))
if 'session_id' not in store:
store['session_id'] = str(uuid.uuid4())
session_id = store['session_id']
# if OK, check if refreshToken is required
if 'expires_at' in store and \
'Token' in store and \
'expires_in' in store['Token'] and \
'refresh_token' in store['Token']:
expires_in = store['Token']['expires_in']
expires_at = store['expires_at']
if 'session_id' not in store:
store['session_id'] = str(uuid.uuid4())
session_id = store['session_id']
token = store['Token']
_exp_at = datetime.fromtimestamp(expires_at).strftime('%Y-%m-%d %H:%M:%S')
_exp_at2 = datetime.fromtimestamp(expires_at-120).strftime('%Y-%m-%d %H:%M:%S')
Expand Down

0 comments on commit 10c2f13

Please sign in to comment.