Commit Graph

1012 Commits

Author SHA1 Message Date
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
Teemu Rytilahti
a9c1d08d66 deprecate features and identify, use state_information in __repr__ instead of identify 2017-09-16 18:29:20 +02:00
Teemu Rytilahti
31b5b89d35 fix smartbulb hsv documentation, values are degrees and percentages instead of 0-255 2017-09-16 18:28:57 +02:00
Teemu Rytilahti
79f3b447c8 call socket's close() even when shutdown causes an exception, fixes hopefully #65 for good 2017-09-16 18:27:41 +02:00
Sean Gollschewsky
25e550d3fe Fix brightness and temperature. (#89) 2017-09-15 14:23:06 +02:00
Teemu R
3a14484d47 add lb120 sysinfo to test suite, thanks to githubbuh (#85) 2017-08-30 03:35:34 +03:00
Teemu R
8f83ca8784 add lb100 tests, thanks to kdschlosser (issue #58) (#82) 2017-08-22 16:55:49 +02:00
Teemu R
2d26e8cf35 make tox run pytest-cov, add coveralls (#81)
* make tox run pytest-cov, add coveralls

* another try, just with module name
2017-08-09 13:07:24 +02:00
Sean Gollschewsky
a621f5329d Prevent failure if device's sysinfo does not have a "feature" attribute. (#77) 2017-08-06 15:42:33 +02:00
Georgi Kirichkov
d851540380 Merge pull request #76 from rytilahti/extend_tests
Extend tests
2017-08-06 15:36:40 +03:00
Teemu Rytilahti
651331bb77 allow None for rssi, add a missing newline to fakes.py 2017-08-05 17:33:08 +02:00
Teemu Rytilahti
d648c6bd2b add hs100 tests 2017-08-05 17:30:40 +02:00
Teemu Rytilahti
675f618777 make tests to test against all known device variants 2017-08-05 17:30:40 +02:00
Teemu Rytilahti
1d7e5fa73c remove unused tplinksmarthomeprotocol import 2017-08-05 17:30:40 +02:00
Teemu Rytilahti
5839c2d1de fix hs105 mac to pass the test, wrap sysinfo_lb110 properly inside 'system' 2017-08-05 17:30:40 +02:00
Teemu Rytilahti
92c9cddfd4 return None instead of False for emeter related actions 2017-08-05 17:30:40 +02:00
Teemu R
0927930f41 wrap sysinfo to defaultdict to return None for keys which do not exist, makes unsupported keys not to fail hard (#72) 2017-08-05 17:28:45 +02:00
Teemu R
d15e7be4f3 add hs100 example to fakes.py, thanks to Semant1ka on #67 (#74) 2017-08-05 16:28:11 +02:00
Teemu R
07af48e41a Discover refactoring, enhancements to the cli tool (#71)
* Discover refactoring, enhancements to the cli tool

* Discover tries to detect the type of the device from sysinfo response
* Discover.discover() returns an IP address keyed dictionary,
  values are initialized instances of the automatically detected device type.

* When no IP is given, autodetect all supported devices and print out their states
* When only IP but no type is given, autodetect type and make a call based on that information.
  * One can define --bulb or --plug to skip the detection.

* renamed pyHS100.py -> smartdevice.py

* SmartPlugException -> SmartDeviceException in comments

* fix mic_type check

* make time() return None on failure as we don't know which devices support getting the time and it's used in the cli tool

* hw_info: check if key exists before accessing it, add mic_mac and mic_type

* Check for mic_mac on mac, based on work by kdschloesser on issue #59

* make hound happy, __init__ on SmartDevice cannot error out so removing 'raises' documentation
2017-08-05 15:49:56 +02:00