Is it possible to add Tag(s) to KNX measurements?

Hej!

I would like to set a tag to my KNX measured values that contains the name of the room. Is this possible somehow? How else can I find out later where the value comes from without first looking up the group address? How do you Deal with it?

Thanks

You can set static tags in your config: either via global tags or per-input plugin tags in your config, here is an example of both:

[global_tags]
  dc = "us-east-1"

[[inputs.cpu]]
  [inputs.cpu.tags]
    tag1 = "foo"
    tag2 = "bar"

Would that work?

1 Like

Yes, this is exactly what I need in my case. However, I have the problem that the tags do not show up.

  ## Measurement definition(s)
  [[inputs.knx_listener.measurement]]
    #   ## Name of the measurement
    name = "Esszimmer | Temperatur"
    #   ## Datapoint-Type (DPT) of the KNX messages
    dpt = "9.001"
    #   ## List of Group-Addresses (GAs) assigned to the measurement
    addresses = ["7/0/22"]
    [inputs.knx_listener.measurement.tags]
      location = "Esszimmer"

does the Plugin not Support tags or what i am missing?

That looks like what I would expect, but at 5pm on a Friday before a 3 day weekend I’ll admit my eyes might be tired :slight_smile:

Do you have any additional processors, tagpass/tagdrop, or other modifications to the metrics in your config?

If you use the outputs.file output do you see it there?

1 Like

Try this, you shouldn’t need the ‘measurement’ part:

1 Like

this:

  ## Measurement definition(s)
  [[inputs.knx_listener]]
    [inputs.knx_listener.tags]
    location = "Esszimmer"
    [inputs.knx_listener.measurement]
    #   ## Name of the measurement
    name = "Esszimmer | Temperatur"
    #   ## Datapoint-Type (DPT) of the KNX messages
    dpt = "9.001"
    #   ## List of Group-Addresses (GAs) assigned to the measurement
    addresses = ["7/0/22"]

brings me to this:

2023-02-19T20:23:44Z E! error loading config file http://influxdb1:8086/api/v2/telegrafs/0ac44e53e3194000: error parsing data: line 153: array table `inputs.knx_listener.measurement' is in conflict with table in line 144

i think i am missing something …

Thanks for your help
Tim

that works, but i can define this tag only once and alle my measurements get the same location Tag.

Right, any measurement from that input will get that tag. If you want only certain metrics from a measurement to be assigned a tag, your best bet is to use starlark so you can manage the logic.