I can’t get to see my influxdb as a sensor. I have home assistant and influxdb running as docker containers. My data is stored in influxdb. I want to set up sensor(s) in HA to collect data from influxdb.
I’ve entered the following in configuration.yaml
#influxdb Settings
influxdb:
host: localhost
verify_ssl: false
exclude:
entity_globs: "*"
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensors.yaml
mqtt: !include mqtt.yaml
Then in sensor.yaml, I wrote:
- platform: influxdb
api_version: 2
token: <TOKEN>
organization: <ORG ID>
queries_flux:
- name: "Total Power for Month"
bucket: "rpict3t1_1sData"
imports:
- date
range_start: "date. Truncate(t: now(), unit:1mo )"
unit_of_measurement: "kWh"
value_template: "{{ (value|float / 100.0)|round(2) }}"
query: >
filter(fn: (r) => r["_measurement"] == "rpict3t1_01")
|> filter(fn: (r) => r["_field"] == "P1" or r["_field"] == "P2" or r["_field"] == "P3")
|> integral(unit:1s)
|> map(fn: (r) => ({ _value: (r._value / 1000.0 / 3600.0 * 220.0) }))
|> sum()
I’ve run the “check configuration” successfully on the developer page. There is no error, but I don’t see the influxdb sensor in the list of entities. I’m at a loss.