switchbot_api2/devices/hub2.rs
1//! Hub 2.
2//!
3//! https://us.switch-bot.com/products/switchbot-hub-2
4
5use anyhow::Result;
6use serde::Deserialize;
7
8use crate::SwitchBot;
9
10/// Hub 2 status.
11#[derive(Clone, Debug, Deserialize, PartialEq)]
12pub struct Hub2Status {
13 /// Temperature (C).
14 pub temperature: f64,
15
16 /// Humidity (%).
17 pub humidity: f64,
18}
19
20impl SwitchBot {
21 /// Get Hub 2 status.
22 pub async fn get_hub2_status(&self, id: &str) -> Result<Hub2Status> {
23 self.get(&format!("v1.1/devices/{}/status", id)).await
24 }
25}