Skip to content

Commit 7fdfe29

Browse files
authored
Handle unknown frames as exception handling. (#63)
1 parent 8f39450 commit 7fdfe29

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

zigpy_deconz/api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,11 @@ def _api_frame(self, name, *args):
149149
return data
150150

151151
def data_received(self, data):
152-
if data[0] not in self._commands_by_id:
153-
LOGGER.debug("Unknown command received: %s", data[0])
152+
try:
153+
command = self._commands_by_id[data[0]]
154+
except KeyError:
155+
LOGGER.debug("Unknown command received: 0x%02x", data[0])
154156
return
155-
command = self._commands_by_id[data[0]]
156157
seq = data[1]
157158
try:
158159
status = STATUS(data[2])

0 commit comments

Comments
 (0)