Update extract_gateway3_homekey.py

This commit is contained in:
patman15
2025-01-02 10:37:34 +01:00
parent f6ec17c9b2
commit f2ad61a016

View File

@@ -17,6 +17,7 @@ def create_request(sid: int, cid: int, sequence_id: int, data: bytes) -> bytes:
def decode_response(packet: bytes) -> dict[str, Any]: def decode_response(packet: bytes) -> dict[str, Any]:
"""Decode a response frame from the PowerView protocol."""
if len(packet) < 4: if len(packet) < 4:
raise ValueError("Packet size too small") raise ValueError("Packet size too small")
sid, cid, sequence_id, length = struct.unpack("<BBBB", packet[0:4]) sid, cid, sequence_id, length = struct.unpack("<BBBB", packet[0:4])
@@ -66,7 +67,7 @@ def get_shade_key(hub: str, ble_name) -> bytes:
def main(hub: str) -> None: def main(hub: str) -> None:
"""Main function, extract homekeys from all shades.""" """Extract the homekeys from all shades."""
try: try:
shades_resp: requests.Response = requests.get( shades_resp: requests.Response = requests.get(
hub + "/home/shades", timeout=TIMEOUT hub + "/home/shades", timeout=TIMEOUT