Commit Graph

11 Commits

Author SHA1 Message Date
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
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
Thibault Cohen
c6739daacc Add bulb valid temperature range (#122) 2018-06-17 19:01:18 +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
K Henriksson
d40fff4f9e Add support for DNS host names (#104) 2018-01-17 22:03:19 +01: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 Rytilahti
281f236221 make flake8 pass by some rewording 2017-09-16 18:57:42 +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 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