Skip to content

Commit 30c4299

Browse files
committed
Guard log failure for responses without mac
1 parent f8e7442 commit 30c4299

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugwise/controller.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,21 @@ def _send_message_loop(self):
226226
# if previous seq_id is unknown use fake b"0000"
227227
seq_id = inc_seq_id(self.last_seq_id)
228228
self.expected_responses[seq_id] = request_set
229+
mac = "None"
230+
if hasattr(self.expected_responses[seq_id][0], "mac"):
231+
mac = self.expected_responses[seq_id][0].mac
229232
if self.expected_responses[seq_id][2] == 0:
230233
_LOGGER.info(
231234
"Send %s to %s using seq_id %s",
232235
self.expected_responses[seq_id][0].__class__.__name__,
233-
self.expected_responses[seq_id][0].mac,
236+
mac,
234237
str(seq_id),
235238
)
236239
else:
237240
_LOGGER.info(
238241
"Resend %s to %s using seq_id %s, retry %s",
239242
self.expected_responses[seq_id][0].__class__.__name__,
240-
self.expected_responses[seq_id][0].mac,
243+
mac,
241244
str(seq_id),
242245
str(self.expected_responses[seq_id][2]),
243246
)

0 commit comments

Comments
 (0)