From 224b03125ce6b2afb5af5c4a81969e099286c412 Mon Sep 17 00:00:00 2001 From: Innovation Date: Wed, 3 Apr 2024 08:05:34 +0100 Subject: [PATCH] Tinkered with the vitalsd prototype so that it works given recent commits --- src/modules/vitalsd/vitalsd.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/vitalsd/vitalsd.py b/src/modules/vitalsd/vitalsd.py index 4da3ea0..12e34f2 100644 --- a/src/modules/vitalsd/vitalsd.py +++ b/src/modules/vitalsd/vitalsd.py @@ -50,8 +50,9 @@ urlAddCyberware = urlBase + '/api/cyberware/add' # Add to Cyberware and get UUID uuidRequest = requests.post(urlAddCyberware, json={ 'name': "PineTime", 'hotpluggable': True, 'canSet': [ '/api/vitals/heartrate', '/api/fitness/steps' ] }) -if(uuidRequest.status_code == 204): - uuid = uuidRequest.json()['uuid'] +if(uuidRequest.status_code == 200): + uuid = uuidRequest.json()[0]['uuid'] + print(uuid) else: sys.exit("Failed to get UUID") @@ -62,8 +63,8 @@ while True: steps = getSteps() #battery = getBattery() - requests.post(urlHeartrate, json={ 'heartrate': heartrate, 'uuid': uuid } ) - requests.post(urlSteps, json={ 'steps': steps, 'uuid': uuid }) + heartrateRequest = requests.post(urlHeartrate, json={ 'heartrate': heartrate, 'uuid': uuid } ) + stepsRequest = requests.post(urlSteps, json={ 'steps': steps, 'uuid': uuid }) except: print("An exception occured. TODO: Exception report to frontend.")