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

Add a SceneManager utility class #58

Open
mhthies opened this issue May 15, 2022 · 0 comments
Open

Add a SceneManager utility class #58

mhthies opened this issue May 15, 2022 · 0 comments
Labels
feature A new feature

Comments

@mhthies
Copy link
Owner

mhthies commented May 15, 2022

The idea is to create SceneManager objects, that somehow behave like KNX scenes: You connect a number of connectable objects to the SceneManager (which provides any number of subscribable + reading connectors). Than you can call a method to store the current value of the connected objects as a "scene" with a specific number. Later, you can call another method to recall a stored scene, i.e. publish the stored value to all connected scenes.

The SceneManager should ensure persistence of the stored scenes somehow, e.g. using the JSON-representation of the stored values and writing it to a file (or some other persistent store).

The interface would look like this:

class SceneManager:
    def __init__(persistence_file: Path): ...
    def connector(type_: Type[T], name: str) -> SceneConnector: ...
    async def store_scene(scene_number: int) -> None: ...
    async def recall_scene(scene_number: int) -> None: ...

class SceneConnector(Reading[T], Subscribable[T], Generic[T]): ...

Maybe, there might also be a current_scene connector which allows to read, write and subscribe to the currently selected scene as an int value. In this case, it would also be nice if the SceneConnectors would be writable as well and the scene manager would update the current_scene value if the current values of the connected objects (coincidentally) resemble a specifc stored scene.

@mhthies mhthies added the feature A new feature label May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

No branches or pull requests

1 participant