feat(config)!: Remove device manager lua code

With the recent changes the device manager no longer needs to be
available in lua.
This commit is contained in:
2025-10-19 05:29:41 +02:00
parent 2db4af7427
commit 2fe9fbadfb
3 changed files with 1 additions and 31 deletions

View File

@@ -2,8 +2,6 @@ use std::collections::HashMap;
use std::sync::Arc;
use futures::future::join_all;
use lua_typed::Typed;
use mlua::FromLua;
use tokio::sync::{RwLock, RwLockReadGuard};
use tracing::{debug, instrument, trace};
@@ -12,7 +10,7 @@ use crate::event::{Event, EventChannel, OnMqtt};
pub type DeviceMap = HashMap<String, Box<dyn Device>>;
#[derive(Clone, FromLua)]
#[derive(Clone)]
pub struct DeviceManager {
devices: Arc<RwLock<DeviceMap>>,
event_channel: EventChannel,
@@ -89,21 +87,3 @@ impl DeviceManager {
}
}
}
impl mlua::UserData for DeviceManager {
fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
methods.add_async_method("add", async |_lua, this, device: Box<dyn Device>| {
this.add(device).await;
Ok(())
});
methods.add_method("event_channel", |_lua, this, ()| Ok(this.event_channel()))
}
}
impl Typed for DeviceManager {
fn type_name() -> String {
"DeviceManager".into()
}
}

View File

@@ -1,8 +0,0 @@
---@meta
---@class DeviceManager
local DeviceManager
---@param device DeviceInterface
function DeviceManager:add(device) end
return DeviceManager

View File

@@ -132,8 +132,6 @@ async fn app() -> anyhow::Result<()> {
automation_lib::load_modules(&lua)?;
lua.register_module("automation:device_manager", device_manager.clone())?;
lua.register_module("automation:variables", lua.to_value(&setup.variables)?)?;
lua.register_module("automation:secrets", lua.to_value(&setup.secrets)?)?;