From 3676aafa2306bca799fe6388e45a26d4ad013c25 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Sun, 19 Oct 2025 05:29:41 +0200 Subject: [PATCH] feat(config)!: Remove device manager lua code With the recent changes the device manager no longer needs to be available in lua. --- automation_lib/src/device_manager.rs | 22 +--------------------- definitions/automation:device_manager.lua | 8 -------- src/bin/automation.rs | 2 -- 3 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 definitions/automation:device_manager.lua diff --git a/automation_lib/src/device_manager.rs b/automation_lib/src/device_manager.rs index cdf302a..08f8fbf 100644 --- a/automation_lib/src/device_manager.rs +++ b/automation_lib/src/device_manager.rs @@ -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>; -#[derive(Clone, FromLua)] +#[derive(Clone)] pub struct DeviceManager { devices: Arc>, event_channel: EventChannel, @@ -89,21 +87,3 @@ impl DeviceManager { } } } - -impl mlua::UserData for DeviceManager { - fn add_methods>(methods: &mut M) { - methods.add_async_method("add", async |_lua, this, device: Box| { - 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() - } -} diff --git a/definitions/automation:device_manager.lua b/definitions/automation:device_manager.lua deleted file mode 100644 index 23af2c8..0000000 --- a/definitions/automation:device_manager.lua +++ /dev/null @@ -1,8 +0,0 @@ ----@meta - ----@class DeviceManager -local DeviceManager ----@param device DeviceInterface -function DeviceManager:add(device) end - -return DeviceManager diff --git a/src/bin/automation.rs b/src/bin/automation.rs index 1965a09..5e1bb5f 100644 --- a/src/bin/automation.rs +++ b/src/bin/automation.rs @@ -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)?)?;