Skip to content

Commit

Permalink
tapo-py: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mihai-dinculescu committed Oct 1, 2023
1 parent 65aee2a commit 853c868
Showing 1 changed file with 64 additions and 11 deletions.
75 changes: 64 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ Unofficial Tapo API Client. Works with TP-Link Tapo smart devices. Tested with l

## Device support

✓ - Rust only\
✅ - Rust and Python

| Feature | GenericDevice | L510, L610 | L530, L630, L900 | L920, L930 | P100, P105 | P110, P115 |
| --------------------- | ------------: | ---------: | ---------------: | ---------: | ---------: | ---------: |
| on | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| off | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| get_device_info | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| get_device_usage | | ✓ | ✓ | ✓ | ✓ | ✓ |
| get_energy_usage | | | | | | ✓ |
| get_energy_data | | | | | | ✓ |
| get_current_power | | | | | | ✓ |
| on | ✓ | ✓ | ✓ | ✓ | ✅ | ✅ |
| off | ✓ | ✓ | ✓ | ✓ | ✅ | ✅ |
| get_device_info | ✓ | ✓ | ✓ | ✓ | ✅ | ✅ |
| get_device_usage | | ✓ | ✓ | ✓ | ✅ | ✅ |
| get_energy_usage | | | | | | ✅ |
| get_energy_data | | | | | | ✅ |
| get_current_power | | | | | | ✅ |
| set_brightness | | ✓ | ✓ | ✓ | | |
| set_color | | | ✓ | ✓ | | |
| set_hue_saturation | | | ✓ | ✓ | | |
Expand All @@ -37,7 +40,27 @@ Unofficial Tapo API Client. Works with TP-Link Tapo smart devices. Tested with l

\* Obtained by calling `get_child_device_list` on the hub device or `get_device_info` on a child handler.

## Examples (Rust)

## Rust

### Usage

> Cargo.toml
```toml
[dependencies]
tapo = "0.7"
```

> main.rs
```rust
let device = ApiClient::new("<tapo-username>", "tapo-password")?
.p110("<device ip address>")
.await?;

device.on().await?;
```

### Examples

```bash
export TAPO_USERNAME=
Expand All @@ -47,14 +70,43 @@ export IP_ADDRESS=
cargo run --example tapo_l530
```

See all examples in [/examples][examples].
See all examples in [/tapo/examples][examples].

### Wrapper REST API
[tapo-rest][tapo_rest] is a REST wrapper of this library that can be deployed as a service or serve as an advanced example.

## Examples (Python)
## Python

### Usage

```bash
pip install tapo
```

```python
client = ApiClient("<tapo-username>", "tapo-password")
device = await client.p110("<device ip address>")

await device.on()
```

### Examples

```bash
cd tapo-py
poetry install
poetry shell

export TAPO_USERNAME=
export TAPO_PASSWORD=
export IP_ADDRESS=
```

```bash
python examples/tapo_p110.py
```

The Python wrapper is still WIP. Examples will be added when it's ready for use.
See all examples in [/tapo-py/examples][examples-py].

## Contributing

Expand Down Expand Up @@ -97,6 +149,7 @@ Inspired by [petretiandrea/plugp100][inspired_by].
[license]: https://github.com/mihai-dinculescu/tapo/blob/main/LICENSE
[crates_downloads_badge]: https://img.shields.io/crates/d/tapo?label=downloads
[examples]: https://github.com/mihai-dinculescu/tapo/tree/main/tapo/examples
[examples-py]: https://github.com/mihai-dinculescu/tapo/tree/main/tapo-py/examples
[tapo_rest]: https://github.com/ClementNerma/tapo-rest
[contributing]: https://github.com/mihai-dinculescu/tapo/blob/main/CONTRIBUTING.md
[inspired_by]: https://github.com/petretiandrea/plugp100

0 comments on commit 853c868

Please sign in to comment.