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

InfluxDB 2.0 #61

Open
RERobbins opened this issue Nov 27, 2020 · 4 comments
Open

InfluxDB 2.0 #61

RERobbins opened this issue Nov 27, 2020 · 4 comments

Comments

@RERobbins
Copy link

InfluxDB 2.0 is now available. Has anyone thought about refining this app to work with it? I may start looking at tweaking the code to that end but I fear I may be out of my depth.

@BGodding
Copy link

It might just work.... https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/

Might be as simple as using the auth token for the password.

@RERobbins
Copy link
Author

I've read the InfluxDB documentation describing how to use the V1 compatible write endpoint offered by V2 and, having looked at the code for the SmarApp it looked like substituting the authentication token for the password would work, but it doesn't seem to be working for me. I did use the Influx CLI to establish a DBRP mapping so that a reference for the relevant database in the call would get mapped to the V2 data bucket. It doesn't look like it should be too hard to get this to work, but I'm not accustomed to Groovy coding nor do I have any experience working with the sendHubCommand which is used by this app to pass the relevant call to the API.

@RERobbins
Copy link
Author

I continue to work on this one and have not made much progress. I'm not sure if there's an encoding problem that causes issues with the auth token. I have tried a number of different approaches, including the one suggest by @BGodding above as well as adding an input variable to specify that I'm using InfluxDB-2 and then tweaking the code here and there to use the new V2 write endpoint with Token authorization. I'd be happy to share what I've done with someone who is a bit more savvy to sort through all of this.

@al8
Copy link

al8 commented Jul 20, 2021

I don't know if you're still working on this, but all I did in this code was to add a Token config and added it to the request header, and generate a token that has access to the bucket.

On influxdb2 itself I had to associate a bucketID with a v1 database name via the "dbrps" api, something like.

curl --request POST http://192.168.1.1:8082/api/v2/dbrps --header "Authorization: Token token" --header 'Content-type: application/json' --data '{ "bucketID": "f2fe5057fxxxx", "database": "SmartThings", "default": true, "orgID": "4e610d1xxxxx", "retention_policy": "year" }'

You can see my changes in this commit: let me know if you need more help.

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

3 participants