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 preferred position functionnality to shutter #499

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

PoppyPop
Copy link
Contributor

Hello,

In the control APP, i have access to a "preferred position" for my shutter.
After some test and digging in the API, i noticed that there is an undocumented value of -2 for this.

Here is a small PR that add the functionnality.

i tested it in my setup and it's working well.
i modified the code, to be backward compatible (low value return -1 as before for example)

Feel free to ask if you need more screenshot or proof of the functionnality

Have a nice day !

FYI, it's the round icon at the right
Screenshot_2024-05-23-10-18-48-78_d79490f7c2b38dc888dbc6c067ae1f9e

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @PoppyPop - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

src/pyatmo/modules/module.py Outdated Show resolved Hide resolved
src/pyatmo/modules/module.py Outdated Show resolved Hide resolved
@@ -84,6 +84,12 @@ def gen_json_data(position):
endpoint="api/setstate",
)

assert await module.async_preferred_position()
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): Test for edge case of target_position < -2

Consider adding a test case to ensure that when target_position is set to a value less than -2, it defaults to -1. This will help verify the backward compatibility and the new functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the test assert await module.async_set_target_position(-10) already cover this

@jabesq jabesq merged commit 6eef5b9 into jabesq-org:development Jun 18, 2024
4 checks passed
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.

None yet

2 participants