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,6 +1,77 @@
Changelog Changelog
========= =========
0.2.4 (2017-03-20)
------------------
- Add new client tool (#42) [Teemu R]
* Add new client tool
After installing the package pyhs100 command-line tool can be used
to control the plug.
See --help for its usage, most of the features for plugs are implemented,
some of the shared functionality works for bulbs too.
* Add discover command
* Delete old examples, the cli works as an example well enough
- Ignore OSError on socket.shutdown() [Teemu Rytilahti]
This fixes #22 and obsoletes PR #23.
- Set color temp to 0 when trying to change color (#36) [pete1450]
* set color temp to 0 when trying to change color
* changed tabs to spaces
- Add changelog & add .gitchangelog.rc (#28) [Teemu R]
This commits adds .gitchangelog.rc for changelog generation.
To generate, simply run gitchangelog.
- Discover: Catch socket.timeout and debug log it (#34) [Teemu R]
Fixes #33
- Add flake8 to tox, disable qa on pyHS100/__init__.py, fix py27
compatibility (#31) [Teemu R]
- Add support for TP-Link smartbulbs (#30) [Matthew Garrett]
* Add support for new-style protocol
Newer devices (including my LB130) seem to include the request length in
the previously empty message header, and ignore requests that lack it. They
also don't send an empty packet as the final part of a response, which can
lead to hangs. Add support for this, with luck not breaking existing devices
in the process.
* Fix tests
We now include the request length in the encrypted packet header, so strip
the header rather than assuming that it's just zeroes.
* Create a SmartDevice parent class
Add a generic SmartDevice class that SmartPlug can inherit from, in
preparation for adding support for other device types.
* Add support for TP-Link smartbulbs
These bulbs use the same protocol as the smart plugs, but have additional
commands for controlling bulb-specific features. In addition, the bulbs
have their emeter under a different target and return responses that
include the energy unit in the key names.
* Add tests for bulbs
Not entirely comprehensive, but has pretty much the same level of testing
as plugs
0.2.3 (2017-01-11) 0.2.3 (2017-01-11)
------------------ ------------------

22
HOWTO_RELEASE Normal file
View File

@ -0,0 +1,22 @@
# Preparing the changelog
Looks like gitchangelog is not as nice as thought before,
however, you can generate the changelog by doing this:
$ gitchangelog 0.x.y..HEAD
and manually placing the output to CHANGELOG and fixing
the newlines between commit messages, and cleaning up the
unnecessary entries, and finally commiting the file.
After that prepare a pull request containing the changed,
release-related files (CHANGELOG, setup.py, README, ..).
# After release merge is done
$ git tag -a v0.x.y -m "0.x.y"
$ git push --tags
# Pushing to pypi
$ python setup.py sdist bdist_wheel upload

View File

@ -1,12 +1,47 @@
# pyHS100 # 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 # 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 ```python
from pyHS100 import SmartPlug from pyHS100 import SmartPlug, SmartBulb
from pprint import pformat as pf from pprint import pformat as pf
plug = SmartPlug("192.168.250.186") plug = SmartPlug("192.168.250.186")
@ -53,15 +88,3 @@ plug.led = False # turn off led
print("New LED state: %s" % plug.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
```

View File

@ -1,7 +1,7 @@
from setuptools import setup from setuptools import setup
setup(name='pyHS100', setup(name='pyHS100',
version='0.2.3', version='0.2.4',
description='Interface for TPLink HS100 Smart Plugs.', description='Interface for TPLink HS100 Smart Plugs.',
url='https://github.com/GadgetReactor/pyHS100', url='https://github.com/GadgetReactor/pyHS100',
author='Sean Seah (GadgetReactor)', author='Sean Seah (GadgetReactor)',