Skip to content

Conversation

@rytilahti
Copy link
Owner

@rytilahti rytilahti commented Feb 19, 2022

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:

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

Fixes #1117

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
* Add wildcard support (required for yeelight to avoid I/O for supported models)
* Do not overwrite existing implementations (required for gateway/airconditioningcompanion clash)
* Fix supported devices for airfresh, airconditioningcompanion subclasses
@rytilahti rytilahti force-pushed the feat/device_for_model branch from f7e575a to f069a0b Compare March 8, 2022 00:33
@rytilahti
Copy link
Owner Author

Superseded by #1556

@rytilahti rytilahti closed this Oct 23, 2022
@rytilahti rytilahti deleted the feat/device_for_model branch October 23, 2022 20:23
rytilahti added a commit that referenced this pull request Oct 23, 2022
This will make it simple for downstream users to construct device
instances for all supported devices given only the host and its token.

All device subclasses register themselves automatically to the factory.
The create(host, token, model=None) class method is the main entry point
to use this.

Supersedes #1328
Fixes #1117
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.

[meta] Add device registry & device factory facilities

2 participants