Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test_properties command to device class (#1014)
* Add test_properties command to device class This allows simple testing of available properties, their values & the number of properties that can be requested at once. This is done in two steps: 1. Testing all given properties one by one to see which return non-None values 2. Testing all valid, non-None values at once and removing properties to request on failures to obtain the max_properties value Example output: ``` $ miiocli device --ip <addr> --token <token> test_properties power on off usb_on temperature wifi_led foofoo x Running command test_properties Testing properties ('power', 'on', 'off', 'usb_on', 'temperature', 'wifi_led', 'foofoo', 'x') for zimi.powerstrip.v2 Testing power.. on <class 'str'> Testing on.. None Testing off.. None Testing usb_on.. None Testing temperature.. 46.07 <class 'float'> Testing wifi_led.. off <class 'str'> Testing foofoo.. None Testing x.. None Found 8 valid properties, testing max_properties.. Testing 8 properties at once.. OK for 8 properties Please copy the results below to your report Model: zimi.powerstrip.v2 Total responsives: 8 Total non-empty: 3 All non-empty properties: {'power': 'on', 'temperature': 46.07, 'wifi_led': 'off'} Max properties: 8 Done ``` * Consider empty strings as non-existing properties * Move pformat import to top of the file
- Loading branch information