Commit Graph

10 Commits

Author SHA1 Message Date
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
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
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
K Henriksson
d40fff4f9e Add support for DNS host names (#104) 2018-01-17 22:03:19 +01: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
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
Teemu R
09e8948790 generalize smartdevice class and add bulb support for the cli tool (#50)
Fixes #48 and #51. The basic functionality should work on all types of supported devices, for bulb specific commands it is currently necessary to specify ```--bulb```.
2017-04-24 19:28:22 +02:00
Teemu R
86f14642c8 Refactor and drop py2 support (#49)
* move is_off property to SmartDevice, implement is_on for bulb and use it

* refactor by moving smartbulb and smartplug to their own classes

* drop python2 compatibility, make flake8 happy

* travis: remove 2.7, add 3.6
2017-04-14 14:24:58 +02:00