Updated dependencies

This commit is contained in:
Dreaded_X 2024-12-08 00:53:31 +01:00
parent 8877b24e84
commit e8d5698835
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
5 changed files with 3487 additions and 385 deletions

3835
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -29,11 +29,11 @@ automation_devices = { path = "./automation_devices" }
google_home = { path = "./google_home/google_home" } google_home = { path = "./google_home/google_home" }
google_home_macro = { path = "./google_home/google_home_macro" } google_home_macro = { path = "./google_home/google_home_macro" }
tokio = { version = "1", features = ["rt-multi-thread"] } tokio = { version = "1", features = ["rt-multi-thread"] }
rumqttc = "0.18" rumqttc = "0.24.0"
tracing = "0.1.37" tracing = "0.1.37"
anyhow = "1.0.68" anyhow = "1.0.68"
async-trait = "0.1.83" async-trait = "0.1.83"
axum = "0.6.1" axum = "0.7.9"
bytes = "1.3.0" bytes = "1.3.0"
dotenvy = "0.15.0" dotenvy = "0.15.0"
dyn-clone = "1.0.17" dyn-clone = "1.0.17"
@ -45,12 +45,12 @@ futures = "0.3.25"
hostname = "0.4.0" hostname = "0.4.0"
impls = "1.0.3" impls = "1.0.3"
indexmap = { version = "2.0.0", features = ["serde"] } indexmap = { version = "2.0.0", features = ["serde"] }
itertools = "0.12.1" itertools = "0.13.0"
json_value_merge = "2.0.0" json_value_merge = "2.0.0"
pollster = "0.2.5" pollster = "0.4.0"
proc-macro2 = "1.0.81" proc-macro2 = "1.0.81"
quote = "1.0.36" quote = "1.0.36"
reqwest = { version = "0.11.13", features = [ reqwest = { version = "0.12.9", features = [
"json", "json",
"rustls-tls", "rustls-tls",
], default-features = false } # Use rustls, since the other packages also use rustls ], default-features = false } # Use rustls, since the other packages also use rustls
@ -58,13 +58,13 @@ serde = { version = "1.0.149", features = ["derive"] }
serde_json = "1.0.89" serde_json = "1.0.89"
serde_repr = "0.1.10" serde_repr = "0.1.10"
syn = { version = "2.0.60", features = ["extra-traits", "full"] } syn = { version = "2.0.60", features = ["extra-traits", "full"] }
thiserror = "1.0.38" thiserror = "2.0.5"
tokio-cron-scheduler = "0.9.4" tokio-cron-scheduler = "0.13.0"
tokio-util = { version = "0.7.11", features = ["full"] } tokio-util = { version = "0.7.11", features = ["full"] }
tracing-subscriber = "0.3.16" tracing-subscriber = "0.3.16"
uuid = "1.8.0" uuid = "1.8.0"
wakey = "0.3.0" wakey = "0.3.0"
zigbee2mqtt-types = { version = "0.2.0", features = ["debug", "philips"] } zigbee2mqtt-types = { version = "0.4.0", features = ["debug", "philips"] }
[dependencies] [dependencies]
automation_lib = { workspace = true } automation_lib = { workspace = true }

View File

@ -7,7 +7,7 @@ use automation_lib::mqtt::WrappedAsyncClient;
use automation_macro::LuaDeviceConfig; use automation_macro::LuaDeviceConfig;
use rumqttc::{matches, Publish}; use rumqttc::{matches, Publish};
use tracing::{debug, trace, warn}; use tracing::{debug, trace, warn};
use zigbee2mqtt_types::vendors::philips::Zigbee929003017102; use zigbee2mqtt_types::philips::{Zigbee929003017102, Zigbee929003017102Action};
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct Config { pub struct Config {
@ -70,12 +70,8 @@ impl OnMqtt for HueSwitch {
debug!(id = Device::get_id(self), "Remote action = {:?}", action); debug!(id = Device::get_id(self), "Remote action = {:?}", action);
match action { match action {
zigbee2mqtt_types::vendors::philips::Zigbee929003017102Action::Leftpress => { Zigbee929003017102Action::LeftPress => self.config.left_callback.call(()).await,
self.config.left_callback.call(()).await Zigbee929003017102Action::RightPress => self.config.right_callback.call(()).await,
}
zigbee2mqtt_types::vendors::philips::Zigbee929003017102Action::Rightpress => {
self.config.right_callback.call(()).await
}
_ => {} _ => {}
} }
} }

View File

@ -1,5 +1,6 @@
mod web; mod web;
use std::net::SocketAddr;
use std::path::Path; use std::path::Path;
use std::process; use std::process;
@ -18,6 +19,7 @@ use dotenvy::dotenv;
use google_home::{GoogleHome, Request, Response}; use google_home::{GoogleHome, Request, Response};
use mlua::LuaSerdeExt; use mlua::LuaSerdeExt;
use rumqttc::AsyncClient; use rumqttc::AsyncClient;
use tokio::net::TcpListener;
use tracing::{debug, error, info, warn}; use tracing::{debug, error, info, warn};
use web::{ApiError, User}; use web::{ApiError, User};
@ -154,11 +156,10 @@ async fn app() -> anyhow::Result<()> {
}); });
// Start the web server // Start the web server
let addr = fulfillment_config.into(); let addr: SocketAddr = fulfillment_config.into();
info!("Server started on http://{addr}"); info!("Server started on http://{addr}");
axum::Server::try_bind(&addr)? let listener = TcpListener::bind(addr).await?;
.serve(app.into_make_service()) axum::serve(listener, app).await?;
.await?;
Ok(()) Ok(())
} }

View File

@ -93,6 +93,8 @@ where
// Create a request to the auth server // Create a request to the auth server
// TODO: Do some discovery to find the correct url for this instead of assuming // TODO: Do some discovery to find the correct url for this instead of assuming
// TODO: I think we can also just run Authlia in front of the endpoint instead
// This would then give us a header containing the logged in user info?
let mut req = reqwest::Client::new().get(format!("{}/userinfo", openid_url)); let mut req = reqwest::Client::new().get(format!("{}/userinfo", openid_url));
// Add auth header to the request if it exists // Add auth header to the request if it exists