Compare commits
7 Commits
23b0b19693
...
203c341863
| Author | SHA1 | Date | |
|---|---|---|---|
|
203c341863
|
|||
|
91c35d56fd
|
|||
|
91971cb795
|
|||
|
27fe726234
|
|||
|
2ca5e53706
|
|||
|
52c32e2438
|
|||
|
4209fb38ce
|
@@ -2,6 +2,7 @@ use std::fmt::Debug;
|
|||||||
|
|
||||||
use automation_cast::Cast;
|
use automation_cast::Cast;
|
||||||
use dyn_clone::DynClone;
|
use dyn_clone::DynClone;
|
||||||
|
use google_home::traits::OnOff;
|
||||||
use mlua::ObjectLike;
|
use mlua::ObjectLike;
|
||||||
|
|
||||||
use crate::event::OnMqtt;
|
use crate::event::OnMqtt;
|
||||||
@@ -17,7 +18,7 @@ pub trait LuaDeviceCreate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait Device:
|
pub trait Device:
|
||||||
Debug + DynClone + Sync + Send + Cast<dyn google_home::Device> + Cast<dyn OnMqtt>
|
Debug + DynClone + Sync + Send + Cast<dyn google_home::Device> + Cast<dyn OnMqtt> + Cast<dyn OnOff>
|
||||||
{
|
{
|
||||||
fn get_id(&self) -> String;
|
fn get_id(&self) -> String;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ local on_presence = {
|
|||||||
local presence_system = Presence.new({
|
local presence_system = Presence.new({
|
||||||
topic = mqtt_automation("presence/+/#"),
|
topic = mqtt_automation("presence/+/#"),
|
||||||
client = mqtt_client,
|
client = mqtt_client,
|
||||||
|
event_channel = automation.device_manager:event_channel(),
|
||||||
callback = function(_, presence)
|
callback = function(_, presence)
|
||||||
for _, f in ipairs(on_presence) do
|
for _, f in ipairs(on_presence) do
|
||||||
if type(f) == "function" then
|
if type(f) == "function" then
|
||||||
@@ -97,6 +98,7 @@ automation.device_manager:add(LightSensor.new({
|
|||||||
client = mqtt_client,
|
client = mqtt_client,
|
||||||
min = 22000,
|
min = 22000,
|
||||||
max = 23500,
|
max = 23500,
|
||||||
|
event_channel = automation.device_manager:event_channel(),
|
||||||
callback = function(_, light)
|
callback = function(_, light)
|
||||||
for _, f in ipairs(on_light) do
|
for _, f in ipairs(on_light) do
|
||||||
if type(f) == "function" then
|
if type(f) == "function" then
|
||||||
|
|||||||
Reference in New Issue
Block a user