Removed unused event code
This commit is contained in:
@@ -3,7 +3,6 @@ use std::convert::Infallible;
|
|||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use automation_lib::device::{Device, LuaDeviceCreate};
|
use automation_lib::device::{Device, LuaDeviceCreate};
|
||||||
use automation_lib::event::{self, EventChannel};
|
|
||||||
use automation_lib::lua::traits::AddAdditionalMethods;
|
use automation_lib::lua::traits::AddAdditionalMethods;
|
||||||
use automation_macro::{LuaDevice, LuaDeviceConfig};
|
use automation_macro::{LuaDevice, LuaDeviceConfig};
|
||||||
use mlua::LuaSerdeExt;
|
use mlua::LuaSerdeExt;
|
||||||
@@ -117,8 +116,6 @@ pub struct Config {
|
|||||||
#[device_config(default("https://ntfy.sh".into()))]
|
#[device_config(default("https://ntfy.sh".into()))]
|
||||||
pub url: String,
|
pub url: String,
|
||||||
pub topic: 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)]
|
#[derive(Debug, Clone, LuaDevice)]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use async_trait::async_trait;
|
|||||||
use automation_lib::action_callback::ActionCallback;
|
use automation_lib::action_callback::ActionCallback;
|
||||||
use automation_lib::config::MqttDeviceConfig;
|
use automation_lib::config::MqttDeviceConfig;
|
||||||
use automation_lib::device::{Device, LuaDeviceCreate};
|
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::messages::PowerMessage;
|
||||||
use automation_lib::mqtt::WrappedAsyncClient;
|
use automation_lib::mqtt::WrappedAsyncClient;
|
||||||
use automation_macro::{LuaDevice, LuaDeviceConfig};
|
use automation_macro::{LuaDevice, LuaDeviceConfig};
|
||||||
@@ -19,8 +19,6 @@ pub struct Config {
|
|||||||
pub mqtt: MqttDeviceConfig,
|
pub mqtt: MqttDeviceConfig,
|
||||||
// Power in Watt
|
// Power in Watt
|
||||||
pub threshold: f32,
|
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)]
|
#[device_config(from_lua, default)]
|
||||||
pub done_callback: ActionCallback<Washer, ()>,
|
pub done_callback: ActionCallback<Washer, ()>,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ local mqtt_client = automation.new_mqtt_client({
|
|||||||
|
|
||||||
local ntfy = Ntfy.new({
|
local ntfy = Ntfy.new({
|
||||||
topic = automation.util.get_env("NTFY_TOPIC"),
|
topic = automation.util.get_env("NTFY_TOPIC"),
|
||||||
event_channel = automation.device_manager:event_channel(),
|
|
||||||
})
|
})
|
||||||
automation.device_manager:add(ntfy)
|
automation.device_manager:add(ntfy)
|
||||||
|
|
||||||
@@ -251,7 +250,6 @@ automation.device_manager:add(Washer.new({
|
|||||||
topic = mqtt_z2m("bathroom/washer"),
|
topic = mqtt_z2m("bathroom/washer"),
|
||||||
client = mqtt_client,
|
client = mqtt_client,
|
||||||
threshold = 1,
|
threshold = 1,
|
||||||
event_channel = automation.device_manager:event_channel(),
|
|
||||||
done_callback = function()
|
done_callback = function()
|
||||||
ntfy:send_notification({
|
ntfy:send_notification({
|
||||||
title = "Laundy is done",
|
title = "Laundy is done",
|
||||||
|
|||||||
Reference in New Issue
Block a user