Skip to content

Commit

Permalink
Skip GroupRead events when listening for messages
Browse files Browse the repository at this point in the history
This avoids additional metrics with the address of the requesting device
and value `0` for configured group addresses.
  • Loading branch information
chr-fritz committed Oct 13, 2024
1 parent e7993ac commit c720917
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/knx/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ func (l *listener) handleEvent(event knx.GroupEvent) {
return
}

if event.Command == knx.GroupRead {
logger.Debug("Skip group event as it is a GroupRead message.")
return
}

value, err := unpackEvent(event, addr)
logger = logger.With("dpt", addr.DPT)

Expand Down
6 changes: 6 additions & 0 deletions pkg/knx/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ func Test_listener_Run(t *testing.T) {
nil,
true,
},
{
"group read event",
knx.GroupEvent{Destination: cemi.GroupAddr(6), Command: knx.GroupRead, Data: []byte{0}},
nil,
true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit c720917

Please sign in to comment.