rgerganov / py-air-control

Command line app for controlling Philips air purifiers
MIT License
256 stars 52 forks source link

Add --status option to return single value #54

Open martin-g-it opened 3 years ago

martin-g-it commented 3 years ago

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 commented 3 years ago

Example output (coap protocol) image

rgerganov commented 3 years ago

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

martin-g-it commented 3 years ago

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 commented 3 years ago

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

Cyber1000 commented 3 years ago

@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: