diff --git a/CHANGELOG.md b/CHANGELOG.md index 097a793..3c6e3ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ file. This change log follows the conventions of - The internal implementation of `H100Handler`'s `get_child_device_list` has been updated to fetch all pages, not just the first one. - `H100Handler`'s `get_child_device_list_json` now includes a `start_index` parameter to fetch child devices starting from a specific index. +#### Fixed + +- Resolved an issue that caused the passthrough protocol test to incorrectly indicate support when it was not actually supported. (thanks to @WhySoBad) + ### Python #### Changed @@ -24,6 +28,10 @@ file. This change log follows the conventions of - The internal implementation of `H100Handler`'s `get_child_device_list` has been updated to fetch all pages, not just the first one. - `H100Handler`'s `get_child_device_list_json` now includes a `start_index` parameter to fetch child devices starting from a specific index. +#### Fixed + +- Resolved an issue that caused the passthrough protocol test to incorrectly indicate support when it was not actually supported. (thanks to @WhySoBad) + ## [v0.8.0][v0.8.0] - 2024-12-07 This marks the first unified release of the Rust and Python libraries. Moving forward, both libraries will be released simultaneously and will share the same version number. diff --git a/tapo/src/api/protocol/discovery_protocol.rs b/tapo/src/api/protocol/discovery_protocol.rs index 0c0b989..a2ef780 100644 --- a/tapo/src/api/protocol/discovery_protocol.rs +++ b/tapo/src/api/protocol/discovery_protocol.rs @@ -1,4 +1,4 @@ -use log::debug; +use log::{debug, warn}; use reqwest::Client; use crate::api::protocol::klap_protocol::KlapProtocol; @@ -34,14 +34,14 @@ impl DiscoveryProtocol { } async fn is_passthrough_supported(&self, url: &str) -> Result { - if let Err(Error::Tapo(TapoResponseError::Unknown(code))) = self.test_passthrough(url).await - { - if code == 1003 { - return Ok(false); + match self.test_passthrough(url).await { + Err(Error::Tapo(TapoResponseError::Unknown(code))) => Ok(code != 1003), + Err(err) => { + warn!("Passthrough protocol test error: {err:?}"); + Err(err) } + Ok(_) => Ok(true), } - - Ok(true) } async fn test_passthrough(&self, url: &str) -> Result<(), Error> {