Fixed visibility of device configs

This commit is contained in:
Dreaded_X 2024-04-29 03:03:42 +02:00
parent 742e3bd62a
commit 55025a67fc
Signed by: Dreaded_X
GPG Key ID: 5A0CBFE3C3377FAA
13 changed files with 47 additions and 47 deletions

View File

@ -18,11 +18,11 @@ use crate::mqtt::WrappedAsyncClient;
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct AirFilterConfig { pub struct AirFilterConfig {
#[device_config(flatten)] #[device_config(flatten)]
info: InfoConfig, pub info: InfoConfig,
#[device_config(flatten)] #[device_config(flatten)]
mqtt: MqttDeviceConfig, pub mqtt: MqttDeviceConfig,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]

View File

@ -13,15 +13,15 @@ use crate::mqtt::WrappedAsyncClient;
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct AudioSetupConfig { pub struct AudioSetupConfig {
identifier: String, pub identifier: String,
#[device_config(flatten)] #[device_config(flatten)]
mqtt: MqttDeviceConfig, pub mqtt: MqttDeviceConfig,
#[device_config(from_lua)] #[device_config(from_lua)]
mixer: WrappedDevice, pub mixer: WrappedDevice,
#[device_config(from_lua)] #[device_config(from_lua)]
speakers: WrappedDevice, pub speakers: WrappedDevice,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]

View File

@ -44,22 +44,22 @@ impl From<TriggerDevicesHelper> for Vec<(WrappedDevice, bool)> {
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct TriggerConfig { pub struct TriggerConfig {
#[device_config(from_lua, from(TriggerDevicesHelper))] #[device_config(from_lua, from(TriggerDevicesHelper))]
devices: Vec<(WrappedDevice, bool)>, pub devices: Vec<(WrappedDevice, bool)>,
#[device_config(default, with(|t: Option<_>| t.map(Duration::from_secs)))] #[device_config(default, with(|t: Option<_>| t.map(Duration::from_secs)))]
pub timeout: Option<Duration>, pub timeout: Option<Duration>,
} }
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct ContactSensorConfig { pub struct ContactSensorConfig {
identifier: String, pub identifier: String,
#[device_config(flatten)] #[device_config(flatten)]
mqtt: MqttDeviceConfig, pub mqtt: MqttDeviceConfig,
#[device_config(from_lua)] #[device_config(from_lua)]
presence: Option<PresenceDeviceConfig>, pub presence: Option<PresenceDeviceConfig>,
#[device_config(from_lua)] #[device_config(from_lua)]
trigger: Option<TriggerConfig>, pub trigger: Option<TriggerConfig>,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]

View File

@ -13,11 +13,11 @@ use crate::mqtt::WrappedAsyncClient;
#[derive(Debug, LuaDeviceConfig, Clone)] #[derive(Debug, LuaDeviceConfig, Clone)]
pub struct DebugBridgeConfig { pub struct DebugBridgeConfig {
identifier: String, pub identifier: String,
#[device_config(flatten)] #[device_config(flatten)]
pub mqtt: MqttDeviceConfig, pub mqtt: MqttDeviceConfig,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]

View File

@ -18,8 +18,8 @@ pub enum Flag {
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize)]
pub struct FlagIDs { pub struct FlagIDs {
pub presence: isize, presence: isize,
pub darkness: isize, darkness: isize,
} }
#[derive(Debug, LuaDeviceConfig, Clone)] #[derive(Debug, LuaDeviceConfig, Clone)]

View File

@ -18,7 +18,7 @@ use crate::traits::Timeout;
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct HueGroupConfig { pub struct HueGroupConfig {
identifier: String, pub identifier: String,
#[device_config(rename("ip"), with(|ip| SocketAddr::new(ip, 80)))] #[device_config(rename("ip"), with(|ip| SocketAddr::new(ip, 80)))]
pub addr: SocketAddr, pub addr: SocketAddr,
pub login: String, pub login: String,
@ -28,7 +28,7 @@ pub struct HueGroupConfig {
#[device_config(default)] #[device_config(default)]
pub remotes: Vec<MqttDeviceConfig>, pub remotes: Vec<MqttDeviceConfig>,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]

View File

@ -31,18 +31,18 @@ pub enum OutletType {
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct IkeaOutletConfig { pub struct IkeaOutletConfig {
#[device_config(flatten)] #[device_config(flatten)]
info: InfoConfig, pub info: InfoConfig,
#[device_config(flatten)] #[device_config(flatten)]
mqtt: MqttDeviceConfig, pub mqtt: MqttDeviceConfig,
#[device_config(default(OutletType::Outlet))] #[device_config(default(OutletType::Outlet))]
outlet_type: OutletType, pub outlet_type: OutletType,
#[device_config(default, with(|t: Option<_>| t.map(Duration::from_secs)))] #[device_config(default, with(|t: Option<_>| t.map(Duration::from_secs)))]
timeout: Option<Duration>, pub timeout: Option<Duration>,
#[device_config(default)] #[device_config(default)]
pub remotes: Vec<MqttDeviceConfig>, pub remotes: Vec<MqttDeviceConfig>,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]

View File

@ -17,9 +17,9 @@ use super::{Device, LuaDeviceCreate};
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct KasaOutletConfig { pub struct KasaOutletConfig {
identifier: String, pub identifier: String,
#[device_config(rename("ip"), with(|ip| SocketAddr::new(ip, 9999)))] #[device_config(rename("ip"), with(|ip| SocketAddr::new(ip, 9999)))]
addr: SocketAddr, pub addr: SocketAddr,
} }
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]

View File

@ -12,7 +12,7 @@ use crate::mqtt::WrappedAsyncClient;
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct LightSensorConfig { pub struct LightSensorConfig {
identifier: String, pub identifier: String,
#[device_config(flatten)] #[device_config(flatten)]
pub mqtt: MqttDeviceConfig, pub mqtt: MqttDeviceConfig,
pub min: isize, pub min: isize,
@ -20,10 +20,10 @@ pub struct LightSensorConfig {
#[device_config(rename("event_channel"), from_lua, with(|ec: EventChannel| ec.get_tx()))] #[device_config(rename("event_channel"), from_lua, with(|ec: EventChannel| ec.get_tx()))]
pub tx: event::Sender, pub tx: event::Sender,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
pub const DEFAULT: bool = false; const DEFAULT: bool = false;
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]
pub struct LightSensor { pub struct LightSensor {

View File

@ -35,9 +35,9 @@ pub enum ActionType {
#[derive(Debug, Serialize, Clone)] #[derive(Debug, Serialize, Clone)]
pub struct Action { pub struct Action {
#[serde(flatten)] #[serde(flatten)]
action: ActionType, pub action: ActionType,
label: String, pub label: String,
clear: Option<bool>, pub clear: Option<bool>,
} }
#[derive(Serialize)] #[derive(Serialize)]
@ -114,10 +114,10 @@ impl Default for Notification {
#[derive(Debug, LuaDeviceConfig)] #[derive(Debug, LuaDeviceConfig)]
pub struct NtfyConfig { pub struct NtfyConfig {
#[device_config(default("https://ntfy.sh".into()))] #[device_config(default("https://ntfy.sh".into()))]
url: String, pub url: String,
topic: String, pub topic: String,
#[device_config(rename("event_channel"), from_lua, with(|ec: EventChannel| ec.get_tx()))] #[device_config(rename("event_channel"), from_lua, with(|ec: EventChannel| ec.get_tx()))]
tx: event::Sender, pub tx: event::Sender,
} }
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]

View File

@ -17,9 +17,9 @@ pub struct PresenceConfig {
#[device_config(flatten)] #[device_config(flatten)]
pub mqtt: MqttDeviceConfig, pub mqtt: MqttDeviceConfig,
#[device_config(from_lua, rename("event_channel"), with(|ec: EventChannel| ec.get_tx()))] #[device_config(from_lua, rename("event_channel"), with(|ec: EventChannel| ec.get_tx()))]
tx: event::Sender, pub tx: event::Sender,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
pub const DEFAULT_PRESENCE: bool = false; pub const DEFAULT_PRESENCE: bool = false;

View File

@ -19,14 +19,14 @@ use crate::mqtt::WrappedAsyncClient;
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct WakeOnLANConfig { pub struct WakeOnLANConfig {
#[device_config(flatten)] #[device_config(flatten)]
info: InfoConfig, pub info: InfoConfig,
#[device_config(flatten)] #[device_config(flatten)]
mqtt: MqttDeviceConfig, pub mqtt: MqttDeviceConfig,
mac_address: MacAddress, pub mac_address: MacAddress,
#[device_config(default(Ipv4Addr::new(255, 255, 255, 255)))] #[device_config(default(Ipv4Addr::new(255, 255, 255, 255)))]
broadcast_ip: Ipv4Addr, pub broadcast_ip: Ipv4Addr,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
#[derive(Debug, LuaDevice)] #[derive(Debug, LuaDevice)]

View File

@ -12,15 +12,15 @@ use crate::mqtt::WrappedAsyncClient;
#[derive(Debug, Clone, LuaDeviceConfig)] #[derive(Debug, Clone, LuaDeviceConfig)]
pub struct WasherConfig { pub struct WasherConfig {
identifier: String, pub identifier: String,
#[device_config(flatten)] #[device_config(flatten)]
mqtt: MqttDeviceConfig, pub mqtt: MqttDeviceConfig,
// Power in Watt // Power in Watt
threshold: f32, pub threshold: f32,
#[device_config(rename("event_channel"), from_lua, with(|ec: EventChannel| ec.get_tx()))] #[device_config(rename("event_channel"), from_lua, with(|ec: EventChannel| ec.get_tx()))]
pub tx: event::Sender, pub tx: event::Sender,
#[device_config(from_lua)] #[device_config(from_lua)]
client: WrappedAsyncClient, pub client: WrappedAsyncClient,
} }
// TODO: Add google home integration // TODO: Add google home integration