Tinkered with the vitalsd prototype so that it works given recent commits

This commit is contained in:
Innovation 2024-04-03 08:05:34 +01:00
parent 2582c4c4ee
commit 224b03125c

View file

@ -50,8 +50,9 @@ urlAddCyberware = urlBase + '/api/cyberware/add'
# Add to Cyberware and get UUID # Add to Cyberware and get UUID
uuidRequest = requests.post(urlAddCyberware, json={ 'name': "PineTime", 'hotpluggable': True, 'canSet': [ '/api/vitals/heartrate', '/api/fitness/steps' ] }) uuidRequest = requests.post(urlAddCyberware, json={ 'name': "PineTime", 'hotpluggable': True, 'canSet': [ '/api/vitals/heartrate', '/api/fitness/steps' ] })
if(uuidRequest.status_code == 204): if(uuidRequest.status_code == 200):
uuid = uuidRequest.json()['uuid'] uuid = uuidRequest.json()[0]['uuid']
print(uuid)
else: else:
sys.exit("Failed to get UUID") sys.exit("Failed to get UUID")
@ -62,8 +63,8 @@ while True:
steps = getSteps() steps = getSteps()
#battery = getBattery() #battery = getBattery()
requests.post(urlHeartrate, json={ 'heartrate': heartrate, 'uuid': uuid } ) heartrateRequest = requests.post(urlHeartrate, json={ 'heartrate': heartrate, 'uuid': uuid } )
requests.post(urlSteps, json={ 'steps': steps, 'uuid': uuid }) stepsRequest = requests.post(urlSteps, json={ 'steps': steps, 'uuid': uuid })
except: except:
print("An exception occured. TODO: Exception report to frontend.") print("An exception occured. TODO: Exception report to frontend.")