From 175056416e5d1f2b8c25437691131b039a5b4f1d Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Sun, 8 Dec 2024 05:35:48 +0100 Subject: [PATCH] Updated is_on -> on to be consistent with rust --- automation_devices/src/lib.rs | 2 +- config.lua | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/automation_devices/src/lib.rs b/automation_devices/src/lib.rs index ca21961..1fae592 100644 --- a/automation_devices/src/lib.rs +++ b/automation_devices/src/lib.rs @@ -68,7 +68,7 @@ macro_rules! impl_device { Ok(()) }); - methods.add_async_method("is_on", |_lua, this, _: ()| async move { + methods.add_async_method("on", |_lua, this, _: ()| async move { Ok((this.deref().cast() as Option<&dyn google_home::traits::OnOff>) .expect("Cast should be valid") .on() diff --git a/config.lua b/config.lua index 20bf039..a1726dd 100644 --- a/config.lua +++ b/config.lua @@ -92,7 +92,7 @@ automation.device_manager:add(IkeaRemote.new({ single_button = true, callback = function(_, on) if on then - if living_mixer:is_on() then + if living_mixer:on() then living_mixer:set_on(false) living_speakers:set_on(false) else @@ -100,10 +100,10 @@ automation.device_manager:add(IkeaRemote.new({ living_speakers:set_on(true) end else - if not living_mixer:is_on() then + if not living_mixer:on() then living_mixer:set_on(true) else - living_speakers:set_on(not living_speakers:is_on()) + living_speakers:set_on(not living_speakers:on()) end end end, @@ -201,7 +201,7 @@ automation.device_manager:add(HueSwitch.new({ client = mqtt_client, topic = mqtt_z2m("hallway/switchbottom"), left_callback = function() - hallway_top_light:set_on(not hallway_top_light:is_on()) + hallway_top_light:set_on(not hallway_top_light:on()) end, })) automation.device_manager:add(HueSwitch.new({ @@ -210,7 +210,7 @@ automation.device_manager:add(HueSwitch.new({ client = mqtt_client, topic = mqtt_z2m("hallway/switchtop"), left_callback = function() - hallway_top_light:set_on(not hallway_top_light:is_on()) + hallway_top_light:set_on(not hallway_top_light:on()) end, }))