diff --git a/automation_devices/src/ntfy.rs b/automation_devices/src/ntfy.rs index 2fd7f96..4206bd8 100644 --- a/automation_devices/src/ntfy.rs +++ b/automation_devices/src/ntfy.rs @@ -3,7 +3,6 @@ use std::convert::Infallible; use async_trait::async_trait; use automation_lib::device::{Device, LuaDeviceCreate}; -use automation_lib::event::{self, EventChannel}; use automation_lib::lua::traits::AddAdditionalMethods; use automation_macro::{LuaDevice, LuaDeviceConfig}; use mlua::LuaSerdeExt; @@ -117,8 +116,6 @@ pub struct Config { #[device_config(default("https://ntfy.sh".into()))] pub url: String, pub topic: String, - #[device_config(rename("event_channel"), from_lua, with(|ec: EventChannel| ec.get_tx()))] - pub tx: event::Sender, } #[derive(Debug, Clone, LuaDevice)] diff --git a/automation_devices/src/washer.rs b/automation_devices/src/washer.rs index 8d70735..46d7dc3 100644 --- a/automation_devices/src/washer.rs +++ b/automation_devices/src/washer.rs @@ -4,7 +4,7 @@ use async_trait::async_trait; use automation_lib::action_callback::ActionCallback; use automation_lib::config::MqttDeviceConfig; use automation_lib::device::{Device, LuaDeviceCreate}; -use automation_lib::event::{self, EventChannel, OnMqtt}; +use automation_lib::event::OnMqtt; use automation_lib::messages::PowerMessage; use automation_lib::mqtt::WrappedAsyncClient; use automation_macro::{LuaDevice, LuaDeviceConfig}; @@ -19,8 +19,6 @@ pub struct Config { pub mqtt: MqttDeviceConfig, // Power in Watt pub threshold: f32, - #[device_config(rename("event_channel"), from_lua, with(|ec: EventChannel| ec.get_tx()))] - pub tx: event::Sender, #[device_config(from_lua, default)] pub done_callback: ActionCallback, diff --git a/config.lua b/config.lua index 15a2425..d2bd30d 100644 --- a/config.lua +++ b/config.lua @@ -31,7 +31,6 @@ local mqtt_client = automation.new_mqtt_client({ local ntfy = Ntfy.new({ topic = automation.util.get_env("NTFY_TOPIC"), - event_channel = automation.device_manager:event_channel(), }) automation.device_manager:add(ntfy) @@ -251,7 +250,6 @@ automation.device_manager:add(Washer.new({ topic = mqtt_z2m("bathroom/washer"), client = mqtt_client, threshold = 1, - event_channel = automation.device_manager:event_channel(), done_callback = function() ntfy:send_notification({ title = "Laundy is done",