Ok those scripts seem very different to the one I based mine on, I'm only graphing the data so its a lot simpler.
I'm using cacti and my script is triggered once every 5 minutes.
1) it gets session using
postdata = {'Username': USERNAME, 'Password': PASSWORD, 'ApplicationId': '91db1612-73fd-4500-91b2-e63b069b185c'}
header = {'content-type': 'application/json'}
url = 'https://tccna.honeywell.com/WebAPI/api/Session'
data = json.dumps(postdata)
response = requests.post(url, data=data, headers=header, timeout=15)
str_response = response.content.decode("utf-8")
2) then I dump all the data from my locations using
url = 'https://tccna.honeywell.com/WebAPI/api/locations?userId=%s&allData=True' % userid
#print(url)
header['sessionId'] = sessionId
response = requests.get(url, data=json.dumps(postdata), headers=header, timeout=15)
I was previously doing steps 1 & 2 every poll, however now I store the userid and sessionid from step 1 and just do step 2 and so far its now been fine.
I'm using cacti and my script is triggered once every 5 minutes.
1) it gets session using
postdata = {'Username': USERNAME, 'Password': PASSWORD, 'ApplicationId': '91db1612-73fd-4500-91b2-e63b069b185c'}
header = {'content-type': 'application/json'}
url = 'https://tccna.honeywell.com/WebAPI/api/Session'
data = json.dumps(postdata)
response = requests.post(url, data=data, headers=header, timeout=15)
str_response = response.content.decode("utf-8")
2) then I dump all the data from my locations using
url = 'https://tccna.honeywell.com/WebAPI/api/locations?userId=%s&allData=True' % userid
#print(url)
header['sessionId'] = sessionId
response = requests.get(url, data=json.dumps(postdata), headers=header, timeout=15)
I was previously doing steps 1 & 2 every poll, however now I store the userid and sessionid from step 1 and just do step 2 and so far its now been fine.
Comment