J. Nick Koston
1e4df7ec1b
Fix modularize with strips ( #326 )
...
* Fix test_deprecated_type stalling
* Fix strips with modularize
* Fix test_deprecated_type stalling (#325 )
2022-04-05 19:27:46 +02:00
Teemu Rytilahti
f0d66e4195
move get_time{zone} out from smartdevice + some minor cleanups
2022-04-05 19:27:46 +02:00
Teemu Rytilahti
c8ad99abcb
Use device time for on_since for smartstripplugs
2022-04-05 19:27:46 +02:00
Teemu Rytilahti
bb013e75da
Raise an exception when trying to access data prior updating
2022-04-05 19:27:46 +02:00
Teemu R
3a7836cd33
Do not request unsupported modules after the initial update ( #298 )
...
* Do not request unsupported modules after the initial update
* debugify logging
2022-04-05 19:27:46 +02:00
Teemu R
8c7b1b4a68
Implement motion & ambient light sensor modules for dimmers ( #278 )
2022-04-05 19:27:46 +02:00
Teemu R
e3588047fc
Improve usage module, consolidate API with emeter ( #249 )
...
* Consolidate API for both emeter&usage modules
* Add new cli command 'usage' to query usage
2022-04-05 19:27:46 +02:00
Teemu R
3926f3224f
Add module support & query their information during update cycle ( #243 )
...
* Add module support & modularize existing query
This creates a base to expose more features on the supported devices.
At the moment, the most visible change is that each update cycle gets information from all available modules:
* Basic system info
* Cloud (new)
* Countdown (new)
* Antitheft (new)
* Schedule (new)
* Time (existing, implements the time/timezone handling)
* Emeter (existing, partially separated from smartdevice)
* Fix imports
* Fix linting
* Use device host instead of alias in module repr
* Add property to list available modules, print them in cli state report
* usage: fix the get_realtime query
* separate usage from schedule to avoid multi-inheritance
* Fix module querying
* Add is_supported property to modules
2022-04-05 19:27:46 +02:00
Teemu R
7b9e3aae8a
Release 0.4.3 ( #332 )
...
This release fixes an issue where the bulb state on led strips was not restored properly when turned back on.
[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.4.2...0.4.3 )
**Fixed bugs:**
- Divide by zero when HS300 powerstrip is discovered [\#292](https://github.com/python-kasa/python-kasa/issues/292 )
- Ensure bulb state is restored when turning back on [\#330](https://github.com/python-kasa/python-kasa/pull/330 ) (@bdraco)
**Closed issues:**
- KL420L5 controls [\#327](https://github.com/python-kasa/python-kasa/issues/327 )
**Merged pull requests:**
- Update pre-commit hooks to fix black in CI [\#331](https://github.com/python-kasa/python-kasa/pull/331 ) (@rytilahti)
- Fix test\_deprecated\_type stalling [\#325](https://github.com/python-kasa/python-kasa/pull/325 ) (@bdraco)
2022-04-05 19:02:00 +02:00
J. Nick Koston
766819a2a4
Ensure bulb state is restored when turning back on ( #330 )
...
* Ensure state is restored when turning back on
Fixes https://github.com/home-assistant/core/issues/69039
* Update kasa/tests/test_bulb.py
Co-authored-by: Teemu R. <tpr@iki.fi>
Co-authored-by: Teemu R. <tpr@iki.fi>
2022-04-05 18:51:36 +02:00
Teemu R
a744af46ab
Update pre-commit deps to fix CI ( #331 )
2022-04-05 17:48:24 +02:00
J. Nick Koston
2b05751aa7
Fix test_deprecated_type stalling ( #325 )
2022-03-24 23:59:53 +01:00
Teemu R
6f5a60ad43
Release 0.4.2 ( #321 )
...
This is the last release prior restructuring the code to enable easier extendability by moving towards more modular architecture.
The most prominent change in this release is the support for effects on light strips.
[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.4.1...0.4.2 )
**Implemented enhancements:**
- Allow environment variables for discovery target, device type and debug [\#313](https://github.com/python-kasa/python-kasa/pull/313 ) (@rytilahti)
- Add 'internal\_state' to return the results from the last update query [\#306](https://github.com/python-kasa/python-kasa/pull/306 ) (@rytilahti)
- Drop microsecond precision for on\_since [\#296](https://github.com/python-kasa/python-kasa/pull/296 ) (@rytilahti)
- Add effect support for light strips [\#293](https://github.com/python-kasa/python-kasa/pull/293 ) (@bdraco)
**Fixed bugs:**
- TypeError: \_\_init\_\_\(\) got an unexpected keyword argument 'package\_name' [\#311](https://github.com/python-kasa/python-kasa/issues/311 )
- RuntimeError: Event loop is closed on WSL [\#294](https://github.com/python-kasa/python-kasa/issues/294 )
- Don't crash on devices not reporting features [\#317](https://github.com/python-kasa/python-kasa/pull/317 ) (@rytilahti)
**Closed issues:**
- SmartDeviceException: Communication error on system:set\_relay\_state [\#309](https://github.com/python-kasa/python-kasa/issues/309 )
- Add Support: ES20M and KS200M motion/light switches [\#308](https://github.com/python-kasa/python-kasa/issues/308 )
- New problem with installing on Ubuntu 20.04.3 LTS [\#305](https://github.com/python-kasa/python-kasa/issues/305 )
- KeyError: 'emeter' when discovering [\#302](https://github.com/python-kasa/python-kasa/issues/302 )
- RuntimeError: Event loop is closed [\#291](https://github.com/python-kasa/python-kasa/issues/291 )
- provisioning format [\#290](https://github.com/python-kasa/python-kasa/issues/290 )
- Fix CI publishing on pypi [\#222](https://github.com/python-kasa/python-kasa/issues/222 )
- LED strips effects are not supported \(was LEDs is not turning on after switching on\) [\#191](https://github.com/python-kasa/python-kasa/issues/191 )
**Merged pull requests:**
- Add pyupgrade to CI runs [\#314](https://github.com/python-kasa/python-kasa/pull/314 ) (@rytilahti)
- Depend on asyncclick \>= 8 [\#312](https://github.com/python-kasa/python-kasa/pull/312 ) (@rytilahti)
- Guard emeter accesses to avoid keyerrors [\#304](https://github.com/python-kasa/python-kasa/pull/304 ) (@rytilahti)
- cli: cleanup discover, fetch update prior device access [\#303](https://github.com/python-kasa/python-kasa/pull/303 ) (@rytilahti)
- Fix unsafe \_\_del\_\_ in TPLinkSmartHomeProtocol [\#300](https://github.com/python-kasa/python-kasa/pull/300 ) (@bdraco)
- Improve typing for protocol class [\#289](https://github.com/python-kasa/python-kasa/pull/289 ) (@rytilahti)
- Added a fixture file for KS220M [\#273](https://github.com/python-kasa/python-kasa/pull/273 ) (@mrbetta)
2022-03-21 22:34:44 +01:00
J. Nick Koston
58f6517445
Add effect support for light strips ( #293 )
...
* Add effect support for KL430
* KL400 supports effects
* Add KL400 fixture
* Comments from review
* actually commit the remove
2022-03-21 22:10:12 +01:00
Teemu R
b22f6b4eef
Don't crash on devices not reporting features ( #317 )
...
Returns an empty set if no feature information is available
2022-03-02 16:29:20 +01:00
Teemu R
e3d76bea75
Add pyupgrade to CI runs ( #314 )
2022-02-21 00:56:18 +01:00
Teemu R
db170cf1f5
Allow using environment variables for discovery target, device type and debug ( #313 )
...
* KASA_TYPE defines the device type (bulb, plug, dimmer, strip, lightstrip)
* KASA_TARGET to define discovery target
* KASA_DEBUG to enable debugging
2022-02-15 16:59:36 +01:00
Teemu R
15906ec232
Depend on asyncclick >= 8 ( #312 )
2022-02-14 18:26:51 +01:00
Teemu R
b61c0feea9
Add 'internal_state' to return the results from the last update query ( #306 )
...
This can be useful for debugging purposes, e.g., for homeassistant diagnostics
2022-02-07 09:13:47 +01:00
Teemu R
700f3859c2
Guard emeter accesses to avoid keyerrors ( #304 )
...
Raise an exception to inform the caller that update() is needed
2022-02-02 19:31:11 +01:00
Teemu R
9ea83388ac
cli: cleanup discover, fetch update prior device access ( #303 )
...
* Use on_discovered for smoother user experience
* Remove --discover-only as unnecessary
2022-02-02 19:30:48 +01:00
J. Nick Koston
c865d3f02c
Fix unsafe __del__ in TPLinkSmartHomeProtocol ( #300 )
...
* Fix unsafe __del__ in TPLinkSmartHomeProtocol
Fixes
```
Exception ignored in: <function TPLinkSmartHomeProtocol.__del__ at 0x1096d0670>
Traceback (most recent call last):
File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/kasa/protocol.py", line 159, in __del__
self.writer.close()
File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/streams.py", line 353, in close
return self._transport.close()
File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 700, in close
self._loop.call_soon(self._call_connection_lost, None)
File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 748, in call_soon
self._check_thread()
File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 785, in _check_thread
raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one
```
* comment
* comment
* comment
2022-01-30 23:00:00 +01:00
mrbetta
5bf6fda7ee
Added a fixture file for KS220M ( #273 )
...
* Added motion and light sensor for KS220M
* Added fixture file for ks220m
* Remove dump_devinfo and add the extra queries to devtools/dump_devinfo
* Test KS220M as a dimmer
* Add empty modules to baseproto to make the tests pass
Co-authored-by: mrbetta <bettale@gmail.com>
Co-authored-by: Teemu Rytilahti <tpr@iki.fi>
2022-01-29 18:28:14 +01:00
Teemu R
6a31de5381
Drop microsecond precision for on_since ( #296 )
2022-01-29 17:02:05 +01:00
Teemu R
bcb9fe18ab
Improve typing for protocol class ( #289 )
2022-01-14 23:08:25 +01:00
Teemu R
b4036e55ac
Prepare 0.4.1 ( #288 )
...
This minor release fixes issues that were found after homeassistant integration got converted over from pyhs100.
[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.4.0...0.4.1 )
**Implemented enhancements:**
- Add --type option to cli [\#269](https://github.com/python-kasa/python-kasa/pull/269 ) ([rytilahti](https://github.com/rytilahti ))
- Minor improvements to onboarding doc [\#264](https://github.com/python-kasa/python-kasa/pull/264 ) ([rytilahti](https://github.com/rytilahti ))
- Add fixture file for KL135 [\#263](https://github.com/python-kasa/python-kasa/pull/263 ) ([ErikSGross](https://github.com/ErikSGross ))
- Add KL135 color temperature range [\#256](https://github.com/python-kasa/python-kasa/pull/256 ) ([rytilahti](https://github.com/rytilahti ))
- Add py.typed to flag that the package is typed [\#251](https://github.com/python-kasa/python-kasa/pull/251 ) ([rytilahti](https://github.com/rytilahti ))
- Add script to check supported devices, update README [\#242](https://github.com/python-kasa/python-kasa/pull/242 ) ([rytilahti](https://github.com/rytilahti ))
- Add perftest to devtools [\#236](https://github.com/python-kasa/python-kasa/pull/236 ) ([rytilahti](https://github.com/rytilahti ))
- Add KP401 US fixture [\#234](https://github.com/python-kasa/python-kasa/pull/234 ) ([bdraco](https://github.com/bdraco ))
- Add KL60 US KP105 UK fixture [\#233](https://github.com/python-kasa/python-kasa/pull/233 ) ([bdraco](https://github.com/bdraco ))
- Make cli interface more consistent [\#232](https://github.com/python-kasa/python-kasa/pull/232 ) ([rytilahti](https://github.com/rytilahti ))
- Add KL400, KL50 fixtures [\#231](https://github.com/python-kasa/python-kasa/pull/231 ) ([bdraco](https://github.com/bdraco ))
- Add fixture for newer KP400 firmware [\#227](https://github.com/python-kasa/python-kasa/pull/227 ) ([bdraco](https://github.com/bdraco ))
- Switch to poetry-core [\#226](https://github.com/python-kasa/python-kasa/pull/226 ) ([fabaff](https://github.com/fabaff ))
- Add fixtures for LB110, KL110, EP40, KL430, KP115 [\#224](https://github.com/python-kasa/python-kasa/pull/224 ) ([bdraco](https://github.com/bdraco ))
**Fixed bugs:**
- Discovery on WSL results in OSError: \[Errno 22\] Invalid argument [\#246](https://github.com/python-kasa/python-kasa/issues/246 )
- New firmware for HS103 blocking local access? [\#42](https://github.com/python-kasa/python-kasa/issues/42 )
- Pin mistune to \<2.0.0 to fix doc builds [\#270](https://github.com/python-kasa/python-kasa/pull/270 ) ([rytilahti](https://github.com/rytilahti ))
- Catch exceptions raised on unknown devices during discovery [\#240](https://github.com/python-kasa/python-kasa/pull/240 ) ([rytilahti](https://github.com/rytilahti ))
**Closed issues:**
- Control device with alias via python api? [\#285](https://github.com/python-kasa/python-kasa/issues/285 )
- Can't install using pip install python-kasa [\#255](https://github.com/python-kasa/python-kasa/issues/255 )
- Kasa Smart Bulb KL135 - Unknown color temperature range error [\#252](https://github.com/python-kasa/python-kasa/issues/252 )
- KL400 Support [\#247](https://github.com/python-kasa/python-kasa/issues/247 )
- Cloud support? [\#245](https://github.com/python-kasa/python-kasa/issues/245 )
- Support for kp401 [\#241](https://github.com/python-kasa/python-kasa/issues/241 )
- LB130 Bulb stopped working [\#237](https://github.com/python-kasa/python-kasa/issues/237 )
- Unable to constantly query bulb in loop [\#225](https://github.com/python-kasa/python-kasa/issues/225 )
- HS103: Unable to query the device: unpack requires a buffer of 4 bytes [\#187](https://github.com/python-kasa/python-kasa/issues/187 )
- Help request - query value [\#171](https://github.com/python-kasa/python-kasa/issues/171 )
- Can't Discover Devices [\#164](https://github.com/python-kasa/python-kasa/issues/164 )
- Concurrency performance question [\#110](https://github.com/python-kasa/python-kasa/issues/110 )
- Define the port by self? [\#108](https://github.com/python-kasa/python-kasa/issues/108 )
- Convert homeassistant integration to use the library [\#9](https://github.com/python-kasa/python-kasa/issues/9 )
**Merged pull requests:**
- Publish to pypi on github release published [\#287](https://github.com/python-kasa/python-kasa/pull/287 ) ([rytilahti](https://github.com/rytilahti ))
- Relax asyncclick version requirement [\#286](https://github.com/python-kasa/python-kasa/pull/286 ) ([rytilahti](https://github.com/rytilahti ))
- Do not crash on discovery on WSL [\#283](https://github.com/python-kasa/python-kasa/pull/283 ) ([rytilahti](https://github.com/rytilahti ))
- Add python 3.10 to CI [\#279](https://github.com/python-kasa/python-kasa/pull/279 ) ([rytilahti](https://github.com/rytilahti ))
- Use codecov-action@v2 for CI [\#277](https://github.com/python-kasa/python-kasa/pull/277 ) ([rytilahti](https://github.com/rytilahti ))
- Add coverage\[toml\] dependency to fix coverage on CI [\#271](https://github.com/python-kasa/python-kasa/pull/271 ) ([rytilahti](https://github.com/rytilahti ))
- Allow publish on test pypi workflow to fail [\#248](https://github.com/python-kasa/python-kasa/pull/248 ) ([rytilahti](https://github.com/rytilahti ))
2022-01-14 16:47:49 +01:00
Teemu R
255c0c9a25
Publish to pypi on github release published ( #287 )
...
* Publish to pypi on github release published, remove testpypi
* Remove release tag check
2022-01-14 16:32:48 +01:00
Teemu R
6ece506a3b
Relax asyncclick version requirement ( #286 )
...
* Add package_name to version_option(), breaks --version on click < 8
2022-01-14 16:32:32 +01:00
Teemu R
723fca9d08
Do not crash on discovery on WSL ( #283 )
2022-01-08 17:48:01 +01:00
Teemu R
a817d9cab1
Add python 3.10 to CI ( #279 )
...
* Add python 3.10 to CI
* Require pytest >=6.2.5
Required for running on python 3.10 (https://github.com/pytest-dev/pytest/pull/8540 )
* Update lockfile
* Update pre-commit hooks
2021-12-17 17:48:03 +01:00
Teemu R
d2efaf5090
Add --type option to cli ( #269 )
...
* Add support for controlling dimmers
* Deprecate --bulb, --plug, --strip, --lightstrip
2021-12-13 20:17:54 +01:00
Teemu R
cf98674c3a
Use codecov-action@v2 for CI ( #277 )
2021-12-13 18:58:46 +01:00
Teemu R
62c9f0ae64
Add coverage[toml] dependency to fix coverage on CI ( #271 )
2021-12-13 18:40:50 +01:00
Teemu R
6aea09fc44
Minor improvements to onboarding doc ( #264 )
...
This makes the commands more copy&pastable on new devices
2021-12-08 15:32:57 +01:00
Teemu R
8554a1db29
Pin mistune to <2.0.0 to fix doc builds ( #270 )
2021-12-08 15:31:55 +01:00
ErikSGross
6b18c5cd55
Add fixture file for KL135 ( #263 )
...
* Create new fixture file for KL135
* Add KL135 to COLOR_BULBS and VARIABLE_TEMP lists
2021-12-06 16:31:27 +01:00
Teemu R
a468d520c0
Add KL135 color temperature range ( #256 )
2021-11-19 18:08:20 +01:00
Teemu R
351e86bfa3
Add py.typed to flag that the package is typed ( #251 )
2021-11-15 18:21:24 +01:00
Teemu R
5aaadaff39
Allow publish on test pypi workflow to fail ( #248 )
2021-11-03 01:55:49 +01:00
Teemu R
9cda529329
Catch exceptions raised on unknown devices during discovery ( #240 )
2021-10-29 02:44:51 +02:00
Teemu R
8a4068c623
Add script to check supported devices, update README ( #242 )
...
* check_readme_vs_fixtures.py checks if a device with a fixture is listed in the README
* Add missing entries to README.md
2021-10-25 10:17:35 +03:00
Teemu R
d75e1adaba
Add perftest to devtools ( #236 )
...
* Add perftest to devtools
* Add example output from the perf script
* Rename to avoid pytest collection
* Fix git mv failing to remove the original file..
2021-10-13 19:22:24 +02:00
J. Nick Koston
85a618f7c6
Add KP401 fixture ( #234 )
2021-10-11 17:13:00 +02:00
J. Nick Koston
cf151ead4a
Add KL60 US KP105 UK fixture ( #233 )
...
* Add KL60 US fixture
* Add KP105 UK fixture
* update test
2021-10-09 16:44:32 +02:00
Teemu R
e06b9a71e5
Make cli interface more consistent ( #232 )
2021-10-09 16:36:36 +02:00
J. Nick Koston
c65705bbbf
Add KL400, KL50 fixtures ( #231 )
...
* Add KL400 fixture
* Add KL400 fixture
* Add KL50 fixture
* tweaks
2021-10-08 00:15:32 +02:00
J. Nick Koston
98b4155c11
Add fixture for newer KP400 firmware ( #227 )
2021-10-04 20:40:31 +02:00
J. Nick Koston
0bcab39e60
Add fixtures for LB110, KL110, EP40, KL430, KP115 ( #224 )
...
* Add fixtures for LB110, KL110, EP40
* update schema
* kl430 fixture
* Add KP115 US fixture
2021-10-02 15:41:14 +02:00
Fabian Affolter
7b99f7e9a4
Switch to poetry-core ( #226 )
2021-10-02 00:51:16 +02:00
Teemu R
1a3c73e42f
Release 0.4.0 ( #221 )
...
This is the first proper python-kasa release since forking from pyhs100.
* Improved I/O handling, including asyncio interface, request merging & connection sharing
* API improvements throughout the whole package
* Support for LED strips
* Improved bulb support (transitions, support for more models)
* Onboarding is now possible without a mobile app
* Improved documentation
* And various other improvements, see the full changelog for details!
Thanks to all contributors, from testers, and issue reporters to those who have submitted pull requests! Thanks also to those who donated test devices to help to make this release happen!
Special thanks for this release go to @basnijholt (initial asyncio port, push to make this fork happen) and @bdraco (fixing the last release blocker, emeter support for powerstrips).
If you are using python-kasa in your projects, we would be happy to hear about it. Feel free to post a note on Github discussions!
If it is a project that could be interesting for other users and/or developers, feel also free to create a PR to add a short note to the README file.
2021-09-27 19:10:05 +02:00