diff --git a/screenshotter/rootfs/app/app.py b/screenshotter/rootfs/app/app.py index 31d4a7f..5554f60 100644 --- a/screenshotter/rootfs/app/app.py +++ b/screenshotter/rootfs/app/app.py @@ -10,6 +10,7 @@ import logging logging.basicConfig(format='%(asctime)s [%(levelname)s]:%(message)s', level=logging.DEBUG) +INTERNAL_HA_URL = "http://172.30.32.1:8123" image_path = os.environ.get("SCREEN_IMAGE_PATH", default='/tmp') config_file = os.environ.get("SCREEN_CONFIG", default="/app/config.yaml") @@ -61,7 +62,7 @@ while True: driver = webdriver.Chrome(options=chrome_options, desired_capabilities=d) driver.implicitly_wait(10) - if task.get("ha_auth"): + if task.get("dashboard"): #def interceptor(request): # if request.headers['Authorization']: # del request.headers['Authorization'] # Remember to delete the header first @@ -71,12 +72,14 @@ while True: response.headers['Access-Control-Allow-Origin'] = '*' driver.response_interceptor = response_interceptor - driver.get("http://172.30.32.1:8123") + driver.get(INTERNAL_HA_URL) time.sleep(int(wait)) logging.info("Doing HA Auth") driver.execute_script(f"window.localStorage.setItem('hassTokens', JSON.stringify({{hassUrl: '{ha_url}', access_token: '{ha_token}', token_type: 'Bearer'}}));") - - driver.get(task["url"]) + driver.get(task["dashboard"]) + else: + driver.get(task["url"]) + time.sleep(int(wait)) logging.info("Making screenshot")