// Howdy 👋.
//
// This is where you can create powerful part automations like resistors that tell you when too much current is flowing through them
// You can also create your own flexible parts, like generics (https://docs.flux.ai/Introduction/generic-parts)
//
// If you are new to writing code in Flux make sure to check out our get started docs: https://docs.flux.ai/reference/introduction
//
// We also have a Flux Slack Community in case you need help: https://join.slack.com/t/fluxcommunity/shared_invite/zt-2ouyf80w6-7Wp81YlNEsuDFFdED9UQMA
//
// To infinity and beyond 🚀
import json
from influxdb_client import InfluxDBClient, Point, WriteOptions
# File Path
json_file_path = r"C:\Users\rolle\Downloads\FilterWizBandPass.json"
# Load JSON Data
with open(json_file_path, "r") as f:
json_data = json.load(f)
# InfluxDB Connection
client = InfluxDBClient(url = "http://localhost:8086", token = "your-token", org = "your-org")
write_api = client.write_api(write_options = WriteOptions(batch_size = 500))
# Write Data to InfluxDB
for entry in json_data:
point = Point("FilterWizBandPass").tag("sensor", "example").field("value", entry["value"])
write_api.write(bucket = "example-bucket", org = "your-org", record = point)
print("Data Imported Successfully!")