Commit Graph

8 Commits

Author SHA1 Message Date
Connor Proctor
dd073fa8c8
Add transition support for SmartDimmer (#69)
* Adds a transition param to set_brightness(), turn_on(), and turn_off() that specifies the duration in milliseconds that the dimmer switch will take to transition to the new state.
* Fixes bug where set_brightness(0) was allowed even though the dimmer does not support it. Now brightness values of 0 are coerced to 1 to be consistent with bulbs (which do support brightness values of 0).
2020-06-14 18:09:28 +02:00
Teemu R
644a10a0d1
General cleanups all around (janitoring) (#63)
* Move tests to device-type specific test files to make improvements more approachable

* protocol: remove the port parameter from query, as there are no other known ports, fix docstrings

* Revise docstrings, remove superfluous information and remove unused methods ({set,get_icon} and set_time)

* cli: indent device output to make it more easily readable when having multiple devices

* remove adjust flake8 ignores (we have no setup.py anymore)

* pyproject: include cli tool to coverage, add config for interrogate (docstring coverage)

* bulb: raise exception on color_temp error cases instead of returning zero values

* improve bulb tests, simplify conftest

* strip: rename plugs property to children and move it to smartdevice
2020-05-27 16:55:18 +02:00
Teemu R
836f1701b9
Optimize I/O access (#59)
* Optimize I/O access

A single update() will now fetch information from all interesting modules,
including the current device state and the emeter information.

In practice, this will allow dropping the number of I/O reqs per homeassistant update cycle to 1,
which is paramount at least for bulbs which are very picky about sequential accesses.
This can be further extend to other modules/methods, if needed.

Currently fetched data:
* sysinfo
* realtime, today's and this months emeter stats

New properties:
* emeter_realtime: return the most recent emeter information, update()-version of get_emeter_realtime()
* emeter_today: returning today's energy consumption
* emeter_this_month: same for this month

Other changes:
* Accessing @requires_update properties will cause SmartDeviceException if the device has not ever been update()d
* Fix __repr__ for devices that haven't been updated
* Smartbulb uses now the state data from get_sysinfo instead of separately querying the bulb service
* SmartStrip's state_information no longer lists onsince for separate plugs
* The above mentioned properties are now printed out by cli
* Simplify is_on handling for bulbs

* remove implicit updates, return device responses for actions, update README.md instructions. fixes #61
2020-05-24 17:57:54 +02:00
Teemu R
012436c494
Improve dimmer support (#62)
* discover dimmers properly

* fix circular import, hopefully

* add is_color to SmartDevice API

* allow changing the dimming without implicitly turning the device on

* Add tests for device type handling for discovery data, make sure new fixtures are added to categories inside conftest
2020-05-20 21:17:33 +02:00
Teemu R
ed57563e8b
Convert to use poetry & pyproject.toml for dep & build management (#54)
* Convert to use poetry and pyproject.toml, update README

* add some resources for contributors

* minor adjustments

* ci: separate tests from linting, run using poetry

* add pytest-mock to dev requirements

* combine running tests and reporting to codecov

* generate both xml and html coverage reports

* add codecov to dev dependencies
2020-05-12 12:11:47 +02:00
Teemu R
c6d76836d7
Add fixture for KL60 (#52) 2020-04-26 17:44:16 +02:00
Teemu R
7eea21f2dd
test the newly added device fixtures (#21)
* make fixture detection saner
* allow scrubbed locations
2020-01-14 19:16:30 +01:00
Teemu R
3ef5086ffb mass rename to (python-)kasa (#1) 2019-12-18 09:11:18 +01:00