Set language if desired
This commit is contained in:
parent
21511c669c
commit
9f0e6a2d34
3 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
name: E-Paper Screenshotter
|
||||
version: 1.0.1.13
|
||||
version: 1.0.1.14
|
||||
#image: ghcr.io/maxwinterstein/homeassistant-addon-toogoodtogo-ha-mqtt-bridge-{arch}
|
||||
slug: screenshotter
|
||||
description: Screenshot images for E-Paper pricetags
|
||||
|
@ -21,6 +21,7 @@ options:
|
|||
wait_seconds: 5
|
||||
ha_url: https://homeassistant.local:8123
|
||||
ha_token: 123aaa
|
||||
ha_language: en
|
||||
schema:
|
||||
image_path: str
|
||||
config_file: str
|
||||
|
@ -30,5 +31,6 @@ schema:
|
|||
wait_seconds: int
|
||||
ha_url: str
|
||||
ha_token: str
|
||||
ha_language: str
|
||||
stage: experimental
|
||||
init: false
|
||||
|
|
|
@ -19,6 +19,7 @@ rotate = os.environ.get("SCREEN_ROTATE", default="0")
|
|||
wait = os.environ.get("SCREEN_WAIT", default="5")
|
||||
ha_url = os.environ.get("SCREEN_HA_URL", default="")
|
||||
ha_token = os.environ.get("SCREEN_HA_TOKEN", default="")
|
||||
ha_language = os.environ.get("SCREEN_HA_LANGUAGE", default="en")
|
||||
|
||||
# Open another headless browser with height extracted above
|
||||
chrome_options = Options()
|
||||
|
@ -55,6 +56,7 @@ while True:
|
|||
if task.get("ha_auth"):
|
||||
print("Doing HA Auth")
|
||||
driver.execute_script(f"window.localStorage.setItem('hassTokens', JSON.stringify({{hassUrl: '{ha_url}', access_token: '{ha_token}', token_type: 'Bearer'}}));")
|
||||
driver.execute_script(f"window.localStorage.setItem('selectedLanguage', '{ha_language}');")
|
||||
driver.get(task["url"])
|
||||
time.sleep(int(wait))
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ export SCREEN_ROTATE="$(bashio::config 'rotate')"
|
|||
export SCREEN_WAIT="$(bashio::config 'wait_seconds')"
|
||||
export SCREEN_HA_URL="$(bashio::config 'ha_url')"
|
||||
export SCREEN_HA_TOKEN="$(bashio::config 'ha_token')"
|
||||
export SCREEN_HA_LANGUAGE="$(bashio::config 'ha_language')"
|
||||
|
||||
|
||||
mkdir -p $SCREEN_IMAGE_PATH
|
||||
|
|
Loading…
Reference in a new issue