Skip to content

Commit

Permalink
potential fix for timezone issue with sgs in ns uploader;added option…
Browse files Browse the repository at this point in the history
…s to webdriver
  • Loading branch information
sedy89 committed Feb 22, 2024
1 parent ba5b5e5 commit 5170518
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 1 addition & 9 deletions custom_components/carelink/nightscout_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ def __getDataStringFromIso(self, time, tz):
date_string = dt.isoformat()
return date, date_string

def __getDataString(self, time, tz):
dt = datetime.strptime(time,"%Y-%m-%dT%H:%M:%S.%fZ")
dt = dt.astimezone(tz)
timestamp = dt.timestamp()
date = int(timestamp * 1000)
date_string = dt.isoformat()
return date, date_string

async def __setDeviceStatus(self, rawdata):
printdbg("__setDeviceStatus()")
try:
Expand Down Expand Up @@ -376,7 +368,7 @@ def __getSGSEntries(self, sgs, tz):
trend, delta = self.__ns_trend(sgs[count], sgs[count-1])
except Exception:
pass
date, date_string=self.__getDataString(sg["datetime"], tz)
date, date_string=self.__getDataStringFromIso(sg["datetime"], tz)
result.append(dict(
device=NS_USER_AGENT,
direction=trend,
Expand Down
6 changes: 5 additions & 1 deletion utils/carelink_carepartner_api_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

import OpenSSL
from seleniumwire import webdriver
from selenium.webdriver.firefox.options import Options


def setup_logging():
Expand Down Expand Up @@ -98,7 +99,10 @@ def reformat_csr(csr):
return csr

def do_captcha(url, redirect_url):
driver = webdriver.Firefox()
options = Options()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Firefox(options=options)
driver.get(url)

while True:
Expand Down

0 comments on commit 5170518

Please sign in to comment.