pub struct RointeClient { /* private fields */ }Expand description
High-level API for authenticating, discovering, and controlling Rointe devices.
All methods are async and require a Tokio runtime. Create an instance
with RointeClient::new and reuse it across requests — it maintains an
internal HTTP connection pool and handles token refresh automatically.
Implementations§
Source§impl RointeClient
impl RointeClient
Sourcepub async fn new(email: &str, password: &str) -> Result<Self>
pub async fn new(email: &str, password: &str) -> Result<Self>
Authenticate with Rointe / Firebase and return a ready client.
§Example
let client = RointeClient::new("user@example.com", "s3cr3t").await?;Sourcepub async fn get_installations(&self) -> Result<Vec<Installation>>
pub async fn get_installations(&self) -> Result<Vec<Installation>>
Return all installations belonging to the authenticated user.
§Example
let installations = client.get_installations().await?;
for inst in &installations {
println!("{}: {}", inst.id, inst.name.as_deref().unwrap_or("—"));
}Sourcepub async fn discover_devices(
&self,
installation_id: &str,
) -> Result<Vec<String>>
pub async fn discover_devices( &self, installation_id: &str, ) -> Result<Vec<String>>
Return all device IDs found within an installation (recurses through zones).
§Example
let device_ids = client.discover_devices("installation-id").await?;
println!("Found {} device(s)", device_ids.len());Sourcepub async fn get_device(&self, device_id: &str) -> Result<RointeDevice>
pub async fn get_device(&self, device_id: &str) -> Result<RointeDevice>
Fetch the current state of a single device.
§Example
let device = client.get_device("device-id").await?;
println!("{}: {:.1}°C ({})", device.data.name, device.data.temp,
if device.data.power { "ON" } else { "OFF" });Sourcepub async fn set_temperature(&self, device_id: &str, temp: f64) -> Result<()>
pub async fn set_temperature(&self, device_id: &str, temp: f64) -> Result<()>
Set the target temperature (switches to manual mode, powers on).
§Example
client.set_temperature("device-id", 21.5).await?;Sourcepub async fn set_preset(&self, device_id: &str, preset: Preset) -> Result<()>
pub async fn set_preset(&self, device_id: &str, preset: Preset) -> Result<()>
Activate a comfort preset (comfort / eco / ice).
§Example
client.set_preset("device-id", Preset::Eco).await?;Sourcepub async fn set_mode(&self, device_id: &str, mode: HvacMode) -> Result<()>
pub async fn set_mode(&self, device_id: &str, mode: HvacMode) -> Result<()>
Set the HVAC operating mode.
HvacMode::Off— two-step power-off sequenceHvacMode::Heat— two-step power-on (heats to comfort temperature)HvacMode::Auto— two-step switch to schedule-following auto mode
§Example
client.set_mode("device-id", HvacMode::Auto).await?;Sourcepub async fn get_energy_stats(
&self,
device_id: &str,
) -> Result<EnergyConsumptionData>
pub async fn get_energy_stats( &self, device_id: &str, ) -> Result<EnergyConsumptionData>
Return the most recent hourly energy stats for a device.
Tries the current hour and walks back up to 5 hours to find a non-null
record. Returns an empty EnergyConsumptionData if no data is found
(not all device models report energy statistics).
§Example
let stats = client.get_energy_stats("device-id").await?;
if let Some(kwh) = stats.kw_h {
println!("Last hour: {kwh:.3} kWh");
}