Skip to content

Commit 0d9837e

Browse files
committed
Organize ignored callbacks into a top-level list
1 parent 2b83b57 commit 0d9837e

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

zigpy_znp/zigbee/application.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,22 @@
7171

7272
REQUEST_RETRYABLE_ERRORS = REQUEST_TRANSIENT_ERRORS | REQUEST_ROUTING_ERRORS
7373

74+
IGNORED_ZDO_CALLBACKS = [
75+
c.ZDO.EndDeviceAnnceInd,
76+
c.ZDO.LeaveInd,
77+
c.ZDO.PermitJoinInd,
78+
c.ZDO.ParentAnnceRsp,
79+
c.ZDO.ConcentratorInd,
80+
c.ZDO.MgmtNWKUpdateNotify,
81+
c.ZDO.MgmtPermitJoinRsp,
82+
c.ZDO.NodeDescRsp,
83+
c.ZDO.SimpleDescRsp,
84+
c.ZDO.ActiveEpRsp,
85+
c.ZDO.MgmtLqiRsp,
86+
c.ZDO.BindRsp,
87+
c.ZDO.UnBindRsp,
88+
]
89+
7490
LOGGER = logging.getLogger(__name__)
7591

7692

@@ -646,23 +662,9 @@ def _bind_callbacks(self) -> None:
646662
)
647663

648664
# Handle messages that we do not use to prevent unnecessary WARNINGs in logs
649-
for ignored_msg in [
650-
c.ZDO.EndDeviceAnnceInd,
651-
c.ZDO.LeaveInd,
652-
c.ZDO.PermitJoinInd,
653-
c.ZDO.ParentAnnceRsp,
654-
c.ZDO.ConcentratorInd,
655-
c.ZDO.MgmtNWKUpdateNotify,
656-
c.ZDO.MgmtPermitJoinRsp,
657-
c.ZDO.NodeDescRsp,
658-
c.ZDO.SimpleDescRsp,
659-
c.ZDO.ActiveEpRsp,
660-
c.ZDO.MgmtLqiRsp,
661-
c.ZDO.BindRsp,
662-
c.ZDO.UnBindRsp,
663-
]:
665+
for ignored_callback in IGNORED_ZDO_CALLBACKS:
664666
self._znp.callback_for_response(
665-
ignored_msg.Callback(partial=True),
667+
ignored_callback.Callback(partial=True),
666668
self.on_intentionally_unhandled_message,
667669
)
668670

0 commit comments

Comments
 (0)