Commit Graph

1031 Commits

Author SHA1 Message Date
Teemu R.
b2f3971a4c
Add PIR&LAS for wall switches mentioning PIR support (#1227)
Some devices (like KS200M) support ambient and motion, but as they are
detected as wall switches, they don't get the modules added.
This PR enables the respective modules for wall switches when the
`dev_name` contains `PIR`.
2024-11-03 16:45:48 +01:00
Teemu R.
0360107e3f
Add childprotection module (#1141)
When turned on, rotating the thermostat will not change the target
temperature.
2024-11-01 20:46:36 +01:00
Steven B.
77b654a9aa
Update try_connect_all to be more efficient and report attempts (#1222) 2024-11-01 18:17:18 +00:00
Teemu R.
70c96b5a5d
Initial trigger logs implementation (#900)
Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
2024-11-01 15:36:09 +00:00
Teemu R.
8969b54b87
Update TC65 fixture (#1225) 2024-11-01 15:17:52 +00:00
Steven B.
7335a7d33f
Update smartcamera fixtures from latest dump_devinfo (#1224) 2024-11-01 15:15:13 +00:00
Steven B.
54f0e91c04
Add component queries to smartcamera devices (#1223) 2024-11-01 14:52:39 +00:00
Steven B.
e73da5b677
Fix AES child device creation error (#1220)
Bug exposed when passing credentials_hash and creating child devices for
klap devices as the default is to try to create an AES transport and the
credentials hashes are incompatible.
2024-10-31 15:21:54 +00:00
Teemu R.
5da41fcc11
Use stacklevel=2 for warnings to report on callsites (#1219)
Use stacklevel=2 for warnings, as this will correctly show the callsite
instead of the line where the warning is reported.

Currently:
```
kasa/__init__.py:110
  /home/tpr/code/python-kasa/kasa/__init__.py:110: DeprecationWarning: SmartDevice is deprecated, use IotDevice from package kasa.iot instead or use Discover.discover_single() and Device.connect() to support new protocols
    warn(
```

After:
```
kasa/tests/smart/modules/test_contact.py:3
  /home/tpr/code/python-kasa/kasa/tests/smart/modules/test_contact.py:3: DeprecationWarning: SmartDevice is deprecated, use IotDevice from package kasa.iot instead or use Discover.discover_single() and Device.connect() to support new protocols
    from kasa import Module, SmartDevice

``` 

Currently:
```
kasa/tests/test_lightstrip.py: 56 warnings
  /home/tpr/code/python-kasa/kasa/device.py:559: DeprecationWarning: effect is deprecated, use: Module.LightEffect in device.modules instead
    warn(msg, DeprecationWarning, stacklevel=1)
```

After:
```
kasa/tests/test_lightstrip.py::test_effects_lightstrip_set_effect_transition[500-KL430(US)_2.0_1.0.9.json]
  /home/tpr/code/python-kasa/kasa/tests/test_lightstrip.py:62: DeprecationWarning: set_effect is deprecated, use: Module.LightEffect in device.modules instead
    await dev.set_effect("Candy Cane")
```
2024-10-31 14:12:17 +01:00
Teemu R.
6c141c3b65
Expose ambient light setting for iot dimmers (#1210)
This PR adds a setting to control the ambient light enabled/disabled.

Also fixes the getters.
2024-10-31 12:17:18 +01:00
Teemu R.
9975bbf26a
Expose PIR enabled setting for iot dimmers (#1174)
This adds PIR enabled feature to iot dimmers, making it possible to
enable and disable the motion detection.
2024-10-31 10:41:11 +00:00
Steven B.
530cf4b523
Prepare 0.7.6 (#1213)
## [0.7.6](https://github.com/python-kasa/python-kasa/tree/0.7.6) (2024-10-29)

[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.7.5...0.7.6)

**Release summary:**

- Experimental support for Tapo cameras and the Tapo H200 hub which uses the same protocol.
- Better timestamp support across all devices.
- Support for new devices P304M, S200D and S200B (see README.md for note on the S200 support).
- Various other fixes and minor features.

**Implemented enhancements:**

- Add support for setting the timezone [\#436](https://github.com/python-kasa/python-kasa/issues/436)
- Add stream\_rtsp\_url to camera module [\#1197](https://github.com/python-kasa/python-kasa/pull/1197) (@sdb9696)
- Try default logon credentials in SslAesTransport [\#1195](https://github.com/python-kasa/python-kasa/pull/1195) (@sdb9696)
- Allow enabling experimental devices from environment variable [\#1194](https://github.com/python-kasa/python-kasa/pull/1194) (@sdb9696)
- Add core device, child and camera modules to smartcamera [\#1193](https://github.com/python-kasa/python-kasa/pull/1193) (@sdb9696)
- Fallback to get\_current\_power if get\_energy\_usage does not provide current\_power [\#1186](https://github.com/python-kasa/python-kasa/pull/1186) (@Fulch36)
- Add https parameter to device class factory [\#1184](https://github.com/python-kasa/python-kasa/pull/1184) (@sdb9696)
- Add discovery list command to cli [\#1183](https://github.com/python-kasa/python-kasa/pull/1183) (@sdb9696)
- Add Time module to SmartCamera devices [\#1182](https://github.com/python-kasa/python-kasa/pull/1182) (@sdb9696)
- Add try\_connect\_all to allow initialisation without udp broadcast [\#1171](https://github.com/python-kasa/python-kasa/pull/1171) (@sdb9696)
- Update dump\_devinfo for smart camera protocol [\#1169](https://github.com/python-kasa/python-kasa/pull/1169) (@sdb9696)
- Enable newer encrypted discovery protocol [\#1168](https://github.com/python-kasa/python-kasa/pull/1168) (@sdb9696)
- Initial TapoCamera support [\#1165](https://github.com/python-kasa/python-kasa/pull/1165) (@sdb9696)
- Add waterleak alert timestamp [\#1162](https://github.com/python-kasa/python-kasa/pull/1162) (@rytilahti)
- Create common Time module and add time set cli command [\#1157](https://github.com/python-kasa/python-kasa/pull/1157) (@sdb9696)

**Fixed bugs:**

- Only send 20002 discovery request with key included [\#1207](https://github.com/python-kasa/python-kasa/pull/1207) (@sdb9696)
- Fix SslAesTransport default login and add tests [\#1202](https://github.com/python-kasa/python-kasa/pull/1202) (@sdb9696)
- Fix device\_config serialisation of https value [\#1196](https://github.com/python-kasa/python-kasa/pull/1196) (@sdb9696)

**Added support for devices:**

- Add S200B\(EU\) fw 1.11.0 fixture [\#1205](https://github.com/python-kasa/python-kasa/pull/1205) (@sdb9696)
- Add TC65 fixture [\#1200](https://github.com/python-kasa/python-kasa/pull/1200) (@rytilahti)
- Add P304M\(UK\) test fixture [\#1185](https://github.com/python-kasa/python-kasa/pull/1185) (@Fulch36)
- Add H200 experimental fixture [\#1180](https://github.com/python-kasa/python-kasa/pull/1180) (@sdb9696)
- Add S200D button fixtures [\#1161](https://github.com/python-kasa/python-kasa/pull/1161) (@rytilahti)

**Project maintenance:**

- Fix mypy errors in parse_pcap_klap [\#1214](https://github.com/python-kasa/python-kasa/pull/1214) (@sdb9696)
- Make HSV NamedTuple creation more efficient [\#1211](https://github.com/python-kasa/python-kasa/pull/1211) (@sdb9696)
- dump\_devinfo: query get\_current\_brt for iot dimmers [\#1209](https://github.com/python-kasa/python-kasa/pull/1209) (@rytilahti)
- Add trigger\_logs and double\_click to dump\_devinfo helper [\#1208](https://github.com/python-kasa/python-kasa/pull/1208) (@sdb9696)
- Fix smartcamera childdevice module [\#1206](https://github.com/python-kasa/python-kasa/pull/1206) (@sdb9696)
- Add H200\(EU\) fw 1.3.2 fixture [\#1204](https://github.com/python-kasa/python-kasa/pull/1204) (@sdb9696)
- Do not pass None as timeout to http requests [\#1203](https://github.com/python-kasa/python-kasa/pull/1203) (@sdb9696)
- Update SMART test framework to use fake child protocols [\#1199](https://github.com/python-kasa/python-kasa/pull/1199) (@sdb9696)
- Allow passing an aiohttp client session during discover try\_connect\_all [\#1198](https://github.com/python-kasa/python-kasa/pull/1198) (@sdb9696)
- Add test framework for smartcamera [\#1192](https://github.com/python-kasa/python-kasa/pull/1192) (@sdb9696)
- Rename experimental fixtures folder to smartcamera [\#1191](https://github.com/python-kasa/python-kasa/pull/1191) (@sdb9696)
- Combine smartcamera error codes into SmartErrorCode [\#1190](https://github.com/python-kasa/python-kasa/pull/1190) (@sdb9696)
- Allow deriving from SmartModule without being registered [\#1189](https://github.com/python-kasa/python-kasa/pull/1189) (@sdb9696)
- Improve supported module checks for hub children [\#1188](https://github.com/python-kasa/python-kasa/pull/1188) (@sdb9696)
- Update smartcamera to support single get/set/do requests [\#1187](https://github.com/python-kasa/python-kasa/pull/1187) (@sdb9696)
- Add S200B\(US\) fw 1.12.0 fixture [\#1181](https://github.com/python-kasa/python-kasa/pull/1181) (@sdb9696)
- Add T110\(US\), T310\(US\) and T315\(US\) sensor fixtures [\#1179](https://github.com/python-kasa/python-kasa/pull/1179) (@sdb9696)
- Enforce EOLs for \*.rst and \*.md [\#1178](https://github.com/python-kasa/python-kasa/pull/1178) (@rytilahti)
- Convert fixtures to use unix newlines [\#1177](https://github.com/python-kasa/python-kasa/pull/1177) (@rytilahti)
- Add motion sensor to known categories [\#1176](https://github.com/python-kasa/python-kasa/pull/1176) (@rytilahti)
- Drop urllib3 dependency and create ssl context in executor thread [\#1175](https://github.com/python-kasa/python-kasa/pull/1175) (@sdb9696)
- Expose smart child device map as a class constant [\#1173](https://github.com/python-kasa/python-kasa/pull/1173) (@sdb9696)
2024-10-29 18:05:22 +00:00
Steven B.
1f1d50dd5c
Fix mypy errors in parse_pcap_klap (#1214) 2024-10-29 17:57:40 +00:00
Steven B.
673a32258f
Make HSV NamedTuple creation more efficient (#1211) 2024-10-29 17:14:52 +00:00
Steven B.
6d8dc1cc5f
Only send 20002 discovery request with key included (#1207) 2024-10-29 16:21:24 +00:00
Steven B.
b82743a5de
Do not pass None as timeout to http requests (#1203) 2024-10-29 11:52:53 +00:00
Steven B.
7483411ca2
Add trigger_logs and double_click to dump_devinfo helper (#1208) 2024-10-29 09:50:27 +00:00
Steven B.
450bcf0bde
Add S200B(US) fw 1.12.0 fixture (#1181) 2024-10-29 09:49:49 +00:00
Teemu R.
5cde7cba27
Add S200D button fixtures (#1161)
Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
2024-10-29 09:37:34 +00:00
Steven B.
4aec9d302f
Allow enabling experimental devices from environment variable (#1194) 2024-10-29 09:30:30 +00:00
Teemu R.
d30d116f37
dump_devinfo: query get_current_brt for iot dimmers (#1209) 2024-10-29 10:30:13 +01:00
Steven B.
ad6472c05d
Add H200(EU) fw 1.3.2 fixture (#1204) 2024-10-29 09:18:17 +00:00
Steven B.
fdadeebaa9
Add S200B(EU) fw 1.11.0 fixture (#1205)
Adds a note about button presses not being supported.
2024-10-29 09:58:47 +01:00
Steven B.
e7f921299a
Fix smartcamera childdevice module (#1206)
Unlike most `smartcamera` queries, the child info query request and response have
different section names, i.e. `controlChild` and `child_device_list` respectively.
2024-10-29 07:11:31 +00:00
Steven B.
440b2d153b
Fix SslAesTransport default login and add tests (#1202)
Co-authored-by: Teemu R. <tpr@iki.fi>
2024-10-28 16:36:34 +00:00
Teemu R.
0287606235
Add TC65 fixture (#1200) 2024-10-28 13:47:24 +01:00
Fulch36
c051e75d1d
Add P304M(UK) test fixture (#1185)
P304M supports energy monitoring on child SMART devices.
2024-10-27 12:15:13 +00:00
Steven B.
5161115621
Update SMART test framework to use fake child protocols (#1199) 2024-10-27 12:08:02 +00:00
Steven B.
88b7951fee
Allow passing an aiohttp client session during discover try_connect_all (#1198) 2024-10-25 19:43:37 +01:00
Steven B.
7eb8d45b6e
Try default logon credentials in SslAesTransport (#1195)
Also ensure `AuthenticationErrors` are raised during handshake1.
2024-10-25 19:27:40 +01:00
Fulch36
8b95b7d557
Fallback to get_current_power if get_energy_usage does not provide current_power (#1186) 2024-10-25 19:24:43 +01:00
Steven B.
1e0ca799bc
Add stream_rtsp_url to camera module (#1197) 2024-10-25 18:30:21 +01:00
Steven B.
91e219f467
Fix device_config serialisation of https value (#1196) 2024-10-25 18:04:43 +01:00
Steven B.
e3610cf37e
Add Time module to SmartCamera devices (#1182) 2024-10-24 19:11:21 +01:00
Steven B.
28361c1727
Add core device, child and camera modules to smartcamera (#1193)
Co-authored-by: Teemu R. <tpr@iki.fi>
2024-10-24 17:22:45 +01:00
Steven B.
8ee8c17bdc
Update smartcamera to support single get/set/do requests (#1187)
Not supported by H200 hub
2024-10-24 13:11:28 +01:00
Steven B.
c839aaa1dd
Add test framework for smartcamera (#1192) 2024-10-24 09:36:18 +01:00
Steven B.
51958d8078
Allow deriving from SmartModule without being registered (#1189) 2024-10-23 21:42:01 +01:00
Steven B.
a88b677776
Combine smartcamera error codes into SmartErrorCode (#1190)
Having these in a seperate place complicates the code unnecessarily.
2024-10-23 20:07:32 +01:00
Steven B.
a0f3f016a2
Rename experimental fixtures folder to smartcamera (#1191) 2024-10-23 19:26:11 +01:00
Steven B.
cd0a74ca96
Improve supported module checks for hub children (#1188)
No devices in `fixtures/smart/child` support the `get_device_time` or
`get_device_usage` methods so this PR tests for whether the device is a
hub child and marks those modules/methods as not supported. This
prevents features being erroneously created on child devices.

It also moves the logic for getting the time from the parent module
behind getting it from the child module which was masking the creation
of these unsupported modules.
2024-10-23 17:17:27 +02:00
Steven B.
048c84d72c
Add https parameter to device class factory (#1184)
`SMART.TAPOHUB` resolves to different device classes based on the https value
2024-10-22 18:09:35 +01:00
Steven B.
3c865b5fb6
Add try_connect_all to allow initialisation without udp broadcast (#1171)
- Try all valid combinations of protocol/transport/device class and attempt to connect. 
- Add cli command `discover config` to return the connection options after connecting via `try_connect_all`.
- The cli command does not return the actual device for processing as this is not a recommended way to regularly connect to devices.
2024-10-22 14:33:46 +01:00
Steven B.
852116795c
Add discovery list command to cli (#1183)
Report discovered devices in a concise table format.
2024-10-22 12:15:08 +01:00
Steven B.
53fafc3994
Add T110(US), T310(US) and T315(US) sensor fixtures (#1179)
Many thanks to @SirWaddles for the fixtures!
2024-10-18 16:05:53 +02:00
Teemu R.
8d0a5c69ef
Enforce EOLs for *.rst and *.md (#1178)
Looks like everything was fine, but let's do this nevertheless.
2024-10-18 16:03:57 +02:00
Steven B.
d5450d89ff
Add H200 experimental fixture (#1180) 2024-10-18 14:02:08 +01:00
Teemu R.
6ba7c4ac05
Convert fixtures to use unix newlines (#1177)
Also, add a .gitattributes entry to let git handle this automatically
for json files
2024-10-18 14:00:23 +02:00
Teemu R.
8a17752ae2
Add waterleak alert timestamp (#1162)
The T300 reports the timestamp of the last alarm, this exposes it to
consumers.
2024-10-18 13:18:12 +02:00
Steven B.
acd0202cab
Update dump_devinfo for smart camera protocol (#1169)
Introduces the child camera protocol wrapper, required to get the child device info with the new protocol.
2024-10-18 12:06:22 +01:00