Commit Graph

830 Commits

Author SHA1 Message Date
Teemu R
a475233464
Check for errors also in the command payload (#173)
For example, trying to set unsupported color temperature will cause such response.
This gets ignored at the moment completely, so there is no indication at all why the command caused no effect on the device.

> (93) {"smartlife.iot.smartbulb.lightingservice": {"transition_light_state": {"color_temp": 6000}}}
< (125) {"smartlife.iot.smartbulb.lightingservice":{"transition_light_state":{"err_code":-10000,"err_msg":"Invalid input argument"}}}
2019-06-03 09:58:03 -04:00
Teemu R
60add6fa66
Improve discovery by sending multiple UDP datagrams (#172)
As UDP datagrams may get lost in transit, e.g.,  due to poor network connectivity,
we can improve the detection rate by sending multiple datagrams and hoping some
will get through to the devices.

Confirmed to improve the detection by @scubanarc: https://github.com/home-assistant/home-assistant/issues/21966

This is a new configurable option, defaulting to three discover packets.
2019-05-20 21:56:01 -04:00
Teemu R
29f75d9566
Prepare 0.3.5 (#170) 2019-04-13 01:12:37 -04:00
Alex
461440e8b1 Fix for SmartStrip repr (#169)
* Added unit tests for repr.

* Fix repr for SmartStrip.

Fixes #165
2019-04-09 00:19:42 -04:00
Teemu R
960ec6a346
Smartstrip: return on_since state information only when the socket is on (#161)
* Smartstrip: return on_since state information only when the socket is on

Fixes #160

* add proper cli printout for hs300 child sockets

* iterate over range, not an integer
2019-03-16 21:32:59 +01:00
Teemu R
8046c96b54
bulb: add the temperature range to state_information, inform the user if the info is missing when calling temperature (#163) 2019-03-16 21:32:25 +01:00
Georgi Kirichkov
07b4eda7ae Fix Discover#discover incorrect documentation (#159)
The documentation states the timeout defaults to 5 seconds, but in the definition of the method timeout is set to 3
2019-01-30 13:28:14 +01:00
dieselrabbit
df42f59ede Add kelvin range for KL130 (#156)
* Add kelvin range for KL130 (new color bulb)

* Add kelvin range for KL120

Unable to test this personally as I don't have this bulb.
2019-01-26 21:12:22 +01:00
Teemu R
f75e2cd9b7
Add LB230
Works according to https://github.com/home-assistant/home-assistant.io/pull/8090
2019-01-22 13:23:27 +01:00
Teemu R
5a1300e3c9
add KL series of bulbs
works according to https://github.com/home-assistant/home-assistant.io/pull/8134
2019-01-22 13:19:04 +01:00
Teemu R
c4bb48979f
Prepare 0.3.4 (#154) 2019-01-17 11:39:51 +01:00
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
Kevron Rees
8034c47b89 avoid 'referenced before assignment' exception (#150) 2019-01-07 22:28:05 +01:00
Annika Jacobs
29c91151e3 cli: show an error for incorrect hsv values (#142)
* cli: fix hsv get

Raising an exception if an incomplete HSV colour is provided.

* cli hsv: clarify error message

* cli hsv: clarify error message (again)
2018-11-23 22:39:58 +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 R
189029b199
Remove deprecated identify, this has been deprecated for long enough. (#136)
* Remove deprecated identify, this has been deprecated for long enough.

* ignore abstract methods and __repr__ from coverage
2018-10-19 17:08:00 +02:00
Georgi Kirichkov
ce318bf824
Merge pull request #135 from rytilahti/add_hs220_tests
Add tests and pretty output for HS220, fix minor issues in tests
2018-10-19 11:52:42 +03:00
Teemu Rytilahti
55fca7ed44 add missed test for invalid types 2018-10-18 20:19:10 +02:00
Teemu Rytilahti
ab3993d63d update README to include mention about hs220 2018-10-18 20:05:45 +02:00
Teemu Rytilahti
8d4f4a6de3 Add tests and pretty output for HS220, fix minor issues in tests 2018-10-18 19:57:44 +02:00
Teemu R
345216e245
Add reboot command to restart the device (#129) 2018-09-08 16:11:58 +02:00
Teemu R
d72b47c0b7
Prepare 0.3.3 (#128) 2018-09-06 16:52:11 +02:00
Sebastian Templ
df0a7f4c36 Fix bug that changed brightness at each HSV update (#124)
* Fix bug that changed brightness at each hsv update

The HSV setter should accept a percentage for the brightness
value but actually assumed the brightness to be in absolute values
between 1 and 255.
This resulted in brightness reductions at each HSV update, in
steps of 100% -> 100/255=39% -> 39/255=15% -> ... (see also
https://github.com/home-assistant/home-assistant/issues/15582,
where I originally reported this bug).

* Modify HSV property to return brightness in percent

Switch from reported brightness values of 1..255 to percentage
values, for consistency with the apidoc and 8761dd8.

* Add checks and tests for the hsv setter

- make sure that new (hue, saturation, brightness) values are
  within their valid ranges (0..255, 0..100, 0..100) and raise
  SmartDeviceException if they are not
- add test function for the hsv setter
2018-09-05 22:44:44 +02:00
kwazel
ce89c0d800 Allow using alias instead of IP address or hostname (#127)
* Added option to control devices by device name

* set unused ip address to dont-care

* spend less time discovering by devicename, removed command

* consistent use of alias instead of device name

* processed review comments

* Return when no device with alias has been found
2018-08-30 23:22:23 +03:00
Teemu R
ab103c3a1a
add 'alias' command for querying and setting the alias (#126)
* add 'alias' command for querying and setting the alias

* calculate coverage only on library files, e.g., ignoring cli and test files

* remove py34 and add py37

* readd py33, remove it from travis as it seems to be a travis limitation only

* use xenial dist for travis, regular does not support py37..
2018-08-13 20:37:43 +02:00
Anders Melchiorsen
a6d515b5cb Support Unicode strings in encrypt/decrypt (#125) 2018-08-08 16:52:03 +02:00
Teemu R
e612560b35
Bump for 0.3.2 (#123) 2018-06-17 19:04:24 +02:00
Thibault Cohen
c6739daacc Add bulb valid temperature range (#122) 2018-06-17 19:01:18 +02:00
Teemu R
caa01befd7
Release 0.3.1 (#121)
* update changelog, bump version to 0.3.1

* fix flake8
2018-06-16 21:31:51 +02:00
Teemu R
ef2e21ff69
Fix emeter support for newer HS110 firmwares (#107)
* Add support for new-style emeter

This commit adds a straightforward dict-extending container,
which converts between the old and new keys of the get_emeter_realtime()
Furthermore the unit tests are converted to base on HS100
instead of HS110.

This is the first step to fix #103, other emeter-using functionality
has not yet been converted, only getting the current consumption.

* fix a couple of linting issues

* Convert new-style emeter values also for get_emeter_daily() and get_emeter_monthly()

* Adds a new 'kwh' parameter for those calls, which defaults to True
* This changes the behavior of bulbs emeter reporting, use False if you prefer the preciser values
2018-06-16 21:16:35 +02:00
Teemu R
11a7042a04
update pypi description (#102)
* update pypi description

* add wall switches
2018-06-09 17:45:10 +02:00
JsChiSurf
1aee353cbf Update smartplug.py to support dimming in HS220 (#115)
* Update smartplug.py to support dimming in HS220

Switch functions essentially as a "plug" with the addition to support for dimming, for which can be test for by verifying existence of 'brightness' array value.

* Attempt at updates to pass validator

* Maybe this time?  :-)

* Add more detail to comment blocks

Make clear in requests for current brightness level the expected return values, and note that light will turn on when setting a brightness level, if not already on.  This makes clear that a state change request (turn_on) does NOT have to be made first when setting brightness.

* Update smartplug.py

* Update smartplug.py

Fixes #114
2018-04-09 21:17:54 +02:00
Georgi Kirichkov
c766e3594b
Merge pull request #109 from rytilahti/require_py34
Add python_requires for >= 3.4
2018-01-22 00:13:01 +02:00
Teemu Rytilahti
4c427a8413 Add python_requires for >= 3.4 2018-01-21 00:48:48 +01: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
K Henriksson
a426488449 Use direct device type discovery for devices (#106)
This is more efficient than enumerating all devices and checking the IP.
2018-01-14 19:10:53 +01:00
Teemu Rytilahti
34347e59ae cli: add 'time' command to get the current time from the device 2017-10-17 00:53:18 +02: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
Sean Gollschewsky
44424c1182 Local test clean (#96)
* Add ignores for working coverage/tox/IDE files.

* Allow tox not to fail if python version is not available.
2017-10-07 17:44:45 +02:00
Teemu R
0b2e371e79 move SmartDeviceException to SmartDevice, and remove types.py complet… (#95)
* move SmartDeviceException to SmartDevice, and remove types.py completely. fixes #94

* do not import skipIf anymore
2017-10-07 17:41:51 +02:00
Teemu R
d22eceefae move has_emeter implementation from SmartDevice to SmartPlug, avoid using features() internally (#93)
* move has_emeter implementation from SmartDevice to SmartPlug, avoid using features() internally

* add stacklevel to deprecation warnings to see where they are really called

* make tests pass on a real device. if PLUG_IP is not None, the tests will be run on a device at the defined IP address
2017-10-07 17:36:49 +02:00
Teemu R
af90a36153 add typing hints to make it easier for 3rd party developers to use the library (#90)
* add typing hints to make it easier for 3rd party developers to use the library

* remove unused devicetype enum to support python3.3

* add python 3.3 to travis and tox, install typing module in setup.py
2017-09-18 18:13:06 +02:00
Teemu R
3ddd31f3c1 execute coveralls only on travis, fixes #84 (#91) 2017-09-16 19:00:17 +02:00
Teemu Rytilahti
281f236221 make flake8 pass by some rewording 2017-09-16 18:57:42 +02:00
Teemu Rytilahti
1457c4f533 make hound a bit more happier 2017-09-16 18:55:22 +02:00