Influxdb access to READ (Synology docker)

Hi guys, need some support here…
I’ve been writing data to influxdb on my Synology since a year from H.A …
It’s working great and i’ve got a ton of data to play with…

However, today I tried to create a sensor to be used from data based from influxdb.
No matter how I configure the sensor I always get a:
* Cannot connect to InfluxDB due to 'HTTPConnectionPool(host='localhost', port=8086): Max retries exceeded with url: /query?q=SHOW+DATABASES%3B (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe6b0dde8e0>: Failed to establish a new connection: [Errno 111] Connection refused'))'. Please check that the provided connection details (host, port, etc.) are correct and that your InfluxDB server is running and accessible.

But writing to the influxdb is working great.
This is my settings in config…yaml

# InfluxDB
influxdb:
  host: 192.168.1.10
  port: 8086
  database: home_assistant
  username: secret...
  password: secret...
  ssl: false
  verify_ssl: false
  max_retries: 30
  default_measurement: state

And this is my sensor:

sensor:
  - platform: influxdb
    queries:
      - name: influx_vaderstation_max_gust_test
        field: value
        where: '"entity_id" = ''vaderstation_vind_wind_gust'' AND time >= 1619020152793ms and time <= now()'
        group_function: max
        database: home_assistant
        measurement: '"m/s"'

WTH is wrong here? :face_with_raised_eyebrow:

There’s a misalignment between the host you’re providing (192.168.1.10) and the host it’s trying to connect to according to the error message (localhost).

I think you’re assuming that the influxdb sensor will pick up the host declaration from configuration.yaml and use that, but it isn’t. Add a host: 192.168.1.10 to the sensor and reload (docs).

2 Likes

Holy shit!
That line of code made it work…
Damn… Must be that I skipped my 3 cup of coffey… :slight_smile:

Thanks Troon!
It works now… :smiley:

1 Like

Question 2… :smiley:
How do I retrive the timestamp for a sensor with value MAX …
Above i’ve got max wind speed… But, i also want it to be populated with date when this occurred.
Is this possible?