1234567891011121314 |
- from influxdb_client import InfluxDBClient, Point
- from influxdb_client.client.write_api import SYNCHRONOUS
- class Database():
- def __init__(self):
- self.client = InfluxDBClient(url="http://localhost:8086", token="XPBViJ3s4JL9_wPffwd5M2EgXj5hcUgT0n4jNhv7m6-NC-6SSxQ3run4kXtWBvOk-FYr1VG5Tj5WcoHgjge9jw==", org="laempe")
- self.bucket = "energy-monitor"
- self.write_api = self.client.write_api(write_options=SYNCHRONOUS)
- self.query_api = self.client.query_api()
- def write(self, point):
- self.write_api.write(bucket=self.bucket, record=point)
|