feat: Added optional definition function to module

This commit is contained in:
2025-10-15 03:48:03 +02:00
parent be1602d0e2
commit 17a68e8991
6 changed files with 83 additions and 29 deletions

View File

@@ -132,4 +132,20 @@ fn create_module(lua: &mlua::Lua) -> mlua::Result<mlua::Table> {
Ok(mqtt)
}
inventory::submit! {Module::new("automation:mqtt", create_module)}
fn generate_definitions() -> String {
let mut output = String::new();
output += "---@meta\n\nlocal mqtt\n\n";
output += &MqttConfig::generate_full().expect("WrappedAsyncClient should have generate_full");
output += "\n";
output +=
&WrappedAsyncClient::generate_full().expect("WrappedAsyncClient should have generate_full");
output += "\n";
output += "return mqtt";
output
}
inventory::submit! {Module::new("automation:mqtt", create_module, Some(generate_definitions))}