Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from influxdb import InfluxDBClient
- import time
- import random
- import json
- import datetime
- #ustawienia bazy danych
- client = InfluxDBClient(host='localhost', port=8086)
- client = InfluxDBClient(host='localhost', port=8086, username='myuser', password='mypass', ssl=False, verify_ssl=False)
- client.create_database('grafana')
- client.switch_database('grafana')
- #InfluxDB send JSON
- def grafana():
- json_body = [
- {
- "measurement": "odleglosc",
- "time": datetime.datetime.now(),
- "fields": {
- "value": adc_value
- }
- }]
- client.write_points(json_body)
- #petla glowna
- while True:
- grafana()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement