Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add missing alarm volume 'normal' #899

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 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion kasa/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,16 @@ def __repr__(self):

if self.type == Feature.Type.Choice:
if not isinstance(choices, list) or value not in choices:
return f"Value {value} is not a valid choice ({self.id}): {choices}"
_LOGGER.warning(
"Invalid value for for choice %s (%s): %s not in %s",
self.name,
self.id,
value,
choices,
)
return (
f"{self.name} ({self.id}): invalid value '{value}' not in {choices}"
)
value = " ".join(
[f"*{choice}*" if choice == value else choice for choice in choices]
)
Expand Down
2 changes: 1 addition & 1 deletion kasa/smart/modules/alarmmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _initialize_features(self):
attribute_setter="set_alarm_volume",
category=Feature.Category.Config,
type=Feature.Type.Choice,
choices=["low", "high"],
choices=["low", "normal", "high"],
)
)
self._add_feature(
Expand Down