Filtering data by value

@grant2
quick question I have (I am going through documentation of influxdb and flux): is EVERY measurement completely SEPARATED instance in influxdb?

What I mean is: yes, I have a device that has 20 sensors in it, and I want to see on the graph the value of one of them (i.e. RSSI) depending on another one (i.e. communication type).
But if these 2 measurements (although being from the same device) are completely NOT RELATED then, there is NO way of making such condition - right?
Because there is no relation between “what type of communication it is” and “value of RSSI” - am I getting this right?

In “normal” sql (if I remember it properly from ages ago) I would do something like this:

SELECT (rssi, comm_type) FROM devices WHERE comm_type LIKE "LoRa"

and that would work, provided both rssi and comm_type are in the same row in the database, while in influxdb these are 2 NOT RELATED measurements and they are NOT in the same row - am I getting this right?

From home home assistant, how do you write your data into InluxDB?

Can you show all the tags and fields you use (or each of the groups of sensors/nodes)?

I playing more and more with that now
“Currently” it looks like this as I am testing new idea:

influxdb:
  api_version: 2
  ssl: true
  verify_ssl: false
  host: !secret influxdb2_ip
  port: 8086
  token: !secret influxdb2_token_ha
  organization: !secret influxdb2_org
  bucket: homeassistant
  default_measurement: state
  include:
    domains:
      - binary_sensor
      - device_tracker
      - input_boolean
      - input_number
      - light
      - number
      - sensor
      - switch
      - timer
  component_config_glob:
    sensor.*comm_type:
      override_measurement: communicationtype

and the last 3 lines gave me “communicationtype” as one of the measurements
but still no idea how to get into:
SELECT rssi FROM ... WHERE communicationtype LIKE "LoRa"
:wink:

so I was able to change the sensor.xxx_comm_type into one of the measurements but - I am not sure that was helpful

from doco

Tags are optional. You don’t need to have tags in your data structure, but it’s generally a good idea to make use of them because, unlike fields, tags are indexed. This means that queries on tags are faster and that tags are ideal for storing commonly-queried metadata.
So depends on which things you will be filtering one. Here are some sample line protocols

1 tag

sensors,sensor_type=temperature comm_type=LoRa,temperature=43.3 1687867620000000000
sensors,sensor_type=light comm_type=ESPnow,lux=1300 1687867620000000000
sensors,sensor_type=humidity comm_type=ESPnow,humidity=75% 1687867620000000000
sensors,sensor_type=motion  comm_type=ESPnow,motion=0 1687867620000000000

or

tag sets

sensors,sensor_type=temperature,comm_type=LoRa temperature=43.3 1687867620000000000
sensors,sensor_type=light,comm_type=ESPnow lux=1300 1687867620000000000
sensors,sensor_type=humidity,comm_type=ESPnow humidity=75% 1687867620000000000
sensors,sensor_type=motion,comm_type=ESPnow motion=0 1687867620000000000

that looks super nice but how to get in 1 row both: temperature AND comm_type? or light and comm_type?

you add it :joy: that was just sample design. it is there

sensors,sensor_type=temperature,comm_type=LoRa temperature=43.3 1687867620000000000
sensors,sensor_type=light,comm_type=ESPnow lux=1300 1687867620000000000

or do you mean a single sensor can grab both light and temp at the same time??