self telemetry

This commit is contained in:
Florent 2025-06-02 14:38:52 +02:00
parent b524da69d0
commit 68d056809c
2 changed files with 17 additions and 2 deletions

View file

@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "meshcore-cli"
version = "1.0.0"
version = "1.0.1"
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.9", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ]
dependencies = [ "meshcore >= 1.9.10", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ]
[project.urls]
Homepage = "https://github.com/fdlamotte/meshcore-cli"

View file

@ -246,6 +246,7 @@ def make_completion_dict(contacts, to=None):
"req_status" : contact_list,
"logout" : contact_list,
"req_telemetry" : contact_list,
"self_telemetry" : None,
"set" : {
"name" : None,
"pin" : None,
@ -1152,6 +1153,19 @@ async def next_cmd(mc, cmds, json_output=False):
else :
print(json.dumps(res.payload, indent=4))
case "self_telemetry" | "t":
res = await mc.commands.get_self_telemetry()
logger.debug(res)
if res.type == EventType.ERROR:
print(f"Error while requesting telemetry")
elif res is None:
if json_output :
print(json.dumps({"error" : "Timeout waiting telemetry"}))
else:
print("Timeout waiting telemetry")
else :
print(json.dumps(res.payload, indent=4))
case "req_telemetry" | "rt" :
argnum = 1
await mc.ensure_contacts()
@ -1556,6 +1570,7 @@ def command_help():
chat_to <ct> : enter chat with contact to
script <filename> : execute commands in filename
infos : print informations about the node i
self_telemetry : print own telemtry t
card : export this node URI e
ver : firmware version v
reboot : reboots node