mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Add missing alarm volume 'normal' (#899)
Also logs a warning in feature repr if value not in choices and fixes the returned string to be consistent with valid values.
This commit is contained in:
@@ -180,7 +180,16 @@ class Feature:
|
||||
|
||||
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]
|
||||
)
|
||||
|
Reference in New Issue
Block a user