diff --git a/pyproject.toml b/pyproject.toml index be8c43c..cf5da86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore-cli" -version = "1.1.35" +version = "1.1.36" authors = [ { name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, ] diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index 8c68955..18fe26b 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -2568,7 +2568,16 @@ async def main(argv): logger.info(f"Couldn't find device {address}") return - mc = await MeshCore.create_ble(address=address, device=device, client=client, debug=debug, only_error=json_output, pin=pin) + try : + mc = await MeshCore.create_ble(address=address, device=device, client=client, debug=debug, only_error=json_output, pin=pin) + except ConnectionError : + logger.info("Error while connecting, retrying once ...") + try : + mc = await MeshCore.create_ble(address=address, device=device, client=client, debug=debug, only_error=json_output, pin=pin) + except ConnectionError : + logger.error("Can't connect to node, exiting") + return + # Store device address in configuration if os.path.isdir(MCCLI_CONFIG_DIR) :