python-miio icon indicating copy to clipboard operation
python-miio copied to clipboard

Add common API for constructing device instances, improve introspection

Open rytilahti opened this issue 3 years ago • 0 comments

New class methods in Device:

  • all_supported_models() to return a dictionary model=>implementation class
  • class_for_model(model: str) to return implementation class for the given model
  • create(host: str, token: str, model: Optional[str]) to create a device instance

New cli commands:

  • miiocli supported-models will print a list of supported models

TBD:

  • [x] Tests
  • [ ] Extract the factory into its own class
  • [ ] Update README and docs for changes

Fixes #1117

rytilahti avatar Feb 19 '22 05:02 rytilahti