From 07d6d9deaebae61438a0c49d3d02f1023ccfec6e Mon Sep 17 00:00:00 2001 From: Florent Date: Sat, 3 May 2025 18:29:40 +0200 Subject: [PATCH] telemetry --- pyproject.toml | 4 ++-- src/meshcore_cli/meshcore_cli.py | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f0367a4..2d2468a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore-cli" -version = "1.0.0rc1" +version = "0.8.0.dev1" authors = [ { name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, ] @@ -17,7 +17,7 @@ classifiers = [ ] license = "MIT" license-files = ["LICEN[CS]E*"] -dependencies = [ "meshcore >= 1.9.7", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ] +dependencies = [ "meshcore >= 1.9.8.dev1", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ] [project.urls] Homepage = "https://github.com/fdlamotte/meshcore-cli" diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index 7580baf..1e10e45 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -243,6 +243,7 @@ def make_completion_dict(contacts, to=None): "cmd" : contact_list, "req_status" : contact_list, "logout" : contact_list, + "req_telemetry" : contact_list, "set" : { "name" : None, "pin" : None, @@ -285,6 +286,7 @@ def make_completion_dict(contacts, to=None): "upload_contact" : None, "reset_path" : None, "change_path" : None, + "req_telemetry" : None, }) if to['type'] > 1 : # repeaters and room servers @@ -300,6 +302,7 @@ def make_completion_dict(contacts, to=None): "reboot" : None, "start ota" : None, "password" : None, + "neighbours" : None, "get" : {"name" : None, "role":None, "radio" : None, @@ -521,8 +524,9 @@ Line starting with \"$\" or \".\" will issue a meshcli command. line == "rp" or line == "reset_path" or\ line == "contact_info" or line == "ci" or\ line == "req_status" or line == "rs" or\ + line == "req_telemetry" or line == "rt" or\ line == "path" or\ - line == "logout" ): + line == "logout" ) : args = [line, contact['adv_name']] await process_cmds(mc, args) @@ -1010,6 +1014,15 @@ async def next_cmd(mc, cmds, json_output=False): else : print(json.dumps(res.payload, indent=4)) + case "req_telemetry" | "lt" : + argnum = 1 + await mc.ensure_contacts() + contact = mc.get_contact_by_name(cmds[1]) + res = await mc.commands.send_statusreq(contact) + logger.debug(res) + if res.type == EventType.ERROR: + print(f"Error while requesting telemetry") + case "contacts" | "list" | "lc": res = await mc.commands.get_contacts() logger.debug(json.dumps(res.payload,indent=4))