mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +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:
parent
f063c83378
commit
50b5107f75
@ -180,7 +180,16 @@ class Feature:
|
|||||||
|
|
||||||
if self.type == Feature.Type.Choice:
|
if self.type == Feature.Type.Choice:
|
||||||
if not isinstance(choices, list) or value not in choices:
|
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(
|
value = " ".join(
|
||||||
[f"*{choice}*" if choice == value else choice for choice in choices]
|
[f"*{choice}*" if choice == value else choice for choice in choices]
|
||||||
)
|
)
|
||||||
|
@ -64,7 +64,7 @@ class AlarmModule(SmartModule):
|
|||||||
attribute_setter="set_alarm_volume",
|
attribute_setter="set_alarm_volume",
|
||||||
category=Feature.Category.Config,
|
category=Feature.Category.Config,
|
||||||
type=Feature.Type.Choice,
|
type=Feature.Type.Choice,
|
||||||
choices=["low", "high"],
|
choices=["low", "normal", "high"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self._add_feature(
|
self._add_feature(
|
||||||
|
Loading…
Reference in New Issue
Block a user