Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --status option to return single value #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martin-g-it
Copy link
Contributor

Added the option --status to return single status value.

Useful to retrieve single values to update ie. Domoticz custom sensors.
Option should work for plain_coap and coap; not included for plain http (class HTTPAirCli)
Tested and working for CoAPCli class; the PlainCoAPAirCli class / protocol I cannot test.

Added the option --status to return single status value.

Useful to retrieve single values to update ie. Domoticz custom sensors.
Option should work for plain_coap and coap; not included for plain http (class HTTPAirCli)
Tested  and working for CoAPCli class; the PlainCoAPAirCli class / protocol I cannot test.
@martin-g-it
Copy link
Contributor Author

Example output (coap protocol)
image

@rgerganov
Copy link
Owner

Not sure about this. Why not simply grep the key you are looking for?

@martin-g-it
Copy link
Contributor Author

Agree, in fact it would be even better if the -d (debug) would only spit out a true JSON (with " quotes instead of ')
Or have this status printed upon a arg like -json

@martin-g-it
Copy link
Contributor Author

image
also the cl (Child Lock) value should then be within quotes instead of plain True/False

@Cyber1000
Copy link
Contributor

Cyber1000 commented Mar 31, 2021

@martin-g-it
I did a bigger refactoring in #81 (formatting is done in a single base class, so only one entry point in the future).
Beside the uppercase "False" this is valid json, but I've looked into this and will make a new PR after my PR is merged.

Just to mention this:

  • false/true without quotes is a boolean in json and is correct -> see boolean-datatype in https://www.w3schools.com/js/js_json_datatypes.asp
  • actually it should be lowercase: true/false instead of True/False
  • instead of pprint we should use something like print(json.dumps(status, indent=4))
    • this doesn't change/uppercase the values, so false will stay false (instead of False, which is caused by pprint)

@Cyber1000 Cyber1000 mentioned this pull request Mar 31, 2021
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.

3 participants