Cannot get InfluxDB sensor to work or even give an error

Hi there. I’ve been using InfluxDB to collect data from various servers and machines, and I’ve ported all that to a database instance on my Home Assistant install. It’s working fine, I can use the queries in Influx/Chronograph.

I cannot for the life of me get a sensor working in HA to read that data! Even stranger, no matter what I do, I can’t see any errors in the log files, which makes me think I’m missing something pretty fundamental.

I’ve defined InfluxDB, and am sending all my HA data to it just to check connectivity:

influxdb: 
  host: 192.168.1.103
  port: 8086
  api_version: 1
  database: homeassistant
  username: 'homeassistant'
  password: 'supersecretnotreallymypassword'
  ssl: false
  verify_ssl: false
  max_retries: 3
  default_measurement: state

This is working fine, sending to the HomeAssistant DB. The problem is the sensor. If I run this query in InfluxDB, it gives me loads of data:

SELECT value FROM "telegraf"."autogen"."temp_cpu" where time<now() GROUP BY "host"

Obviously it’s a different DB, but my sensor can’t seem to read it:

sensor:
  - platform: influxdb
    host: 192.168.1.103
    port: 8086
    api_version: 1
    username: 'telegraf'
    password: 'rightpasswordforthisuser'
    queries:
      - name: CPU temperatures
        measurement: '"autogen"."temp_cpu"'
        where: 'time < now()'
        field: 'value'
        database: telegraf
        group_function: 'last'

I’ve tried as many combinations of quotes, using the whole database name, etc, and none of it seems to work. I would expect an error in the log files at least.

Any ideas?

I’ve just discovered that ‘reload yaml’ doesn’t really reload the yaml, so none of my changes were ever applied. That definitely counts as the ‘something pretty fundamental’ part of my problem.

Now I see some errors, so I’ll pop off and keep fiddling with it…

OK, got it working once I realised I needed to do a full reset of HA to re-read the configuration.yaml. I was fooled when it said it would reload ‘All YAML Configuration’ on the Developer tab…

This is what I’ve set up for a couple of basic sensors, in case anyone stumbles across this:

sensor:
  - platform: influxdb
    host: 192.168.1.103
    port: 8086
    api_version: 1
    username: 'homeassistant'
    password: 'passwordgoeshere'
    database: telegraf
    queries:
      - name: CPU temperatures
        measurement: '"telegraf"."autogen"."temp_cpu"'
        where: host = 'linux1'
        unit_of_measurement: "°C"
        value_template: "{{ (value|float / 1000.0)|round(1) }}"
        field: 'value'
        group_function: 'last'
      - name: CPU usage
        measurement: '"telegraf"."autogen"."cpu"'
        unit_of_measurement: "%"
        where: host = 'linux1'
        value_template: "{{ (100.0 - value|float)|round(2) }}"
        field: 'usage_idle'
        group_function: 'last'