-
Notifications
You must be signed in to change notification settings - Fork 5
Feat: Enable support for snoo sleepytime timeout levels #46
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1a9b50f
Enable support for snoo sleepytime timeout levels with enum provide v…
lexiconzero d9e51f1
Update python_snoo/snoo.py
lexiconzero a84c8ba
Update containers.py
lexiconzero 3e263b5
Fix up linting as suggested
lexiconzero 8a74f0c
Fix ordering of imports
lexiconzero 04f2612
Update snoo.py
lexiconzero 2e100ec
Update python_snoo/snoo.py
lexiconzero fa2232f
Update snoo.py for linter
lexiconzero e8f7697
trailing comma for linter
lexiconzero 27d4a75
chore: lint
Lash-L File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So walk me through it - what is the benefit of this IntEnum opposed to just passing in a int? Does Snoo only accept specific values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Readability and "app feeling" cloning was the idea - I basically just replicated the setup for the snoo levels. I believe the API just wants an integer, however the app only provides it in 5 minute increments. I don't like passing magic numbers around hence the enum class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay not completely against it - but you will have to see how this feels when you are adding it on the core side. It may be good to accept the IntEnum | int just to make your life easier in the function just in case you need to pivot.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When writing the HA core code, I had to replicate the structure over to the strings file to get it to look good for the UI - so realistically that code is now duplicated. I thought that I could just let the HA UI handle it, but then it would have that logic only in HA, leaving python_snoo with a potential foot-gun should someone decide to pass 190 minutes through to the API.
I'm happy either way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may simplify things?
https://developers.home-assistant.io/blog/2024/01/19/entity-translations-placeholders/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realized this does not allow for translation placeholders in options...
Will approve for now, but we will see what the actual core implementation looks like and what the HA devs think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will have a crack at it! Thanks!