Prometheus exporter for TP-Link Kasa smart home products.
This is an experiment in learning Rust and tokio library.
All three as reported by API with device_id
and device_alias
labels:
device_current
device_power
device_voltage
Install Rust, then from cloned repo:
$ cargo build
If you wish to see debug output with requests and responses to Kasa API,
you can pass --features kasa_debug
to cargo build
:
$ cargo build --features kasa_debug
After Building, run the command to get help:
``` $ ./target/debug/kasaexporter --help kasaexporter 0.1.0 Ivan Babrou hello@ivan.computer
USAGE:
kasa_exporter [OPTIONS] --kasa.password
FLAGS: -h, --help Prints help information -V, --version Prints version information
OPTIONS:
--kasa.password
Note that web.listen-address
expects <ip>:<port>
, e.g.:
127.0.0.1:12345
for IPv4[::1]:12345
for IPv6Example response:
``` $ curl http://localhost:12345/
deviceelectriccurrentamperes{devicealias="Banana",deviceid="800607035E84C0B634C36B7DF52CCEC3188C1BAB"} 0.256972 deviceelectriccurrentamperes{devicealias="Potato",deviceid="800691A498F774D60997B91E241EE2CC18D08921"} 0.031424
deviceelectricpotentialvolts{devicealias="Banana",deviceid="800607035E84C0B634C36B7DF52CCEC3188C1BAB"} 123.16094 deviceelectricpotentialvolts{devicealias="Potato",deviceid="800691A498F774D60997B91E241EE2CC18D08921"} 123.130631
deviceelectricpowerwatts{devicealias="Banana",deviceid="800607035E84C0B634C36B7DF52CCEC3188C1BAB"} 30.071476 deviceelectricpowerwatts{devicealias="Potato",deviceid="800691A498F774D60997B91E241EE2CC18D08921"} 0.750854 ```
MIT