feat(config)!: Config now returns the mqtt config instead of the client

Instead the client is now created on the rust side based on the config.
Devices that require the mqtt client will now instead need to be
constructor using a function. This function receives the mqtt client.
This commit is contained in:
2025-10-19 04:58:53 +02:00
parent 303541929c
commit 95ec3f28ff
10 changed files with 70 additions and 122 deletions

View File

@@ -3,7 +3,7 @@ use std::net::{Ipv4Addr, SocketAddr};
use automation_lib::action_callback::ActionCallback;
use automation_lib::device::Device;
use automation_lib::mqtt::WrappedAsyncClient;
use automation_lib::mqtt::{MqttConfig, WrappedAsyncClient};
use automation_macro::LuaDeviceConfig;
use lua_typed::Typed;
use mlua::FromLua;
@@ -105,7 +105,7 @@ pub struct Config {
#[device_config(from_lua, default)]
pub devices: Option<Devices>,
#[device_config(from_lua)]
pub mqtt: WrappedAsyncClient,
pub mqtt: MqttConfig,
#[device_config(from_lua, default)]
#[typed(default)]
pub schedule: HashMap<String, ActionCallback<()>>,