InfluxDB doesn't get all values

Hi,
I have Homeassistant with InfluxDB integration. My config looks like this:

influxdb:
include:
  entities:
    - light.dachboden_schlafen_licht
    - light.dachboden_treppe_licht
    - light.dachboden_wohnen_licht
    - light.flur_licht
    - thermostat.dachboden
    - binary_sensor.sensor_dachboden_schlafen_dachfenster
    - binary_sensor.sensor_dachboden_schlafen_fenster
    - binary_sensor.sensor_dachboden_wohnen_dachfenster
    - binary_sensor.sensor_dachboden_wohnen_fenster
    - sensor.garten_regen_menge
    - sensor.garten_carport_thermometer
    - sensor.garten_haustuer_thermometer
    - sensor.garten_haustuer_helligkeit
    - sensor.garten_carport_helligkeit

knx:
  sensor: 
- name: "garten.haustuer.thermometer"
  state_address: "8/0/1"
  type: temperature
  sync_state: every 2
- name: "garten.carport.thermometer"
  state_address: "8/0/3"
  type: temperature
  sync_state: every 2
- name: "garten.haustuer.helligkeit"
  state_address: "8/0/0"
  type: illuminance
  sync_state: every 2
- name: "garten.carport.helligkeit"
  state_address: "8/0/2"
  type: illuminance
  sync_state: every 2
- name: "garten.regen.durchfluss"
  state_address: "8/0/6"
  type: volume_flow

All values are completely fine in Lovelace. The upper values also come by knx and are correct in Influx.
Since I have the new values there a new nodes in Influx
“L” and “°C”
Below L there is entity_id - 1 and below that there is garten_regen_menge but it has no values when I try showing them.
Under °C there is entity_id - 1 and below that there is garten_haustuer_thermmeter this has also no values and the other temerature sensor is missing completely. And the sensors for the brightness are missing completely.
What am I doing wrong?

The indentation is wrong as posted. Because you said it works, I assume it actually looks like this:

influxdb:
  include:
    entities:
      - light.dachboden_schlafen_licht
# [...]
knx:
  sensor: 
    - name: "garten.haustuer.thermometer"
      state_address: "8/0/1"
      type: temperature
      sync_state: every 2
    - name: "garten.carport.thermometer"
# usw

Correct, but I have excluded it in different files and this was a copy and paste issue

1 Like

Hi
did you check which series and which measurements were created in the influx database? Perhaps it is putting them somewhere where you didn’t expect them?
Assuming you have access for example with the cli influx client, run
show measurements
and
show series

when I was storing data into influx for visualization with Grafana, I didn’t like that by default the measurements were created based on the unit. There is a config to override the measurements

influxdb:
  host: 127.0.0.1
  port: 8086
  # hidden config ....
  default_measurement: state
  include:
    #my includes based on wildcards
    entity_globs:
      - sensor.*_db
  component_config:
    sensor.temperature1
      override_measurement: temperature
  component_config_glob:
    sensor.*humidity*:
      override_measurement: humidity
    sensor.*temperature*:
      override_measurement: temperature

Another important point is that data is only stored to influx when the state in HA changes, for entities like lights you might not see a change for hours and thus no new entry is made in influx.
My workaround was to create a template sensor with an attribute changing every 5 minutes, forcing updates in influx. For example

bme680_temperature_db:
  value_template: "{{ states('sensor.bme680_temperature') }}"
  friendly_name: "Sensor BME680"
  unique_id: bme680_temperature_db
  device_class: temperature
  attribute_templates:
    update_now: "{{ (now().minute / 5) | round(0) }}"

that’s based on configurations I used with HA last year, not sure if they are still valid, I meanwhile stopped storing into influx, had stored many gigabytes and never really looked at the historic values

Armin

Hi,

the values I wish to see are changed many times a day.

But now I hae another problem: none of the nodes seems to have values.

In the past at least these nodes worked, but now I always “your query returned no values”.
If I remove the where clause I get one value from 01/01/1970 01:00:00. I’m very sure that I haven’t had Homeassistant on this day.

I’ve restarted HA many times sice yesterday.

Hi
which version of influx are you using? There seem to be significant differences in configuration between 1.x and 2.x
I only had 1.x running

Anything in the logs? Either in HA logs or InfluxDB-Logs?
in HA it might be worth to switch on some logging for the influxdb integration
I’m not sure about the correct setting for the logger, only found an older posting where is is done in configuration.yaml with

logger:
  default: warning
  logs:
    homeassistant.components.influxdb: debug

Armin

Hi,
InfluxDB is Version 4.5.0.

Logging was a good idea:

  • Cannot connect to InfluxDB due to ‘HTTPConnectionPool(host=‘smart-homer-server.fritz.box’, port=80): Max retries exceeded with url: /:8086/write?db=homeassistant (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x7f803b6920>: 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. Retrying in 60 seconds.

The message occured 2068 times.

I thought I configured it correctly, but I check it out again.

Okay,

I’ve found the error in the config. Now I get values for the light in the corridor. And I have one value for the temperature of one sensor. The other sensor isn’t showing.

I’ve added

component_config_glob:
  sensor.*thermometer*:
    override_measurement: temperature

In my config. Now I get a node named temperature in Influx and there is a value for the one sensor recognized by influx.