Add a --json flag to the read, dump, and scan commands that outputs results as JSON instead of Rich tables.
This would allow piping into jq or other tools:
modbus read 192.168.1.10 40001 -c 5 --json | jq '.registers[].value'
Suggested JSON schema for read:
{
"host": "192.168.1.10",
"type": "holding",
"slave": 1,
"registers": [
{"address": 40001, "raw": 237, "value": "237"}
]
}
Good first contribution. The logic is in modbus_cli/cli.py.
Add a
--jsonflag to theread,dump, andscancommands that outputs results as JSON instead of Rich tables.This would allow piping into
jqor other tools:Suggested JSON schema for
read:{ "host": "192.168.1.10", "type": "holding", "slave": 1, "registers": [ {"address": 40001, "raw": 237, "value": "237"} ] }Good first contribution. The logic is in
modbus_cli/cli.py.