First working version with smllib

This commit is contained in:
2023-12-14 16:13:12 +01:00
commit 8e6bd6765e
4 changed files with 145 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
from influxdb_client import InfluxDBClient, Point, WritePrecision
from influxdb_client.client.write_api import SYNCHRONOUS
token = "chOaOOaMs1QpQaYwYgj3TWT-z1LxuoWP_YC7M0rrFqFwNDVnGzyGKrUMqSPHN0_xPOgyEzedKu3i8wbCLVHyFg=="
org = "main"
bucket = "power"
client = InfluxDBClient(url="http://localhost:8086", token=token, org=org, timeout=30000)
write_api = client.write_api(write_options=SYNCHRONOUS)
def writeToDB(dataPoints):
""" Writes measurement to influx
"""
write_api.write(bucket, record=dataPoints)
print("Added to DB")