Quellcode durchsuchen

Improve logging of failed operations (#95)

J. Nick Koston vor 1 Jahr
Ursprung
Commit
e248b30429
1 geänderte Dateien mit 2 neuen und 1 gelöschten Zeilen
  1. 2 1
      switchbot/devices/device.py

+ 2 - 1
switchbot/devices/device.py

@@ -423,8 +423,9 @@ class SwitchbotDevice:
     ) -> bool:
         """Check command result."""
         if not result or len(result) - 1 < index:
+            result_hex = result.hex() if result else "None"
             raise SwitchbotOperationError(
-                f"{self.name}: Sending command failed (rssi={self.rssi})"
+                f"{self.name}: Sending command failed (result={result_hex} index={index} expected={values} rssi={self.rssi})"
             )
         return result[index] in values