Skip to content

Commit c266a7e

Browse files
committed
Add API type option input for example.py file
1 parent aa70344 commit c266a7e

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

credentials.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
USERNAME = ""
22
PASSWORD = ""
3+
API_TYPE = "" # classic or genesis

example.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from datetime import datetime, timedelta
22
from ThermiaOnlineAPI import Thermia
3-
from credentials import USERNAME, PASSWORD
3+
from credentials import USERNAME, PASSWORD, API_TYPE
4+
from ThermiaOnlineAPI.const import (
5+
THERMIA_API_TYPE_CLASSIC,
6+
THERMIA_API_TYPE_GENESIS,
7+
)
48

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

13-
thermia = Thermia(USERNAME, PASSWORD, "classic")
17+
if not API_TYPE:
18+
api_type_number = input("Enter api type (1 = classic, 2 = genesis): ")
19+
if api_type_number == "1":
20+
API_TYPE = THERMIA_API_TYPE_CLASSIC
21+
elif api_type_number == "2":
22+
API_TYPE = THERMIA_API_TYPE_GENESIS
23+
else:
24+
print("Invalid api type")
25+
exit(1)
26+
27+
thermia = Thermia(USERNAME, PASSWORD, api_type=API_TYPE)
1428

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

0 commit comments

Comments
 (0)