dodo5522 / tsmppt60_driver

Interface for controlling and interrogating the TS-MPPT-60 via the remote monitoring port.
4 stars 1 forks source link

Bug! JSON output text strings should use double quotes, not single #11

Open Chewie9999 opened 3 years ago

Chewie9999 commented 3 years ago

I just tried to parse the output with "jq", and it doesn't like single quotes around the text strings. According to the JSON Specification, they should be double quotes. This is probably something I can fix myself easily, I just thought I should let you know. Thanks!

dodo5522 commented 3 years ago

@Chewie9999 Oh... thanks... I'll fix it!

dodo5522 commented 3 years ago

@Chewie9999 Sorry! I want to make this python driver to return all status with dict object. I've added example code to parse as JSON into README like below. I want you to agree with the spec.

$ python -c "from tsmppt60_driver import *; import json; print(json.dumps(SystemStatus('192.168.1.20').get()))" | jq '."Battery Voltage"'

{
  "group": "Battery",
  "value": 28.6,
  "unit": "V"
}
Chewie9999 commented 3 years ago

@Chewie9999 Sorry! I want to make this python driver to return all status with dict object. I've added example code to parse as JSON into README like below. I want you to agree with the spec.

$ python -c "from tsmppt60_driver import *; import json; print(json.dumps(SystemStatus('192.168.1.20').get()))" | jq '."Battery Voltage"'

{
  "group": "Battery",
  "value": 28.6,
  "unit": "V"
}

That's fine with me! I've not started using it in other programs yet. Thank you!