Skip to content

Commit 3d17e6b

Browse files
authored
Merge pull request #2208 from hegge/roest-api
Update ROEST API usage
2 parents 6e85beb + 0600c12 commit 3d17e6b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/artisanlib/roest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
GET_TOKEN_URL = 'https://api.roestcoffee.com/o/token/'
30-
GET_MACHINES_URL = 'https://api.roestcoffee.com/machines'
30+
GET_MACHINES_URL = 'https://api.roestcoffee.com/machines/'
3131

3232
CONNECT_TIMEOUT:int = 3
3333
READ_TIMEOUT:int = 5
@@ -83,6 +83,7 @@ def getMachines(client_id:str, client_secret:str) -> list[RoestMachine]:
8383
params = {'page_size': 'all'},
8484
headers = {
8585
'Authorization': f'Bearer {token}',
86+
'Accept': 'application/json; version=1.0',
8687
'Content-Type': 'application/json'})
8788
if res.status_code == 200:
8889
data = res.json()
@@ -107,8 +108,8 @@ def getMachines(client_id:str, client_secret:str) -> list[RoestMachine]:
107108
if 'has_pressure' in sensor_conf and isinstance(sensor_conf['has_pressure'], bool):
108109
machine['has_pressure'] = sensor_conf['has_pressure']
109110
#
110-
if 'is_p2000' in item and isinstance(item['is_p2000'], bool):
111-
machine['p3000'] = item['is_p2000']
111+
if 'prod_type' in item and isinstance(item['prod_type'], int):
112+
machine['p3000'] = item['prod_type'] == 1
112113
if 'machine_image' in item and isinstance(item['machine_image'], str):
113114
machine['machine_image'] = item['machine_image'].upper()
114115
try:

0 commit comments

Comments
 (0)