feat(config)!: Move mqtt module to actual separate module

The automation:mqtt module now gets loaded in a similar way as the
automation:devices and automation:utils modules.
This leads to a breaking change where instantiating a new mqtt client
the device manager needs to be explicitly passed in.
This commit is contained in:
2025-10-15 03:39:10 +02:00
parent 9bddeae54e
commit be1602d0e2
4 changed files with 31 additions and 22 deletions

View File

@@ -5,6 +5,7 @@ use std::sync::Arc;
use futures::Future;
use futures::future::join_all;
use lua_typed::Typed;
use mlua::FromLua;
use tokio::sync::{RwLock, RwLockReadGuard};
use tokio_cron_scheduler::{Job, JobScheduler};
use tracing::{debug, instrument, trace};
@@ -14,7 +15,7 @@ use crate::event::{Event, EventChannel, OnMqtt};
pub type DeviceMap = HashMap<String, Box<dyn Device>>;
#[derive(Clone)]
#[derive(Clone, FromLua)]
pub struct DeviceManager {
devices: Arc<RwLock<DeviceMap>>,
event_channel: EventChannel,