Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[meta] Add device registry & device factory facilities #1117

Closed
rytilahti opened this issue Aug 13, 2021 · 0 comments · Fixed by #1556
Closed

[meta] Add device registry & device factory facilities #1117

rytilahti opened this issue Aug 13, 2021 · 0 comments · Fixed by #1556
Milestone

Comments

@rytilahti
Copy link
Owner

There is no way to initialize an implementation for the given model, forcing downstreams to hardcode imports & initialization for specific devices. There is also currently no way to obtain a list of supported models, which can be useful for other tasks.

The goal of this issue is two-fold: 1) provide a registry that allows accessing the information about supported devices and 2) provide facilities to allow initializing device-derived implementations for a given host&token combination (with optional model to skip the miIO.info query). This issue depends on #1116.

Potential signature for the factory method:

class Device:
    @classmethod
    def create(cls, host, token, model=None):
        pass
@rytilahti rytilahti added this to the 0.6.0 milestone Aug 13, 2021
rytilahti added a commit that referenced this issue 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
1 participant