Skip to content

Commit

Permalink
Add support for current power fetching on P110,P115 devices
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNerma committed May 21, 2024
1 parent 7dd1b6b commit 03b35c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tapo-rest"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

[dependencies]
Expand All @@ -24,4 +24,8 @@ openssl = { version = "0.10", features = ["vendored"] }
dirs = "5.0.1"
paste = "1.0.15"
axum-extra = { version = "0.9.3", features = ["typed-header"] }
chrono = { version = "0.4.38", default-features = false, features = ["std", "windows-targets", "serde"] }
chrono = { version = "0.4.38", default-features = false, features = [
"std",
"windows-targets",
"serde",
] }
5 changes: 5 additions & 0 deletions src/server/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ routes! {
pub use tapo::{
requests::{Color, LightingEffectPreset, EnergyDataInterval},
responses::{
CurrentPowerResult,
DeviceInfoLightResult,
DeviceInfoColorLightResult,
DeviceInfoRgbLightStripResult,
Expand Down Expand Up @@ -334,5 +335,9 @@ routes! {
async fn get_monthly_energy_data(&state, &client, start_date: NaiveDate) -> Json<EnergyDataResult> {
Ok(Json(client.get_energy_data(EnergyDataInterval::Monthly { start_date }).await?))
}

async fn get_current_power(&state, &client) -> Json<CurrentPowerResult> {
Ok(Json(client.get_current_power().await?))
}
}
}

0 comments on commit 03b35c0

Please sign in to comment.