8 Comments

  1. Paul

    I am still struggling with this and I believe it is down to the .yaml. Can you confirm your post is exact? Most other posts I was googling have quite a few sets of “”

    • Tobey

      Yes, I’m positive this is correct as I have it working in my current setup. Feel free to post the part of your yaml and I will take a look. Maybe I can spot the issue.

  2. Paul

    Thanks for trying!

    Up top:
    influxdb:
    host: 192.168.1.xxx
    verify_ssl: false
    exclude:
    entity_globs: “*”

    sensor:
    – platform: influxdb
    queries:
    – name: Pump Run Time
    field: Run Time
    where: ‘time > now() – 1d’
    group_function: last
    database: Pump_Monitor
    measurement: ‘”runTime”‘

    Query inspector in Grafana:

    SELECT “Run Time” FROM “runTime” WHERE time >= now() – 7d and time <= now()

    Sorry I did not see your reply at first. I have HA on 1 pi and then influxdb on another pi I have had running for awhile. My influxdb always logs the query – but returns a 400 code instead of 200. Which I assume are just the http codes for good and bad requests. I have that exact grafana query working from node red to influx so I was thinking that it is a matter of how HA formats the query.

    • Tobey

      Hi Paul,
      sorry for not getting back to you earlier.
      I guess the “field: Run Time” in your query is the issue. As the value contains a space I think you may need to wrap it into double quotes, please try that:
      field: “Run Time”

      And you assume correctly, http return codes 2xx are success states, 4xx are client errors.

  3. Paul

    Still does not work.

    ` queries:
    – name: SepticPumpRunTime2
    field: “Run Time”
    where: ‘time > now() – 1d’
    group_function: last
    measurement: ‘”runTime”‘

  4. Paul

    I have found a work around for this problem for now – I am able to pull the entire graphana chart into HA nicely. Thanks for the help though!

  5. Paul

    I circled back and got this working. Note how it is wrapped now by ‘ ” ” ‘.

    upper section of the config.yaml:

    influxdb:
    exclude:
    entity_globs: “*”
    then lower down.

    sensor:
    #influx sensors
    – platform: influxdb
    host: 192.168.1.51
    queries:
    – name: test_temp
    field: Temperature
    where: ‘time > now() – 7d’
    group_function: last
    database: YardWeather
    measurement: ‘”YardWeather”.”18months”.”WSReportedTemp”‘
    – name: influx_sp_run_time
    field: ‘”Run Time”‘
    where: ‘time > now() – 7d’
    group_function: last
    database: Pump_Monitor
    measurement: ‘”Pump_Monitor”.”autogen”.”runTime”‘

Leave a Reply

Your email address will not be published.