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 cloud does not work as in the 2.0 influxdb integration example #54658

Closed
joanwa opened this issue Aug 15, 2021 · 7 comments
Closed

Comments

@joanwa
Copy link
Contributor

joanwa commented Aug 15, 2021

The problem

influxdb integration has documentation and examples for Influxdb 2.0 and also mentions their managed cloud service. However there seem to be some documentation discrepancies, e.g.:

  • default port for influxdb 1.x ha integration is 8086, 2.x has no default port, the 2.0 integration example lists 9999. But Influxdb 2.0 cloud uses port 8086 as default.
  • influxdb organization for authentification is stated in the ha integration documentation as the part of the url after ../orgs/, however the Influxdb 2.0 cloud service states the organization is your email address

I tried using both organizations, also disabling verify_ssl, but always end up with these logs:

Cannot connect to InfluxDB due to '<urllib3.connection.HTTPConnection object at 0x7f915c8b20>: Failed to establish a new connection: [Errno -3] Try again'. Please check that the provided connection details (host, port, etc.) are correct and that your InfluxDB server is running and accessible. Retrying in 60 seconds.

while trying to connect to a influxdb 2.0 cloud instance (free tier). The python sample code to write into the cloud instance works as expected from a local environment. Just can't get ha to work, and the logs don't tell me too much.

What is version of Home Assistant Core has the issue?

core-2021.8.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

influxdb

Link to integration documentation on our website

https://www.home-assistant.io/integrations/influxdb/

Example YAML snippet

influxdb:
  api_version: 2
  host: "https://europe-west1-1.gcp.cloud2.influxdata.com"
  port: 8086
  token: xxxxx
  organization: my.email@gmail.com
  bucket: ha_energy
  tags:
    source: HA
  tags_attributes:
    - friendly_name
  default_measurement: units
  exclude:
    entities:
      - zone.home
    domains:
      - persistent_notification
      - person
  include:
    domains:
      - sensor
      - binary_sensor
      - sun
    entities:
      - weather.home

Anything in the logs that might be useful for us?

Cannot connect to InfluxDB due to '<urllib3.connection.HTTPConnection object at 0x7f915c8b20>: Failed to establish a new connection: [Errno -3] Try again'. Please check that the provided connection details (host, port, etc.) are correct and that your InfluxDB server is running and accessible. Retrying in 60 seconds.

Additional information

No response

@probot-home-assistant
Copy link

influxdb documentation
influxdb source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @fabaff, @mdegat01, mind taking a look at this issue as it has been labeled with an integration (influxdb) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@joanwa joanwa changed the title Influxdb 2.0 cloud does not work with 2.0 influxdb integration example Influxdb 2.0 cloud does not work as in the 2.0 influxdb integration example Aug 15, 2021
@avidit
Copy link

avidit commented Aug 17, 2021

@ joanwa Can you try with the following

influxdb:
    api_version: 2
    host: europe-west1-1.gcp.cloud2.influxdata.com
    token: xxxxx
    organization: org_id
  • Remove https:// from host
  • Remove port from config
  • Use org_id instead of email address. You can find org_id in the url https://europe-west1-1.gcp.cloud2.influxdata.com/orgs/<org_id> it in Profile > About.

@joanwa
Copy link
Contributor Author

joanwa commented Aug 18, 2021

  • dropping the https:// made it work
  • email address works as organization, org_id works also

I think it's worth updating the documentation

@mdegat01
Copy link
Contributor

however the Influxdb 2.0 cloud service states the organization is your email address

Can you point me to where it says this? In the Influx DB docs all the APIs which ask for an organization ID direct you to this page for obtaining it. Which shows this:
Screen Shot 2021-08-18 at 7 05 48 PM

I've never seen anything that says you can use your email address. And I just tried it on my Influx Cloud account and it does not work, I get an error saying "organization name not found" when I try. Can you point me to where it says you can use your email as the org ID in the docs? Is this something for new sign-ups now?

2.x has no default port, the 2.0 integration example lists 9999

2.x does have a default port although it appears to be 8086 now. I swear their OSS examples were all using 9999 when I wrote that, oh well I can update it.

But you'll notice the example uses localhost and my second link here is to the OSS docs not the cloud ones. Influx Cloud does not have a default port, Influx 2.0 does.

I can make a second example for cloud though if needed. At the time I wrote the docs Influx Cloud was only in one region so you could pretty much just add api_version: 2 accept the rest of the defaults. Now that its multi-region I suppose there is more to fill out, even for cloud.

dropping the https:// made it work

This I will note is already in the docs. The example does not include http or https in front. And the doc describes the host option as IP address or domain of your database host, e.g., 192.168.1.10.

@joanwa
Copy link
Contributor Author

joanwa commented Aug 19, 2021

You'll find it at the library code snippet section:
https://europe-west1-1.gcp.cloud2.influxdata.com/orgs/293__uid__7fb/load-data/client-libraries/python

where it generates the connection parameters according to your login automatically as shown in my example:
ha_influxdb

@joanwa
Copy link
Contributor Author

joanwa commented Aug 19, 2021

2.x has no default port, the 2.0 integration example lists 9999

2.x does have a default port although it appears to be 8086 now. I swear their OSS examples were all using 9999 when I wrote that, oh well I can update it.

haha, yeap! I searched the changelog and found it at tag 1.11.0, changed in sep 2020:

https://github.com/influxdata/influxdb-client-python/releases

influxdata/influxdb-client-python#151

@github-actions github-actions bot added the stale label Sep 18, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants