Skip to content

Commit

Permalink
fix(status): use JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
clementprevot committed Jan 11, 2023
1 parent 7d88b45 commit 7472b56
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,25 @@ The CLI will exit with 0 if a burner is found, 1 otherwise.
python -m pyduro -b <burner IP address> -s <burner serial number> -p <burner pin code> status
```

This will output a list of burner parameters and their values.
The result will be output as a JSON object that you can then manipulate with
`jq` for example.

The CLI will exit with the return code return by the burner (0 = success, >0 =
error).

**Examples**

```bash
python -m pyduro -b 192.168.1.250 -s 1234 -p 12345678 status

> {
> "boiler_temp": "14.9",
> "boiler_ref": "20.0",
> "content": "-2038",
> "dhw_temp": "13.6",
> "dhw_ref": "0.0",
> [...]
> }

### Get information from a burner

Expand Down
8 changes: 4 additions & 4 deletions src/pyduro/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ def main():
if response:
if args.action == "status":
status = response.parse_payload().split(",")
i=0
i = 0
for key in STATUS_PARAMS:
STATUS_PARAMS[key]=status[i]
i+=1
print(str(STATUS_PARAMS))
STATUS_PARAMS[key] = status[i]
i += 1
print(json.dumps(STATUS_PARAMS))
elif args.action == "get":
print(json.dumps(response.parse_payload(), sort_keys=True, indent=2))
else:
Expand Down

0 comments on commit 7472b56

Please sign in to comment.