Release 0.2.4 preparations (#43)

This commit is contained in:
Teemu R
2017-03-25 23:04:32 +01:00
committed by GitHub
parent d253b55d41
commit b1cc0fd3f6
4 changed files with 132 additions and 16 deletions

View File

@@ -1,12 +1,47 @@
# pyHS100
Python Library to control TPLink Switch (HS100 / HS110)
Python Library to control TPLink smart plugs (HS100, HS105, HS110, HS200) and TPLink smart bulbs (LB1xx).
# Usage
For all available API functions run ```help(SmartPlug)```
The package is shipped with a console tool named pyhs100, please refer to ```pyhs100 --help``` for detailed usage.
<b>Note: The tool does not currently support bulb-specific commands, please feel free to prepare a pull request!</b>
## Discovering devices
```
$ pyhs100 discover
Discovering devices for 5 seconds
Found device: {'ip': '192.168.250.186',
'port': 9999,
'sys_info': {'emeter': {'get_realtime': {'current': 0.013309,
<snip>
```
## Querying the state
```
$ pyhs100 --ip 192.168.250.186
== My Smart Plug - HS110(EU) ==
Device state: OFF
LED state: False
Time: 1970-01-01 01:52:35
On since: 2017-03-19 17:09:16.408657
Hardware: 1.0
Software: 1.0.8 Build 151101 Rel.24452
MAC (rssi): 50:C7:BF:XX:XX:XX (-61)
Location: {'longitude': XXXX, 'latitude': XXXX}
== Emeter ==
Current state: {'power': 0, 'total': 0.001, 'current': 0.013552, 'voltage': 223.394238}
```
# Library usage
For all available API functions run ```help(SmartPlug)``` or ```help(SmartBulb)```.
```python
from pyHS100 import SmartPlug
from pyHS100 import SmartPlug, SmartBulb
from pprint import pformat as pf
plug = SmartPlug("192.168.250.186")
@@ -53,15 +88,3 @@ plug.led = False # turn off led
print("New LED state: %s" % plug.led)
```
# Example
There is also a simple tool for testing connectivity in examples, to use:
```python
python -m examples.cli <ip>
```
# Discovering devices
```python
python3 -m examples.discover
```