feat!: ActionCallback can now receive any amount of arguments

ActionCallback now only has one generics argument that has to implement
IntoLuaMulti, this makes ActionCallback much more flexible as it no
longer always requires two arguments.
This commit is contained in:
2025-09-08 03:30:01 +02:00
parent 352654107a
commit 5383e7265d
10 changed files with 71 additions and 75 deletions

View File

@@ -20,7 +20,7 @@ pub struct Config {
pub mqtt: MqttDeviceConfig,
#[device_config(from_lua, default)]
pub callback: ActionCallback<Presence, bool>,
pub callback: ActionCallback<(Presence, bool)>,
#[device_config(from_lua)]
pub client: WrappedAsyncClient,
@@ -118,7 +118,10 @@ impl OnMqtt for Presence {
debug!("Overall presence updated: {overall_presence}");
self.state_mut().await.current_overall_presence = overall_presence;
self.config.callback.call(self, &overall_presence).await;
self.config
.callback
.call((self.clone(), overall_presence))
.await;
}
}
}