-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the P304 power strip
- Loading branch information
1 parent
1c70dea
commit 79a4075
Showing
8 changed files
with
60 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ version = "0.7.16" | |
edition = "2021" | ||
license = "MIT" | ||
authors = ["Mihai Dinculescu <[email protected]>"] | ||
description = "Unofficial Tapo API Client. Works with TP-Link Tapo smart devices. Tested with light bulbs (L510, L520, L530, L535, L610, L630), light strips (L900, L920, L930), plugs (P100, P105, P110, P115, P300), hubs (H100), switches (S200B) and sensors (KE100, T100, T110, T300, T310, T315)." | ||
description = "Unofficial Tapo API Client. Works with TP-Link Tapo smart devices. Tested with light bulbs (L510, L520, L530, L535, L610, L630), light strips (L900, L920, L930), plugs (P100, P105, P110, P115), power strips (P300, P304), hubs (H100), switches (S200B) and sensors (KE100, T100, T110, T300, T310, T315)." | ||
keywords = ["IOT", "tapo", "smart-home", "smart-bulb", "smart-plug"] | ||
categories = ["hardware-support", "embedded", "development-tools"] | ||
readme = "README.md" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -457,6 +457,32 @@ impl ApiClient { | |
Ok(PowerStripHandler::new(self)) | ||
} | ||
|
||
/// Specializes the given [`ApiClient`] into an authenticated [`PowerStripHandler`]. | ||
/// | ||
/// # Arguments | ||
/// | ||
/// * `ip_address` - the IP address of the device | ||
/// | ||
/// # Example | ||
/// | ||
/// ```rust,no_run | ||
/// # use tapo::ApiClient; | ||
/// # #[tokio::main] | ||
/// # async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
/// let device = ApiClient::new("[email protected]", "tapo-password") | ||
/// .p304("192.168.1.100") | ||
/// .await?; | ||
/// let child_device_list = device.get_child_device_list().await?; | ||
/// println!("Child device list: {child_device_list:?}"); | ||
/// # Ok(()) | ||
/// # } | ||
/// ``` | ||
pub async fn p304(mut self, ip_address: impl Into<String>) -> Result<PowerStripHandler, Error> { | ||
self.login(ip_address).await?; | ||
|
||
Ok(PowerStripHandler::new(self)) | ||
} | ||
|
||
/// Specializes the given [`ApiClient`] into an authenticated [`PlugEnergyMonitoringHandler`]. | ||
/// | ||
/// # Arguments | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters