I am grabbing data from an xml url and a few variables are not displayed in a number format but as “on” “off” (or “Aus” / “Ein” in German). is there a way to directly read the data in as 0 and 1?
Many thanks for the suggestion. I have tried to implement the enum part but I still get the string error. can you help me out there?
[[outputs.influxdb_v2]]
urls = ["http://192.168.XX.XX:8086"]
## Token for authentication.
token = "XXX"
## Organization is the name of the organization you wish to write to; must exist.
organization = "XX"
## Destination bucket to write into.
bucket = "BAYROL"
tagexclude =["tag2"]
[outputs.influxdb_v2.tagpass]
tag2 = ["BAYROL"]
[[inputs.http]]
urls = ["http://192.168.XX.XX/cgi-bin/webgui.fcgi?xmlitem=35.6028"]
data_format = "xml"
## Multiple parsing sections are allowed
[[inputs.http.xpath]]
metric_selection = "/pm5"
[inputs.http.xpath.tags]
id = "id/@name"
[inputs.http.xpath.fields]
type = "number(/item/@type)"
label = "string(/item/@label)"
unit = "string(/item/@unit)"
value = "number(/item/@value)"
[[processors.enum]]
[[processors.enum.mapping]]
## Name of the field to map. Globs accepted.
field = "_value"
[processors.enum.mapping.value_mappings]
"Ein" = 1
"Aus" = 0
[inputs.http.tags]
tag2 = "BAYROL"
Can’t tell for sure without a sample data point, but something like this should work
[[inputs.http]]
{...}
[[processors.enum]]
[[processors.enum.mapping]]
field = "value"
[processors.enum.mapping.value_mappings]
Ein = 1
Aus = 0
in your example you have interrupted the http.input with the processor, I expect it to don’t even work, or to miss part of the input config (the one after the processor)…