refactor!: Rewrote device implementation macro once again

This time with a bit more though put into the design of the code, as a
result the macro should be a lot more robust.

This did result in the macro getting renamed from LuaDevice to Device as
this should be _the_ Device macro.
The attribute also got renamed from traits() to device(traits()) and the
syntax got overhauled to allow for a bit more expression.
This commit is contained in:
2025-09-10 01:58:48 +02:00
parent aad089aa10
commit 2dbd491b81
18 changed files with 268 additions and 139 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ use std::str::Utf8Error;
use async_trait::async_trait;
use automation_lib::device::{Device, LuaDeviceCreate};
use automation_macro::{LuaDevice, LuaDeviceConfig};
use automation_macro::{Device, LuaDeviceConfig};
use bytes::{Buf, BufMut};
use google_home::errors::{self, DeviceError};
use google_home::traits::OnOff;
@@ -21,8 +21,8 @@ pub struct Config {
pub addr: SocketAddr,
}
#[derive(Debug, Clone, LuaDevice)]
#[traits(OnOff)]
#[derive(Debug, Clone, Device)]
#[device(traits(OnOff))]
pub struct KasaOutlet {
config: Config,
}