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