Improve dimmer support (#62)

* discover dimmers properly

* fix circular import, hopefully

* add is_color to SmartDevice API

* allow changing the dimming without implicitly turning the device on

* Add tests for device type handling for discovery data, make sure new fixtures are added to categories inside conftest
This commit is contained in:
Teemu R
2020-05-20 21:17:33 +02:00
committed by GitHub
parent e37244de0f
commit 012436c494
7 changed files with 71 additions and 8 deletions

View File

@@ -1,8 +1,7 @@
"""Module for dimmers (currently only HS220)."""
from typing import Any, Dict
from kasa import DeviceType, SmartDeviceException
from kasa.smartdevice import requires_update
from kasa.smartdevice import DeviceType, SmartDeviceException, requires_update
from kasa.smartplug import SmartPlug
@@ -61,7 +60,6 @@ class SmartDimmer(SmartPlug):
if not isinstance(value, int):
raise ValueError("Brightness must be integer, " "not of %s.", type(value))
elif 0 <= value <= 100:
await self.turn_on()
await self._query_helper(
"smartlife.iot.dimmer", "set_brightness", {"brightness": value}
)