Skip to content
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

Input-plugin for KNX home-automation bus #7048

Merged
merged 35 commits into from
Mar 18, 2021

Conversation

DocLambda
Copy link
Contributor

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

This pull request adds an input-plugin for the KNX standard used in home and building automation. Using a KNX-IP interface it is possible to wait for messages on that bus and handle them with the full power of telegraf.

As I'm pretty new to golang I like to get comments on the code especially:

  1. What needs to be done to get this merged?
  2. What can be simplified and/or written more go-ish?
  3. Is the config acceptable or do you have any better idea about the layout?

I'm aware that some things (especially in knx_helpers.go) belong to the underlying knx-go project. Some things are already on their way but might need time, so bear with me on this end...

Looking forward to suggestions, critics, comments...

@ssoroka ssoroka self-requested a review February 19, 2020 20:24
Copy link
Contributor

@ssoroka ssoroka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks pretty good. I've reviewed it mostly from the perspective of whether or not it looks like typical Go code, and left some comments related to that. They're mostly low priority, but would be nice to have.
I'll get another team member to look it over for any other concerns.
Thanks!

plugins/inputs/knx_listener/knx_helpers.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_helpers.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_helpers.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_helpers.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_helpers.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_helpers.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_listener.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_listener_test.go Outdated Show resolved Hide resolved
@ssoroka ssoroka requested a review from danielnelson February 20, 2020 19:51
@LukasGrebe
Copy link

LukasGrebe commented Nov 18, 2020

Hi, what is the status of this Plugin?

I'd like to push IoT Data from a KNX Bus to Influx cloud.

it looks like there is an outstanding review, and also a failing integration test but that hasn't changed since February.

Copy link

@LukasGrebe LukasGrebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked though the readme and found a typo

plugins/inputs/knx_listener/README.md Outdated Show resolved Hide resolved
@DocLambda
Copy link
Contributor Author

@LukasGrebe I'll try to vamp up the code ad now there is potentially another user. :-) I have one request to you as I'm not sure about the config layout. Is this ok for you or can you think of anything better? Especially the grouping in measurements is unusual I guess... :-)

@LukasGrebe
Copy link

LukasGrebe commented Nov 22, 2020

@LukasGrebe … about the config layout. Is this ok for you or can you think of anything better? Especially the grouping in measurements is unusual I guess... :-)

seems fine to me. maybe two thoughts:

  1. It'd be nice to add arbitrary tags to a specific measurement or KNX groups - eg a room name/building section or other metadata

  2. Wildcards in GAs would be useful as the Groups usually follow some sort of schema. eg "5/5/" or "5//2" instead of listing a huge array of GAs

combining 1 and 2 it would be great to have the KNX ids (GA, source) as individual tags in influxDB. eg. a Telegram from Source "1.2.3" to GA "4/5/6" would have 6 tags in Influx:
3 tags from the Physical Adress

  1. area=1
  2. line=2
  3. bus device=3

and 3 tags from the group address

  1. main group=4
  2. middle group=5
  3. sub group=6

(leaving other group address structures open for future improvements maybe)

this would allow arbitrary groupings for measurements in influxDB Queries as any desired data grouping could be achieved though these metadata labels. - but i'm new to influx. maybe this could be achieved with placeholders/partial matching of tag values in influxdb queries?

@LukasGrebe
Copy link

i'm missing dpt 7.X - 2-Octet Unsigned Value
specifically: Time Period - DPT_TimePeriodHrs 7.007 unit: h

If i understand vapourismo/knx-go#7 correctly, the data[] of https://godoc.org/github.com/vapourismo/knx-go/knx#GroupEvent could be used to work with 7.007h, albeit missing some convenience functions. - i'm not sure how to proceed here

@LukasGrebe
Copy link

@LukasGrebe I'll try to vamp up the code ad now there is potentially another user. :-)

id love to help with the unsuccessful CI checks.

continuous-integration/appveyor/pr — AppVeyor was unable to build non-mergeable pull request

but i wouldn't know where to start. I'm currently running telegraf on a dev machine, but id love to move it to a docker container on a server machine. Unfortunately i'm not allowed to run custom builds of Telegraf on that mashine, so i'd really appreciate this being part of the official repo.

@DocLambda DocLambda changed the title [RFC] Input-plugin for KNX home-automation bus Input-plugin for KNX home-automation bus Dec 7, 2020
@DocLambda
Copy link
Contributor Author

@LukasGrebe did my best to make it in time. :-) Will try to get things in time but no promises. If you want to help, I found that some DPTs are missing in the registry of the upstream library, especially in the 14.xxx range...

Copy link
Collaborator

@zak-pawel zak-pawel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to add proper line to LICENSE_OF_DEPENDENCIES.md (as make check-deps suggests)

plugins/inputs/knx_listener/README.md Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/README.md Show resolved Hide resolved
plugins/inputs/knx_listener/knx_listener.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_listener.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_listener.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_listener.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_listener.go Outdated Show resolved Hide resolved
plugins/inputs/knx_listener/knx_listener.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@zak-pawel zak-pawel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@zak-pawel zak-pawel added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jan 21, 2021
@sjwang90 sjwang90 added the plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins label Jan 22, 2021
@DocLambda
Copy link
Contributor Author

For the sake of completeness: The CI errors are (old) surricata and grok ones not originating from this plugin.

@DocLambda DocLambda requested review from ssoroka and removed request for danielnelson January 28, 2021 10:07
Comment on lines 128 to 144
go kl.listen()

return nil
}

func (kl *KNXListener) Stop() {
if kl.client != nil {
kl.client.Close()
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there perhaps be a waitGroup used here and wait() called in the Stop() method so that listen() can be allowed to finish what it's doing if it's in the middle of something?

Copy link
Contributor

@ivorybilled ivorybilled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm

@DocLambda DocLambda force-pushed the input/knx_listener branch from 3930267 to 2724d5b Compare March 4, 2021 07:35
@srebhan
Copy link
Member

srebhan commented Mar 4, 2021

!retry-failed

@srebhan srebhan requested a review from ivorybilled March 4, 2021 08:12
@DocLambda DocLambda force-pushed the input/knx_listener branch from 2724d5b to ea5b502 Compare March 17, 2021 07:38
@srebhan
Copy link
Member

srebhan commented Mar 17, 2021

!retry-failed

1 similar comment
@srebhan
Copy link
Member

srebhan commented Mar 18, 2021

!retry-failed

@reimda reimda merged commit 1eb47e2 into influxdata:master Mar 18, 2021
jblesener pushed a commit to jblesener/telegraf that referenced this pull request Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants