Skip to content

Commit 6ce31d7

Browse files
committed
Do not log warnings for frequently unhandled commands (fixes #75)
1 parent 7c4f13b commit 6ce31d7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

zigpy_znp/zigbee/application.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,30 @@ def _bind_callbacks(self) -> None:
830830
c.ZDO.PermitJoinInd.Callback(partial=True), self.on_zdo_permit_join_message
831831
)
832832

833+
# No-op handle commands that just create unnecessary WARNING logs
834+
self._znp.callback_for_response(
835+
c.ZDO.ParentAnnceRsp.Callback(partial=True),
836+
self.on_intentionally_unhandled_message,
837+
)
838+
839+
self._znp.callback_for_response(
840+
c.ZDO.ConcentratorInd.Callback(partial=True),
841+
self.on_intentionally_unhandled_message,
842+
)
843+
844+
self._znp.callback_for_response(
845+
c.ZDO.MgmtNWKUpdateNotify.Callback(partial=True),
846+
self.on_intentionally_unhandled_message,
847+
)
848+
849+
def on_intentionally_unhandled_message(self, msg: t.CommandBase) -> None:
850+
"""
851+
Some commands are unhandled but frequently sent by devices on the network. To
852+
reduce unnecessary logging messages, they are given an explicit callback.
853+
"""
854+
855+
pass
856+
833857
def on_zdo_permit_join_message(self, msg: c.ZDO.PermitJoinInd.Callback) -> None:
834858
"""
835859
Coordinator join status change message. Only sent with Z-Stack 1.2 and 3.0.

0 commit comments

Comments
 (0)