* 'Interface' parameter added to discovery process
Some systems (for example dd-wrt) requires specifying the network interface name, otherwise the broadcast does not work
* 'Interface' variable type and check fixed
* Formatting fixed
* Update kasa/discover.py
Co-authored-by: Teemu R. <tpr@iki.fi>
Co-authored-by: Teemu R. <tpr@iki.fi>
* Preliminary support for light strips
* Add color temperature range and cleanup, thanks to @darkoppressor
* Use lightstrip instead of {led,light}strip consistently everywhere
* The cli flag is now --lightstrip
* add apidocs
* Add fixture file for KL430
Signed-off-by: Kevin Wells <darkoppressor@gmail.com>
* Add discovery support, expose effect and length of the strip
* use set_light_state instead of transition_light_state
* Add tests for lightstrip
* add doctests
* Add KL430 to supported devices in README
Co-authored-by: Kevin Wells <darkoppressor@gmail.com>
* Improve installation instructions
* Add simple instructions how to install the package
* Move the list of supported devices to the end of the file
Fixes#60 (hopefully)
* Remove 'see below for devenv instructions'
* Add ignore_default to lights to allow setting to specific light state, force bulb on when changing the settings, allow defining brightness for set_color_temp, add a couple of new API methods
* Fix and simplify transition_light_state to make tests pass
* Add doctests to SmartBulb
* Add SmartDevice doctests, cleanup README.md
* add doctests for smartplug and smartstrip
* add discover doctests
* Fix bulb mock
* add smartdimmer doctests
* add sphinx-generated docs, cleanup readme a bit
* remove sphinx-click as it does not work with asyncclick
* in preparation for rtd hooking, move doc deps to be separate from dev deps
* pytestmark needs to be applied separately for each and every file, this fixes the tests
* use pathlib for resolving relative paths
* Skip discovery doctest on python3.7
The code is just fine, but some reason the mocking behaves differently between 3.7 and 3.8.
The latter seems to accept a discrete object for asyncio.run where the former expects a coroutine..
* 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).
* 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
* 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
* 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
* 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
* moves on_since property to smartdevice class, as it is not plug only
* returns None if the value is not available (some bulbs), or if the device is off
* async++, small powerstrip improvements
* use asyncclick instead of click, allows defining the commands with async def to avoid manual eventloop/asyncio.run handling
* improve powerstrip support:
* new powerstrip api: turn_{on,off}_by_{name,index} methods
* cli: fix on/off for powerstrip using the new apis
* add missing update()s for cli's hsv, led, temperature (fixes#43)
* prettyprint the received payloads when debug mode in use
* cli: debug mode can be activated now with '-d'
* update requirements_test.txt
* remove outdated click-datetime, replace click with asyncclick
* debug is a flag
* make smartstripplug to inherit the sysinfo from its parent, allows for simple access of general plug properties
* proper bound checking for index accesses, allow controlling the plug at index 0
* remove the mess of turn_{on,off}_by_{name,index}, get_plug_by_{name,index} are enough.
* adapt cli to use that
* allow changing the alias per index
* use f-strings consistently everywhere in the cli
* add tests for get_plug_by_{index,name}
* Add tests to the cli tool
* add pytest-mock
* do not ignore cli.py for coverage
* read requirements_test.txt instead of redefining reqs in tox.ini
* Add upload to codecov, first try!
* fix name of the result file
* no need to manually publish to azure devops..
* Add commands to control the wifi settings
Enables initial provisioning and changing the wifi network later on without the official app
* new api to smartdevice: wifi_scan() and wifi_join(ssid, password, keytype)
* cli: new subcommand 'wifi' with two commands: scan and join
* update readme to initial setup
* improvements based on code review, f-strings++
* Move dimmer support to its own class
SmartDimmer extends SmartPlug with brightness settings.
This will make the API of SmartPlug less confusing and will
make it simpler to downstream users to act with dimmers.
Fixes#33
* Lint & make tests pass
* Fix rebase after cache and emeter cleanups, hopefully everything went smoothly..
* oopsie, has_emeter was mistakenly included in smartplug
The cache was useful trick when the property accesses caused I/O,
which is unnecessary now as dev.update() does explicitly cache results until its called again.
* Enable Windows & OSX builds
* Add pypy for ubuntu
* Fix isort
* Disable PyPy
typed-ast building fails due to a missing header
ast27/Parser/tokenizer.c:17:10: fatal error: codecs.h: No such file or directory
* All child device handling is moved out from the main smartdevice class, which simplifies the code.
* This will also cleanup the constructors as only the subdevices require the ID and the parent reference.
* SmartStripPlug offers SmartPlug like interface, but does not allow separate updates
* Trying to update() on the children will cause a warning.
* do not update inside __repr__
* Convert discovery to asyncio
* Use asyncio.DatagramProtocol
* Cleanup parameters, no more positional arguments
Closes#7
* Remove sync interface
* This requires #13 to be merged. Closes#12.
* Converts cli to use asyncio.run() where needed.
* The children from smartstrips is being initialized during the first update call.
* Convert on and off commands to use asyncio.run
* conftest: do the initial update automatically for the device, cleans up tests a bit
* return subdevices alias for strip plugs, remove sync from docstrings
* Make tests pass using pytest-asyncio
* Simplify tests and use pytest-asyncio.
* Removed the emeter tests for child devices, as this information do not seem to exist (based on the dummy sysinfo data). Can be added again if needed.
* Remove sync from docstrings.
* Fix incorrect type hint
* Add type hints and some docstrings to discovery