Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for influxdb 2.0 #42

Open
frezeen opened this issue Oct 9, 2021 · 4 comments
Open

support for influxdb 2.0 #42

frezeen opened this issue Oct 9, 2021 · 4 comments

Comments

@frezeen
Copy link

frezeen commented Oct 9, 2021

hi,please can u add support for influxdb api v2?

@nmakel
Copy link
Owner

nmakel commented Oct 9, 2021

Can you share how far you've gotten modifying example_influxdb.py to get it to work?

@frezeen
Copy link
Author

frezeen commented Oct 9, 2021

no, sorry im not a programmer i dont know how to add it.
this is what i got when try to connect to influxdb2 (latest)

today at 01:26:34 Container started
today at 01:26:30 influxdb.exceptions.InfluxDBClientError: 401: {"code":"unauthorized","message":"Unauthorized"}
today at 01:26:34 Traceback (most recent call last):
today at 01:26:34   File "example_influxdb.py", line 171, in <module>
today at 01:26:34     client.write_points(json_body)
today at 01:26:34   File "/usr/local/lib/python3.7/site-packages/influxdb/client.py", line 608, in write_points
today at 01:26:34     consistency=consistency)
today at 01:26:34   File "/usr/local/lib/python3.7/site-packages/influxdb/client.py", line 685, in _write_points
today at 01:26:34     protocol=protocol
today at 01:26:34   File "/usr/local/lib/python3.7/site-packages/influxdb/client.py", line 419, in write
today at 01:26:34     headers=headers
today at 01:26:34   File "/usr/local/lib/python3.7/site-packages/influxdb/client.py", line 378, in request
today at 01:26:34     raise InfluxDBClientError(err_msg, response.status_code)
today at 01:26:34 influxdb.exceptions.InfluxDBClientError: 401: {"code":"unauthorized","message":"Unauthorized"}

i read this one but dont know if help, its hard for me to understand:
https://john.soban.ski/refactor-python-to-influx-2.html

@Jusufs
Copy link

Jusufs commented Oct 15, 2022

I would prefer to storage not the whole transfer but some parsed important values. I will try to do it. This approach is also valid for openhab persistence.

@Stoischo
Copy link

I have modified the example script for influxdb api v2 (see attachment) according to this documentation: https://www.influxdata.com/blog/getting-started-with-python-and-influxdb-v2-0/

Only thing you have do to is to import this library:
pip install influxdb-client

Example call:
./example_influxdbV2.py --influx_token <your_token> influx_org <your_org> --influx_bucket <your_bucket> --influx_url http://<your_ip>:8086 <your_inverter_ip> <your_inverter_port>

example_influxdbV2.py.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants