mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-13 10:58:02 +00:00
Move dimmer support to its own class (#34)
* Move dimmer support to its own class SmartDimmer extends SmartPlug with brightness settings. This will make the API of SmartPlug less confusing and will make it simpler to downstream users to act with dimmers. Fixes #33 * Lint & make tests pass * Fix rebase after cache and emeter cleanups, hopefully everything went smoothly.. * oopsie, has_emeter was mistakenly included in smartplug
This commit is contained in:
@@ -29,6 +29,7 @@ class DeviceType(Enum):
|
||||
Plug = 1
|
||||
Bulb = 2
|
||||
Strip = 3
|
||||
Dimmer = 4
|
||||
Unknown = -1
|
||||
|
||||
|
||||
@@ -583,6 +584,11 @@ class SmartDevice:
|
||||
"""Return True if the device is a strip."""
|
||||
return self._device_type == DeviceType.Strip
|
||||
|
||||
@property
|
||||
def is_dimmer(self) -> bool:
|
||||
"""Return True if the device is a dimmer."""
|
||||
return self._device_type == DeviceType.Dimmer
|
||||
|
||||
@property
|
||||
def is_dimmable(self) -> bool:
|
||||
"""Return True if the device is dimmable."""
|
||||
|
Reference in New Issue
Block a user