telemetry

This commit is contained in:
Florent 2025-05-03 18:29:40 +02:00
parent 3e9df2f05f
commit 07d6d9deae
2 changed files with 16 additions and 3 deletions

View file

@ -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"

View file

@ -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))