Commit Graph

115 Commits

Author SHA1 Message Date
Annika Jacobs
4cb28a3b25 Updated valid range to 360 (with passing tests) (#153)
* Updated valid range to 360

with it set to 359 it will not show the color red. Just tested this with a buddies bulb - same model/fw
https://imgur.com/a/kSNZIuL

* Updated valid range to 360

with it set to 359 it will not show the color red. Just tested this with a buddies bulb - same model/fw
https://imgur.com/a/kSNZIuL

* Update valid range to 360

* Fix tests
2019-01-16 21:50:48 +01:00
jimboca
6115d96c39 Add support for HS300 power strip (#137)
* discover runs, prints on since of device 0

* added preliminary support for HS300

* forgot to add smartdevice to commit

* added index to CLI

* clean up dirty code

* added fake sysinfo_hs300

* changed device alias to match MAC

* #131 Move _id_to_index into smartstrip so everyone can pass index

* Update pyHS100/discover.py

Co-Authored-By: jimboca <jimboca3@gmail.com>

* refactoring to deduplicate code between smarplug and smartstrip

* fixing CI failures for devices without children

* incorporating feedback from pull request.

* fixing hound violation

* changed internal store from list of dicts to dict

* changed other methods to dictionary store as well

* removed unused optional type from imports

* changed plugs to Dict, remove redundant sys_info calls

* added more functionality for smart strip, added smart strip tests

* updated FakeTransportProtocol for devices with children

* corrected hound violations

* add click-datetime
2019-01-08 20:13:25 +01:00
Teemu R
ae53e8de1e
Add HS103
HS103 works according to https://www.reddit.com/r/homeassistant/comments/ad7oqk/tplink_hs103_not_on_list/edewohh/
2019-01-08 19:28:16 +01:00
Scott Albertson
823612b32c Add a "Reviewed by Hound" badge (#139) 2018-11-16 23:18:48 +01:00
Annika Jacobs
c65d4c0b30 Change valid hue range to 0-359 (fixes #130), update README.md & test (#140)
* Change valid hue range to 0-359 (fixes #130)

Tested on LB130(EU) hardware 1.0, firmware 1.8.6 Build 180809 Rel.091659

Co-Authored-By: nkonopinski <nkonopinski@users.noreply.github.com>

* Update README.md

* Update test_bulb.py
2018-11-16 23:18:28 +01:00
Teemu Rytilahti
ab3993d63d update README to include mention about hs220 2018-10-18 20:05:45 +02:00
Teemu R
bda2ce0d89
add hs210
Based on user report: https://community.home-assistant.io/t/tp-link-hs210-3-way-kit/39762/6
2018-01-19 22:49:29 +01:00
K Henriksson
d40fff4f9e Add support for DNS host names (#104) 2018-01-17 22:03:19 +01:00
TheSmokingGnu
95b743f11d created a docker file to aid dev setup (#99)
* created a docker file to aid dev setup

* fixed review comments in README and Dockerfile

* review comments to simplify the docker run command
2017-10-13 23:27:05 +02:00
Teemu R
b80923061f Release 0.3.0 (#88)
* update the changelog

* revise README, fixes #86

* bump the version

* final changelog update for 0.3.0
2017-10-07 17:51:10 +02:00
Teemu R
b1cc0fd3f6 Release 0.2.4 preparations (#43) 2017-03-25 23:04:32 +01:00
Teemu R
71ac1f043a Add device discovery (#25)
* add (untested) discover mode

* Keep discovery and normal communication separate, uppercase magic consts

This sepearates the earlier test code for discovering devices,
and adds 5 sec timeout for gathering responses from potential devices.

This commit also uppercases magic constants.

Discovery & communication tested with HS110.

* update readme with example how to discover devices, pep8ify
2017-01-08 06:44:57 +08:00
Teemu R
fd4e363f56 Refactor & add unittests for almost all functionality, add tox for running tests on py27 and py35 (#17)
* Refactor & add unittests for almost all functionality, add tox for running tests on py27 and py35

This commit adds unit tests for current api functionality.
- currently no mocking, all tests are run on the device.
- the library is now compatible with python 2.7 and python 3.5, use tox for tests
- schema checks are done with voluptuous

refactoring:
- protocol is separated into its own file, smartplug adapted to receive protocol worker as parameter.
- cleaned up the initialization routine, initialization is done on use, not on creation of smartplug
- added model and features properties, identity kept for backwards compatibility
- no more storing of local variables outside _sys_info, paves a way to handle state changes sanely (without complete reinitialization)

* Fix CI warnings, remove unused leftover code

* Rename _initialize to _fetch_sysinfo, as that's what it does.

* examples.cli: fix identify call, prettyprint sysinfo, update readme which had false format for led setting

* Add tox-travis for automated testing.
2016-12-17 06:51:56 +08:00
Teemu R
05a6bbb145 Read all data from the device, disable double-encoding, implement more APIs, refactor querying, update README (#11)
* Read from socket until no data available, disable double string encoding

HS110 sends sometimes datagrams in chunks especially for get_daystat,
this patch makes it to read until there is no more data to be read.

As json.dumps() does JSON encoding already, there's no need to str()
the year or month either.

* Add cli.py, a simple script to query devices for debugging purposes.

* allow easier importing with from pyHS100 import SmartPlug

* move cli.py to examples, add short usage into README.md

* Implement more available APIs, refactor querying code.

This commit adds access to new properties, both read & write,  while keeping the old one (mostly) intact.
Querying is refactored to be done inside _query_helper() method,
which unwraps results automatically and rises SmartPlugException() in case of errors.
Errors are to be handled by clients.

New features:
* Setting device alias (plug.alias = "name")
* led read & write
* icon read (doesn't seem to return anything without cloud support at least), write API is not known, throws an exception currently
* time read (returns datetime), time write implemented, but not working even when no error is returned from the device
* timezone read
* mac read & write, writing is untested for now.

Properties for easier access:
* hw_info: return hw-specific elements from sysinfo
* on_since: pretty-printed from sysinfo
* location: latitude and longitued from sysinfo
* rssi: rssi from sysinfo

* Update README.md with examples of available features.

* Handle comments from mweinelt

* Refactor state handling, use booleans instead of strings

* Fix issues raised during the review.

Following issues are addressed by this commit:
* All API is more or less commented (including return types, exceptions, ..)
* Converted state to use
* Added properties is_on, is_off for those who don't want to check against strings.
* Handled most issues reported by pylint.
* Adjusted _query_helper() to strip off err_code from the result object.
* Fixed broken format() syntax for string formattings.

* Fix ci woes plus one typo.

* Do initialization after changing device properties, fix nits.
2016-12-12 17:13:45 +08:00
GadgetReactor
639c1c822e Initial commit 2016-07-07 17:11:45 +08:00