1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
//! Indoor/outdoor thermo-hygrometer. //! //! https://www.switch-bot.com/products/switchbot-indoor-outdoor-thermo-hygrometer use anyhow::Result; use serde::Deserialize; use crate::SwitchBot; /// Indoor/outdoor thermo-hygrometer status. #[derive(Clone, Debug, Deserialize, PartialEq)] pub struct IOThermoHygrometerStatus { /// Temperature (C). pub temperature: f64, /// Humidity (%). pub humidity: f64, /// Battery level (%). pub battery: f64, } impl SwitchBot { /// Get indoor/outdoor thermo-hygrometer status. pub async fn get_io_thermo_hygrometer_status( &self, id: &str, ) -> Result<IOThermoHygrometerStatus> { self.get(&format!("v1.1/devices/{}/status", id)).await } }