Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from rytilahti/master
Slight refactoring
- Loading branch information
Showing
6 changed files
with
45 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
""" | ||
This module provides a way to interface with TP-Link's smart home devices, | ||
such as smart plugs (HS1xx), wall switches (HS2xx), and light bulbs (LB1xx). | ||
All common, shared functionalities are available through `SmartDevice` class:: | ||
x = SmartDevice("192.168.1.1") | ||
print(x.sys_info) | ||
For device type specific actions `SmartBulb` or `SmartPlug` must be used instead. | ||
Module-specific errors are raised as `SmartDeviceException` and are expected | ||
to be handled by the user of the library. | ||
""" | ||
# flake8: noqa | ||
from .smartplug import SmartPlug | ||
from .pyHS100 import SmartPlugException, SmartDevice | ||
from .pyHS100 import SmartDevice | ||
from .types import SmartDeviceException | ||
from .smartbulb import SmartBulb | ||
from .protocol import TPLinkSmartHomeProtocol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import enum | ||
|
||
|
||
class SmartDeviceException(Exception): | ||
""" | ||
SmartPlugException gets raised for errors reported by the plug. | ||
""" | ||
pass | ||
|
||
|
||
class DeviceType(enum.Enum): | ||
Unknown = -1, | ||
Plug = 0, | ||
Switch = 1 | ||
Bulb = 2 |