-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(inputs.knx_listener): Allow usage of DPT string representation #15069
Conversation
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this can be set per measurement, this works for me!
Works! |
One problem: https://github.com/influxdata/telegraf/blob/release-1.29/plugins/inputs/knx_listener/README.md "NOTE: You should not assign a group-address (GA) to multiple measurements!" You CAN have a config like this: [[inputs.knx_listener.measurement]]
name = "Alarm3"
dpt = "1.005"
as_string = false
addresses = ["0/2/2"] # Windalarm (Markise)
[[inputs.knx_listener.measurement]]
name = "Alarm3"
dpt = "1.005"
as_string = false
addresses = ["0/2/3", # Windalarm (Raffstores)
"0/2/4"] # Regenalarm Different addresses to the same measurement. But as soon as you set one you get an error:
so this # # ## Use the string representation instead of the numerical value for the
# # ## datapoint-type and the addresses below is not right. for each measurement u must decide if you want to string or boolean. You cannot decide on an address basis. This u should make clear in the comments. |
This is not true. The problem arises because you try to send a field of the same series with two different types. If you distinguish the two, e.g. by using different measurement names or tag-sets, the configuration works. Furthermore, this is a limitation of the output side and e.g. JSON output will work just fine... |
well, pls show me a configuration where u have one (the same) measurement but with different "as_string" settings. |
@userwithoutpassword just a reminder, this is a community driven project, you can ask for help but demanding it the way you do is a bit rude IMO... Anyway, the error is caused by the fact that your database already has the series
The best solution strongly depends on your needs. However, there is nothing Telegraf can do about it! If you change a field type, you will always run into the problem above. |
Exactly. This is i was talking about 2 post earlier. You CANNOT assign different GAs to the same Measurement with different as_string settings. But the comments in the code are suggesting that. "as_string" setting is per Measurement name |
@userwithoutpassword please run the following config based on your example [[inputs.knx_listener.measurement]]
name = "alarm3"
dpt = "1.005"
as_string = false
addresses = ["0/2/2"] # Windalarm (Markise)
[[inputs.knx_listener.measurement]]
name = "alarm3"
dpt = "1.005"
as_string = true
addresses = ["0/2/3", "0/2/4"]
[[outputs.file]]
files = ["stdout"] with
with the correct output. As I said, the error you are seeing is due to the already existing data in your database... |
This is what i got. I used alarm4 an "empty" measurement... The reason is if I set "as_string=false" telegraf will use boolean for DPT1.005. So i cannot push data to the same measurement with as_string=true for another GA but with the same measurement For each measurement you have to decide if you want boolean OR string OR something else. But the code works, just the commenting is a little bit missunderstanding. |
the same with --debug |
@userwithoutpassword I think you do have a misunderstanding here. Let me try again to explain my point. As you can see in your first output the metrics are produced correctly on the input side:
with Now you get the error messages like
This error is produced by the InfluxDB instance not by Telegraf! So you do have an issue with the output side because InfluxDB insists you provide the same type, but this has NOTHING to with the KNX plugin besides that it produces the data by chance. We cannot fix this on the input side because there are other outputs that support this kind of mixed types! This being said, testing InfluxDBv2 you seemingly cannot used mixed types for a field of the same measurement, but again, other outputs work. |
I know this. # # ## Use the string representation instead of the numerical value for the
# # ## datapoint-type and the addresses below is confusing because it's suggesting that you can have different as_string settings for the same measurment, but u cannot. You cannot set as_string per GA, only per measurement. If you want to have one GA as string and the other not u have so use a different measurement. The plugin is working as it should. Its just a hint ;) I have no intend using this in that way. I was only testing with different settings Maybe u add in the comment this limitation when using togehter with influxdb |
But this is true for InfluxDB only and it's not even fully true for v1 which can have different types, one per series IIRC!!! That's why I'm so hesitant to follow your argumentation because then we load input documentation with the limitations of all possible output plugins (and we do have many of those). This would create a precedence-case... |
yeah I understand. The most important thing is that its actually working. And thats the case |
Summary
Some DPT's, especially DPT1.xxx, do have more speaking values in their string representation. Allow the user to choose between the two by introducing a new
as_string
flag.Checklist
Related issues
resolves #15039