Skip to content
Snippets Groups Projects
Commit bc6cf2e1 authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Added logger

parent 66dd3865
No related branches found
No related tags found
No related merge requests found
import pidcontroller
import os
import json
from influxdb import InfluxDBClient
with open('.secrets.json') as secrets_file:
secrets = json.load(secrets_file)
def get_secret(setting, secrets=secrets):
try:
return secrets[setting]
except KeyError:
print("Failed to load credentials.")
clientDB=InfluxDBClient(host=get_secret('DB_HOSTNAME'), port=get_secret('DB_PORT'), username=get_secret('DB_USERNAME'), password=get_secret('DB_PASSWORD'), database='cmtqo_metamat', ssl=True, verify_ssl=True)
try:
controller = pidcontroller.PidController('COM5')
temps = controller.getTemperatures()
controller.disconnect()
measure = [{"measurement":"loop temperature", "fields":{"°C":t}, "tags":{"room":"hpp-p24", "setup": "RBComb"}}]
clientDB.write_points(measure)
except:
pass
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment