Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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