fritzapi/lib.rs
1//! Library for interfacing with the \"AVM Home Automation\" API
2//! <https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/AHA-HTTP-Interface.pdf>.
3//!
4//! It is used by the [fritzctrl](https://crates.io/crates/fritzctrl) utility.
5//!
6//! ## Example
7//!
8//! ```no_run
9//! # fn main() -> fritzapi::Result<()> {
10//! # let user = "";
11//! # let password = "";
12//! let mut client = fritzapi::FritzClient::new(user, password);
13//! // List devices
14//! let mut devices = client.list_devices()?;
15//! // If the first device is off, turn it on
16//! let dev = devices.first_mut().unwrap();
17//! if !dev.is_on() {
18//! dev.turn_on(&mut client)?;
19//! }
20//! # Ok(())
21//! # }
22//! ```
23
24#[macro_use]
25extern crate tracing;
26
27pub mod devices;
28pub mod error;
29pub mod stats;
30
31#[cfg(not(target_family = "wasm"))]
32pub(crate) mod api;
33#[cfg(not(target_family = "wasm"))]
34pub(crate) mod client;
35#[cfg(not(target_family = "wasm"))]
36pub(crate) mod fritz_xml;
37
38pub use devices::{AVMDevice, FritzDect2XX};
39pub use error::{FritzError, Result};
40pub use stats::{DeviceStats, DeviceStatsKind, Unit};
41
42#[cfg(not(target_family = "wasm"))]
43pub use client::FritzClient;