Updated is_on -> on to be consistent with rust
This commit is contained in:
parent
e4c211a278
commit
175056416e
|
@ -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()
|
||||||
|
|
10
config.lua
10
config.lua
|
@ -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,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user