Skip to content

Commit

Permalink
Add API type option input for example.py file
Browse files Browse the repository at this point in the history
  • Loading branch information
klejejs committed Jan 28, 2023
1 parent aa70344 commit c266a7e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions credentials.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
USERNAME = ""
PASSWORD = ""
API_TYPE = "" # classic or genesis
18 changes: 16 additions & 2 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from datetime import datetime, timedelta
from ThermiaOnlineAPI import Thermia
from credentials import USERNAME, PASSWORD
from credentials import USERNAME, PASSWORD, API_TYPE
from ThermiaOnlineAPI.const import (
THERMIA_API_TYPE_CLASSIC,
THERMIA_API_TYPE_GENESIS,
)

CHANGE_HEAT_PUMP_DATA_DURING_TEST = (
False # Set to True if you want to change heat pump data during test
Expand All @@ -10,7 +14,17 @@
USERNAME = input("Enter username: ")
PASSWORD = input("Enter password: ")

thermia = Thermia(USERNAME, PASSWORD, "classic")
if not API_TYPE:
api_type_number = input("Enter api type (1 = classic, 2 = genesis): ")
if api_type_number == "1":
API_TYPE = THERMIA_API_TYPE_CLASSIC
elif api_type_number == "2":
API_TYPE = THERMIA_API_TYPE_GENESIS
else:
print("Invalid api type")
exit(1)

thermia = Thermia(USERNAME, PASSWORD, api_type=API_TYPE)

print("Connected: " + str(thermia.connected))

Expand Down

0 comments on commit c266a7e

Please sign in to comment.