From f8206dc2c8cb7d42e3695362cf99be3e00897326 Mon Sep 17 00:00:00 2001 From: gustonator Date: Mon, 12 Jun 2023 12:19:47 +0200 Subject: [PATCH] fixed script for locating and identifying inverters --- scripts/inverter_scan.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/inverter_scan.py b/scripts/inverter_scan.py index 9ad3913..6a6219e 100644 --- a/scripts/inverter_scan.py +++ b/scripts/inverter_scan.py @@ -11,14 +11,14 @@ logging.basicConfig( format="%(asctime)-15s %(funcName)s(%(lineno)d) - %(levelname)s: %(message)s", stream=sys.stderr, - level=getattr(logging, "DEBUG", None), + level=getattr(logging, "INFO", None), ) def try_command(command, ip): print(f"Trying command: {command}") try: - response = asyncio.run(ProtocolCommand(bytes.fromhex(command), lambda x: True).execute(result[0])) + response = asyncio.run(ProtocolCommand(bytes.fromhex(command), lambda x: True).execute(result[0], timeout=2, retries=0)) print(f"Response to {command} command: {response.hex()}") except InverterError as err: print(f"No response to {command} command") @@ -59,7 +59,7 @@ def omnik_command(logger_sn): sn = "".join(reversed([sn[i:i + 2] for i in range(0, len(sn), 2)])) try_command(omnik_command(sn), result[0]) -print(f"Identifying inverter at IP: {result[0]}") +print(f"\n\nIdentifying inverter at IP: {result[0]}, name: {result[2]} mac: {result[1]}") inverter = asyncio.run(goodwe.discover(result[0])) print( f"Identified inverter model: {inverter.model_name}, serialNr: {inverter.serial_number}"