Commit Graph

695 Commits

Author SHA1 Message Date
J. Nick Koston
18d58388c1
Add test fixture for KL130 (#35)
* Add test fixture for KL130

* Update test
2020-04-10 16:16:50 +02:00
Teemu R
f4e5afa20b
Depend on py3.7+ for tox, add python 3.8 to azure pipeline targets (#29) 2020-03-18 12:50:42 +01:00
Teemu R
bc153b3bb9
Fix azure pipeline badge (#32) 2020-03-18 12:17:12 +01:00
Teemu R
e9b0acaaa7
Enable Windows & OSX builds (#31)
* 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
2020-03-18 00:40:06 +01:00
Teemu R
00276e34b7
Move child socket handling to its own SmartStripPlug class (#26)
* 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.
2020-03-16 14:52:40 +01:00
Teemu R
489a550582
Add KP303 to the list of powerstrips (#28)
Should fix #27
2020-03-16 14:52:24 +01:00
Alex Cragg
15b0c8c0e6 Adding KP303 to supported devices (#25)
* Adding KP303(UK)_1.0.json

Adding the result file for the KP303 from kasa dump-discover

* Update readme to include KP303 as a supported device
2020-01-28 14:58:20 +01:00
Angelo Gagliano
3337c574ce Remove unused save option and add scrubbing (#19)
* Removes unused save option and adds scrubbing

* Defaults to scrub and adds no-scrub option

* Adds latitude and longitude to the scrub list
2020-01-15 14:46:35 +01:00
Teemu R
80f097b5b3 use pytestmark to avoid repeating asyncio mark (#24) 2020-01-15 07:49:31 +01:00
Teemu R
72d6205ad2 Cleanup constructors by removing ioloop and protocol arguments (#23)
* Cleanup constructors by removing ioloop and protocol

* force kwarg for other arguments besides the host
2020-01-15 07:46:21 +01: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
4a4b9c655a
move testing requirements to requirements_test.txt, add pytest-asyncio for azure pipelines (#20) 2020-01-14 18:58:39 +01:00
Angelo Gagliano
87c0dab8c8 Add real kasa device dumps (#18)
* Adds real kasa device dumps

* Adds newline to the end of the files
2020-01-14 13:34:57 +01:00
Teemu R
822ab3f8ac Fix dump-discover to use asyncio.run (#16) 2020-01-13 08:52:52 +01:00
Teemu R
0f0df481a0
Add device_id property, rename context to child_id (#15)
For regular devices, device_id is the mac address and for child devices it is a combination of the mac address and the child_id.
2020-01-13 00:17:45 +01:00
Teemu R
524d28abbc
Remove sync interface, add asyncio discovery (#14)
* 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
2020-01-12 22:44:19 +01:00
Teemu R
3c68d295da
Remove --ip which was just an alias to --host (#6) 2020-01-12 20:29:19 +01:00
Teemu R
4a25cbfff7
Set minimum requirement to python 3.7 (#5) 2020-01-12 20:27:53 +01:00
Bas Nijholt
161c3eb53b change ID of Azure Pipeline (#3) 2019-12-18 12:33:32 +01:00
Teemu R
3ef5086ffb mass rename to (python-)kasa (#1) 2019-12-18 09:11:18 +01:00
Bas Nijholt
624c44c27f multiply by 1000 instead of 10^3 2019-12-12 11:13:18 +01:00
Bas Nijholt
8d1e0acbba remove Travis CI 2019-12-12 11:09:53 +01:00
Bas Nijholt
ad209de268 fix mympy's error "Decorated property not supported" (mypy bug)
See https://github.com/python/mypy/issues/1362
2019-12-12 10:46:40 +01:00
Bas Nijholt
122cd4c19f run pre-commit run --all 2019-12-12 10:41:52 +01:00
Bas Nijholt
338e6ce743 add more pre-commit hooks 2019-12-12 10:41:36 +01:00
Bas Nijholt
a96af31116 replace Travis badge with Azure pipelines 2019-12-12 10:34:13 +01:00
Bas Nijholt
72d5443f1a implement methods that depend on sys_info as properties and add update
In the case of smartbulb.update, light_state is also updated.
2019-11-16 17:22:37 +01:00
Bas Nijholt
8c25590186 simplify loop in __init__ in smartstrip.py 2019-11-15 16:51:01 +01:00
Bas Nijholt
b2ca20edf0 use f-strings or format 2019-11-15 16:35:42 +01:00
Bas Nijholt
e39c6dbfa2 fix pre-commit issues 2019-11-15 16:28:02 +01:00
Bas Nijholt
1779e6e122 fix bug in cli.state 2019-11-15 16:11:55 +01:00
Bas Nijholt
2976c453ac improve doc-strings 2019-11-15 16:05:46 +01:00
Bas Nijholt
a7cb2cebed use tox.ini in hound 2019-11-15 14:31:01 +01:00
Bas Nijholt
09d620df01 Merge remote-tracking branch 'upstream/azure_pipelines' into asyncio 2019-11-15 14:17:00 +01:00
Bas Nijholt
190a800e77 only support >= 3.6 2019-11-11 23:15:57 +01:00
Bas Nijholt
cc900ae491 tmp: comment out 2 failing tests 2019-11-11 23:10:57 +01:00
Bas Nijholt
b2973cda6c fix the tests 2019-11-11 23:02:50 +01:00
Teemu Rytilahti
b5e585e1f8 export __version__ under the main module 2019-11-11 22:33:23 +01:00
Teemu Rytilahti
751c2445c2 add missing version.py 2019-11-11 22:30:37 +01:00
Teemu Rytilahti
8a131e1eeb Add precommit hooks & tox env to enforce code structure, add azure pipelines
Instead of leveraging hound & travis, add an option for azure pipelines,
which may replace the former in the future.

This also streamlines the contributing guidelines by:
* Adding pre-commit hooks to run isort, black, flake8, mypy
* Adding lint environment to allow checks to be run `tox -e lint`

This also contains a major cleanup to the SmartStrip handling which was due.
After seeing #184 I thought I should push this in as it is for comments before the codebase diverges too much.
2019-11-11 22:14:34 +01:00
Bas Nijholt
583c785611 prefer sync attribute over asyncio.run 2019-11-11 21:06:50 +01:00
Bas Nijholt
9907c6416b isort and black on the tests 2019-11-11 20:31:56 +01:00
Bas Nijholt
55d898b547 use absolute imports 2019-11-11 20:30:29 +01:00
Bas Nijholt
8a7d955eb7 use the "sync" attribute to call methods in the CLI 2019-11-11 20:29:18 +01:00
Bas Nijholt
e6faf9dd05 change cli.py message in according with setup.py 2019-11-11 20:29:18 +01:00
Bas Nijholt
0c1d8b6efe implement SyncSmartDevice and sort imports and use absolute imports 2019-11-11 20:29:18 +01:00
Bas Nijholt
30677b2af0 black setup.py 2019-11-11 20:29:18 +01:00
Bas Nijholt
b2d0a511a5 define __all__ ( also gets rid of flake8 issues) 2019-11-11 20:29:18 +01:00
Bas Nijholt
533c6b5ca2 pass an ioloop 2019-11-11 19:16:55 +01:00
Bas Nijholt
7d3d105e47 remove unused imports 2019-11-11 18:19:45 +01:00