Skip to content

Output of --info "Nodes in mesh" to JSON Format#433

Merged
caveman99 merged 3 commits into
meshtastic:masterfrom
mverch67:master
Mar 31, 2023
Merged

Output of --info "Nodes in mesh" to JSON Format#433
caveman99 merged 3 commits into
meshtastic:masterfrom
mverch67:master

Conversation

@mverch67
Copy link
Copy Markdown
Contributor

This is a fix for #416 "Nodes in mesh" is not valid JSON.

The resulting output will look like this:

Nodes in mesh: {"!fa5a06bc": {"num": 4200203964, "user": {"longName": "Meshtastic 06bc", "shortName": "06bc", "macaddr": "f4:12:fa:5a:06:bc", "hwModel": "TLORA_T3_S3"}, "position": {"time": 1680178890}, "lastHeard": 1680178890, "deviceMetrics": {"batteryLevel": 111, "voltage": 4.46, "channelUtilization": 1.78, "airUtilTx": 0.24416666}}, "!55c58b64": {"num": 1439009636, "user": {"longName": "MUGL-8b64", "shortName": "MUGL", "macaddr": "94:b5:55:c5:8b:64", "hwModel": "TBEAM"}, "snr": 6.0, "lastHeard": 1680178620, "deviceMetrics": {"batteryLevel": 88, "voltage": 4.052, "channelUtilization": 3.3933334, "airUtilTx": 0.45066667}}, "!fa5a0688": {"num": 4200203912, "user": {"longName": "NORD-0688", "shortName": "NORD", "macaddr": "f4:12:fa:5a:06:88", "hwModel": "TLORA_T3_S3"}, "snr": 5.5, "lastHeard": 1680178634, "deviceMetrics": {"batteryLevel": 111, "voltage": 4.247, "channelUtilization": 17.903334, "airUtilTx": 2.858639}}, "!fa5a06f8": {"num": 4200204024, "user": {"longName": "Meshtastic 06f8", "shortName": "06f8", "macaddr": "f4:12:fa:5a:06:f8", "hwModel": "TLORA_T3_S3"}, "snr": 5.75, "lastHeard": 1680178675, "deviceMetrics": {"batteryLevel": 111, "voltage": 4.379, "channelUtilization": 11.0, "airUtilTx": 0.4597778}}}

Copy link
Copy Markdown
Member

@caveman99 caveman99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the output is valid JSON now, this is a breaking change from previous versions for people that may parse the output of that command manually. Not sure how to proceed with this or if this is even an issue.

@mverch67
Copy link
Copy Markdown
Contributor Author

mverch67 commented Mar 31, 2023

While the output is valid JSON now, this is a breaking change from previous versions for people that may parse the output of that command manually. Not sure how to proceed with this or if this is even an issue.

I see two options:

1- keep it as it is (see output of PR above) and assume that almost nobody did parse the output so far because it was not valid JSON format

2- revert some modifications of the current PR and provide two different versions of info output :-
a) a more human readable output of the nodes (one line per node, each single line in JSON, but not the complete collection of nodes) which does not differ much from previous versions, like this:

Nodes in mesh:
{"num": 4200203964, "user": {"id": "!fa5a06bc", "longName": "Meshtastic 06bc", "shortName": "06bc", "macaddr": "f4:12:fa:5a:06:bc", "hwModel": "TLORA_T3_S3"}, "position": {"time": 1680254909}, "lastHeard": 1680254909, "deviceMetrics": {"batteryLevel": 111, "voltage": 4.333, "channelUtilization": 3.4499998, "airUtilTx": 0.10986111}}
{"num": 1439009636, "user": {"id": "!55c58b64", "longName": "MUGL-8b64", "shortName": "MUGL", "macaddr": "94:b5:55:c5:8b:64", "hwModel": "TBEAM"}, "snr": -14.25, "deviceMetrics": {"batteryLevel": 82, "voltage": 3.998, "channelUtilization": 10.481667, "airUtilTx": 0.8883889}}
{"num": 4200203912, "user": {"id": "!fa5a0688", "longName": "NORD-0688", "shortName": "NORD", "macaddr": "f4:12:fa:5a:06:88", "hwModel": "TLORA_T3_S3"}, "snr": -14.25, "deviceMetrics": {"batteryLevel": 98, "voltage": 4.188, "channelUtilization": 36.946667, "airUtilTx": 2.9026666}}
{"num": 4200204024, "user": {"id": "!fa5a06f8", "longName": "Meshtastic 06f8", "shortName": "06f8", "macaddr": "f4:12:fa:5a:06:f8", "hwModel": "TLORA_T3_S3"}, "snr": 7.25, "lastHeard": 1680254905, "lastReceived": {"from": 4200204024, "to": 4200203964, "id": 1612893115, "rxTime": 1680254905, "rxSnr": 7.25, "hopLimit": 3, "rxRssi": -51, "fromId": "!fa5a06f8", "toId": "!fa5a06bc"}, "hopLimit": 3}

(this is instantly ready for commit on request)

b) optional: an additional machine readable format provided by --json-info (entire info output in valid JSON format)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants