aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2025-10-16 19:24:47 +0100
committerTomasz Kramkowski <tomasz@kramkow.ski>2025-10-16 19:24:47 +0100
commitaa5a4632d2f57a8f4b5e8f33156899b37caea9e3 (patch)
treeb384e4eff75d451d89592419a41b475590e8a319
parenta03622d5706a78a451c40e8763437e2c313305a8 (diff)
downloadmqttr-master.tar.gz
mqttr-master.tar.xz
mqttr-master.zip
Breathing roomHEADmaster
-rw-r--r--src/main.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 4788174..5781b00 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -92,6 +92,7 @@ async fn main() -> anyhow::Result<()> {
conf_path.push(format!("{PROGRAM}.toml"));
let conf = config::load(&conf_path)
.with_context(|| format!("Failed to load config: {:?}", &conf_path))?;
+
stderrlog::new()
.color(stderrlog::ColorChoice::Never)
.module(module_path!())
@@ -103,9 +104,12 @@ async fn main() -> anyhow::Result<()> {
})
.init()
.unwrap();
+
// TODO: This will print creds
trace!("Configuration: {conf:?}");
+
let (client, mut event_loop) = conf.mqtt_client();
+
for (topic, route) in conf.routes.iter() {
if let Err(e) = client.subscribe(topic, route.qos.unwrap_or(conf.qos)).await {
warn!("Failed to subscribe to '{topic}': {e:?}");
@@ -113,6 +117,7 @@ async fn main() -> anyhow::Result<()> {
debug!("Subscribed to: '{topic}'");
}
}
+
moro_local::async_scope!(|scope| -> anyhow::Result<()> {
loop {
let notification = event_loop.poll().await;