Skip to content

Instantly share code, notes, and snippets.

@FredrikL
Created July 8, 2015 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FredrikL/fe7cb4f214093f4c89cd to your computer and use it in GitHub Desktop.
Save FredrikL/fe7cb4f214093f4c89cd to your computer and use it in GitHub Desktop.
tdtool.py modification
def get_temps():
client = InfluxDBClient('localhost', 8086, 'root', 'root', 'house_temp')
wilma = doRequest('sensor/info', {'id': 1210772})
ute = doRequest('sensor/info', {'id': 2648581})
sovrum = doRequest('sensor/info', {'id': 2613562})
mini = doRequest('sensor/info', {'id': 2613527})
forrad = doRequest('sensor/info', {'id': 2613616})
vardagsrum = doRequest('sensor/info', {'id': 2613316 })
uppe = doRequest('sensor/info', {'id': 2613599})
json_body = [{
"points": [
[ float(wilma['data'][0]['value']),"wilma", "inside"],
[ float(ute['data'][0]['value']),"ute", "outside"],
[ float(forrad['data'][0]['value']),"förråd", "outside"],
[ float(sovrum['data'][0]['value']),"sovrum", "inside"],
[ float(mini['data'][0]['value']),"mini", "inside"],
[ float(vardagsrum['data'][0]['value']),"vardagsrum", "inside"],
[ float(uppe['data'][0]['value']),"uppe", "inside"]
],
"name": "temp",
"columns": ["temp", "name", "place"]
}]
client.write_points(json_body)
# print response['data'][0]['value']
if __name__ == "__main__":
config = ConfigObj(os.environ['HOME'] + '/.config/Telldus/tdtool.conf')
#main(sys.argv[1:])
get_temps()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment