Skip to content

Create a States class to ease state access#17

Merged
tetienne merged 3 commits intomasterfrom
feature/add-states-model
Jul 24, 2020
Merged

Create a States class to ease state access#17
tetienne merged 3 commits intomasterfrom
feature/add-states-model

Conversation

@tetienne
Copy link
Copy Markdown
Collaborator

@tetienne tetienne commented Jul 24, 2020

Allow this kind of syntax:

        devices = await client.get_devices()

        for device in devices:
            if device.states:
                if "core:RSSILevelState" in device.states:
                    print(device.states["core:RSSILevelState"].name)
                    print(device.states["core:RSSILevelState"].value)

@tetienne tetienne requested a review from iMicknl July 24, 2020 12:31
Copy link
Copy Markdown
Owner

@iMicknl iMicknl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement! Would be good to also do this for CommandDefinition as well.

And my personal preference is to have a .get() function.

@tetienne
Copy link
Copy Markdown
Collaborator Author

tetienne commented Jul 24, 2020

@iMicknl Code updated, you should like :)

@tetienne tetienne marked this pull request as draft July 24, 2020 13:16
@iMicknl
Copy link
Copy Markdown
Owner

iMicknl commented Jul 24, 2020

@iMicknl Code updated, you should like :)

LGTM! I see you marked it as a draft, so I will let you merge it yourself when you are ready :).

@tetienne
Copy link
Copy Markdown
Collaborator Author

Yes I saw a potential issue for the command in operator. I have to check.

@tetienne tetienne marked this pull request as ready for review July 24, 2020 21:03
@tetienne tetienne merged commit d31671b into master Jul 24, 2020
@tetienne tetienne deleted the feature/add-states-model branch July 24, 2020 21:04
@iMicknl
Copy link
Copy Markdown
Owner

iMicknl commented Jul 24, 2020

@tetienne we should pin the version in the component and bump it here. Now an update to master can break the component.

Looks like it did now?

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.

2 participants