Skip to content

Commit e248b30

Browse files
authored
Improve logging of failed operations (#95)
1 parent dc97b48 commit e248b30

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

switchbot/devices/device.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,9 @@ def _check_command_result(
423423
) -> bool:
424424
"""Check command result."""
425425
if not result or len(result) - 1 < index:
426+
result_hex = result.hex() if result else "None"
426427
raise SwitchbotOperationError(
427-
f"{self.name}: Sending command failed (rssi={self.rssi})"
428+
f"{self.name}: Sending command failed (result={result_hex} index={index} expected={values} rssi={self.rssi})"
428429
)
429430
return result[index] in values
430431

0 commit comments

Comments
 (0)