From db0036a2bc3dc20b6558caee5268c4c5d760a806 Mon Sep 17 00:00:00 2001 From: Frank Villaro-Dixon Date: Mon, 4 Mar 2024 20:42:46 +0100 Subject: [PATCH] move things around Signed-off-by: Frank Villaro-Dixon --- Cargo.lock | 8 -------- Cargo.toml | 4 +++- mytest/src/main.rs => examples/get_values.rs | 8 -------- examples/temperature.rs | 10 ++++++++++ mytest/Cargo.toml | 10 ---------- src/lib.rs | 16 ++++++++++++---- 6 files changed, 25 insertions(+), 31 deletions(-) rename mytest/src/main.rs => examples/get_values.rs (66%) create mode 100644 examples/temperature.rs delete mode 100644 mytest/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 3a18acb..cf78cb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -156,14 +156,6 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" -[[package]] -name = "mytest" -version = "0.1.0" -dependencies = [ - "daikin_altherma", - "thiserror", -] - [[package]] name = "percent-encoding" version = "2.3.1" diff --git a/Cargo.toml b/Cargo.toml index 817b35b..796b384 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,3 @@ -workspace = { members = ["mytest"] } [package] name = "daikin_altherma" version = "0.0.1" @@ -25,3 +24,6 @@ url = "2.5.0" [dependencies.uuid] version = "1.7.0" features = ["v4"] + +[package.metadata.docs.rs] +cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"] diff --git a/mytest/src/main.rs b/examples/get_values.rs similarity index 66% rename from mytest/src/main.rs rename to examples/get_values.rs index cf03339..5574e41 100644 --- a/mytest/src/main.rs +++ b/examples/get_values.rs @@ -1,14 +1,6 @@ use daikin_altherma::DaikinAlthermaClient; fn main() { let mut a = DaikinAlthermaClient::new("192.168.11.100".to_string()).unwrap(); - // let am = a.get_adapter_model(); - // println!("Adapter model: {am}"); - // - - //a.set_holiday_mode(false); - - //# let hm = a.is_holiday_mode(); - //# println!("Holiday mode: {hm}"); let tp = a.get_tank_parameters().unwrap(); println!("Tank: {:?}", tp); diff --git a/examples/temperature.rs b/examples/temperature.rs new file mode 100644 index 0000000..a818348 --- /dev/null +++ b/examples/temperature.rs @@ -0,0 +1,10 @@ +use daikin_altherma::DaikinAlthermaClient; +fn main() { + let mut a = DaikinAlthermaClient::new("192.168.11.100".to_string()).unwrap(); + + let hp = a.get_heating_parameters().unwrap(); + println!("Heating: {:?}", hp); + a.set_heating_setpoint_temperature(20.0); + let hp = a.get_heating_parameters().unwrap(); + println!("Heating: {:?}", hp); +} diff --git a/mytest/Cargo.toml b/mytest/Cargo.toml deleted file mode 100644 index fbe4781..0000000 --- a/mytest/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "mytest" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -daikin_altherma = {path = "/home/frank/src/github.com/frankkkkk/daikin-altherma-rs/"} -thiserror = "1.0.57" diff --git a/src/lib.rs b/src/lib.rs index f1f253a..f259aaf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,12 @@ -use std::{fmt::Debug, net::TcpStream}; +//! # API to Daikin Altherma LAN Adapters +//! +//! This rust crate interfaces with Daikin Altherma LAN adapters. +//! There are two firmware versions of the LAN adapters: +//! - Cloud connected +//! - LAN only +//! This library only supports the second one for the moment. + +use std::net::TcpStream; use uuid::Uuid; use serde_json::{json, Value}; @@ -8,9 +16,9 @@ use url::Url; mod errors; mod params; mod traits; -use crate::errors::DAError; -use crate::params::HeatingParameters; -use crate::params::TankParameters; +pub use crate::errors::DAError; +pub use crate::params::HeatingParameters; +pub use crate::params::TankParameters; pub struct DaikinAlthermaClient { ws_client: WebSocket>,