python-kasa/devtools
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
..
check_readme_vs_fixtures.py Add script to check supported devices, update README (#242) 2021-10-25 10:17:35 +03:00
dump_devinfo.py Added a fixture file for KS220M (#273) 2022-01-29 18:28:14 +01:00
parse_pcap.py Return None instead of raising an exception on missing, valid emeter keys (#146) 2021-03-18 19:22:10 +01:00
perftest.py Add perftest to devtools (#236) 2021-10-13 19:22:24 +02:00
README.md Add perftest to devtools (#236) 2021-10-13 19:22:24 +02:00

Tools for developers

This directory contains some simple scripts that can be useful for developers.

dump_devinfo

  • Queries the device and returns a fixture that can be added to the test suite
Usage: dump_devinfo.py [OPTIONS] HOST

  Generate devinfo file for given device.

Options:
  -d, --debug
  --help       Show this message and exit.

parse_pcap

  • Requires dpkt (pip install dpkt)
  • Reads a pcap file and prints out the device communications
Usage: parse_pcap.py [OPTIONS] FILE

  Parse pcap file and pretty print the communications and some statistics.

Options:
  --help  Show this message and exit.

perftest

  • Runs several rounds of update cycles for the given list of addresses, and prints out statistics about the performance
Usage: perf_test.py [OPTIONS] [ADDRS]...

Options:
  --rounds INTEGER
  --help            Show this message and exit.
$ python perf_test.py 192.168.xx.x 192.168.xx.y 192.168.xx.z 192.168.xx.f
Running 5 rounds on ('192.168.xx.x', '192.168.xx.y', '192.168.xx.z', '192.168.xx.f')
=== Testing using gather on all devices ===
              took
             count      mean       std      min       25%       50%       75%       max
type
concurrently   5.0  0.097161  0.045544  0.05260  0.055332  0.088811  0.143082  0.145981
sequential     5.0  0.150506  0.005798  0.14162  0.149065  0.150499  0.155579  0.155768
=== Testing per-device performance ===
                           took
                          count      mean       std       min       25%       50%       75%       max
id
<id>-HS110(EU)   5.0  0.044917  0.014984  0.035836  0.037728  0.037950  0.041610  0.071458
<id>-KL130(EU)   5.0  0.067626  0.032027  0.046451  0.046797  0.048406  0.076136  0.120342
<id>-HS110(EU)   5.0  0.055700  0.016174  0.042086  0.045578  0.048905  0.059869  0.082064
<id>-KP303(UK)   5.0  0.010298  0.003765  0.007773  0.007968  0.008546  0.010439  0.016763