Skip to content

RFC: Add a script to simplify finding supported properties for miio #919

@rytilahti

Description

@rytilahti

Inspired by #808 (comment), I think it could be a good idea to have a simple script (miiotester.py stored under devtools? or simply as a command for Device?) to automate checking what a target device (i.e., which properties, and how many can be requested using a single request) supports.

This script would take a host, its token and a list of properties to test against it, so executing something like:

<tester> --host 192.168.1.2 --token 123123123 is_mop some_nonexisting_property mode water_percent some_string_property 

would query each property one by one to find out which return a valid value / do not raise an exception.
After that, the script would find out how many properties can be requested at once (to find out max_properties).

The output for this script would look something like:

# Checking for properties supported by '<model name from info()>'...

Testing 'is_mop'
<< 0

Testing 'some_nonexisting_property'
<DISPLAY THE EXCEPTION / FAILED>

Testing 'mode'
<< 4

Testing 'water_percent'
<< 123

Testing 'some_string_property'
<< "hi"

Found properties: ["is_mop", "mode", "water_percent"]

# Finding out how many properties can be requested at once...

Trying to query ["is_mop", "mode", "water_percent"]..
>> <exception / invalid number of response elements>

Trying to query ["is_mop", "mode"]..
>> [1, 4]

Maximum number of properties to query at once: 2

# Summary
* '<model>' supports properties: ["is_mop", "mode", "water_percent"]
* Maximum number of properties per request: 2

@syssi I have seen you requesting users to use raw_command on set of properties to help adding and improving support for devices, what do you think?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions