Updated is_on -> on to be consistent with rust
All checks were successful
Build and deploy / Build application (push) Successful in 3m23s
Build and deploy / Build container (push) Successful in 1m2s
Build and deploy / Deploy container (push) Successful in 18s

This commit is contained in:
Dreaded_X 2024-12-08 05:35:48 +01:00
parent e4c211a278
commit 175056416e
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
2 changed files with 6 additions and 6 deletions

View File

@ -68,7 +68,7 @@ macro_rules! impl_device {
Ok(()) 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>) Ok((this.deref().cast() as Option<&dyn google_home::traits::OnOff>)
.expect("Cast should be valid") .expect("Cast should be valid")
.on() .on()

View File

@ -92,7 +92,7 @@ automation.device_manager:add(IkeaRemote.new({
single_button = true, single_button = true,
callback = function(_, on) callback = function(_, on)
if on then if on then
if living_mixer:is_on() then if living_mixer:on() then
living_mixer:set_on(false) living_mixer:set_on(false)
living_speakers:set_on(false) living_speakers:set_on(false)
else else
@ -100,10 +100,10 @@ automation.device_manager:add(IkeaRemote.new({
living_speakers:set_on(true) living_speakers:set_on(true)
end end
else else
if not living_mixer:is_on() then if not living_mixer:on() then
living_mixer:set_on(true) living_mixer:set_on(true)
else else
living_speakers:set_on(not living_speakers:is_on()) living_speakers:set_on(not living_speakers:on())
end end
end end
end, end,
@ -201,7 +201,7 @@ automation.device_manager:add(HueSwitch.new({
client = mqtt_client, client = mqtt_client,
topic = mqtt_z2m("hallway/switchbottom"), topic = mqtt_z2m("hallway/switchbottom"),
left_callback = function() 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, end,
})) }))
automation.device_manager:add(HueSwitch.new({ automation.device_manager:add(HueSwitch.new({
@ -210,7 +210,7 @@ automation.device_manager:add(HueSwitch.new({
client = mqtt_client, client = mqtt_client,
topic = mqtt_z2m("hallway/switchtop"), topic = mqtt_z2m("hallway/switchtop"),
left_callback = function() 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, end,
})) }))