python-kasa/kasa/tests
cobryan05 a2444da9df
Split queries to avoid overflowing device buffers (#502)
Several KASA devices seem to have pretty strict buffer size limitations on incoming/outgoing data transfers.

Testing on KL125-US and HL103 has shown that sending a request size larger than about ~768 bytes will immediately crash the device. Additionally, a query that generates a response larger than ~4096 bytes will crash the KL125-US. I was unable to generate such a large response to test the HL103.

The KL125-US will only return such large queries when its monthly usage stats have been populated. This means that a new bulb would work fine, but after a month of data collection the bulb would break the 4K limit and start to crash.

To work around this issue, an estimated worst-case response size is calculated before sending a request by summing up all modules estimated response size. If the estimated size is greater than the device's max_response_payload_size then the query will be split into multiple queries.

This PR implements splitting queries expected to have large responses and also removes the module 'skip list' which was a previous workaround to the crash (which worked by simply reducing the number of modules queried, which prevented the overflow) since it is no longer necessary.

This PR does not attempt to address the "input buffer size limit." Thus far this limit has not been an issue.
2023-09-14 20:51:40 +02:00
..
fixtures Add new HS100(UK) fixture (#489) 2023-08-03 13:20:09 +02:00
__init__.py mass rename to (python-)kasa (#1) 2019-12-18 09:11:18 +01:00
conftest.py Add tests for KP200 (#483) 2023-07-22 23:55:42 +02:00
newfakes.py Some release preparation janitoring (#432) 2023-02-18 22:09:35 +01:00
test_bulb.py Allow effect presets seen on light strips (#440) 2023-04-01 16:15:58 +02:00
test_cli.py Add plumbing for passing credentials to devices (#507) 2023-09-13 15:46:38 +02:00
test_dimmer.py Fix pytest warnings about asyncio (#397) 2022-11-13 23:34:47 +01:00
test_discovery.py Add support for alternative discovery protocol (20002/udp) (#488) 2023-08-29 15:04:28 +02:00
test_emeter.py Fix pytest warnings about asyncio (#397) 2022-11-13 23:34:47 +01:00
test_lightstrip.py Add transition parameter to lightstrip's set_effect (#416) 2023-02-18 18:03:54 +01:00
test_plug.py Fix pytest warnings about asyncio (#397) 2022-11-13 23:34:47 +01:00
test_protocol.py Make device port configurable (#471) 2023-07-10 01:55:27 +02:00
test_readme_examples.py Drop python 3.7 support (#455) 2023-05-17 20:03:08 +02:00
test_smartdevice.py Split queries to avoid overflowing device buffers (#502) 2023-09-14 20:51:40 +02:00
test_strip.py Some release preparation janitoring (#432) 2023-02-18 22:09:35 +01:00
test_usage.py Return usage.get_{monthstat,daystat} in expected format (#394) 2023-02-18 20:53:02 +01:00