mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-12-02 06:08:17 +00:00
Correct Quality Issues
- Fix: Decrease log message severity in `feature.py`. - Fix: Rename `_set_range_cli` to `_set_range_from_str`. - Add: Basic tests for string to Motion Range value converter function.
This commit is contained in:
@@ -279,7 +279,7 @@ class Feature:
|
||||
|
||||
if self.type == Feature.Type.Choice:
|
||||
if not isinstance(choices, list):
|
||||
_LOGGER.critical(
|
||||
_LOGGER.error(
|
||||
"Choices are not properly defined for %s (%s). Type: <%s> Value: %s", # noqa: E501
|
||||
self.name,
|
||||
self.id,
|
||||
|
||||
@@ -124,7 +124,7 @@ class Motion(IotModule):
|
||||
name="Motion Sensor Range",
|
||||
icon="mdi:motion-sensor",
|
||||
attribute_getter="range",
|
||||
attribute_setter="_set_range_cli",
|
||||
attribute_setter="_set_range_from_str",
|
||||
type=Feature.Type.Choice,
|
||||
choices_getter="ranges",
|
||||
category=Feature.Category.Config,
|
||||
@@ -336,7 +336,7 @@ class Motion(IotModule):
|
||||
)
|
||||
return Range[value]
|
||||
|
||||
async def _set_range_cli(self, input: str) -> dict:
|
||||
async def _set_range_from_str(self, input: str) -> dict:
|
||||
value = self._parse_range_value(input)
|
||||
return await self.set_range(range=value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user