feat(config)!: Made schedule part of new modules
This commit is contained in:
@@ -38,4 +38,8 @@ function module.notify_low_battery()
|
||||
})
|
||||
end
|
||||
|
||||
module.schedule = {
|
||||
["0 0 21 */1 * *"] = module.notify_low_battery,
|
||||
}
|
||||
|
||||
return module
|
||||
|
||||
@@ -29,14 +29,4 @@ return {
|
||||
require("config.rooms"),
|
||||
require("config.windows"),
|
||||
},
|
||||
-- TODO: Make this also part of the modules
|
||||
schedule = {
|
||||
["0 0 19 * * *"] = function()
|
||||
require("config.rooms.bedroom").set_airfilter_on(true)
|
||||
end,
|
||||
["0 0 20 * * *"] = function()
|
||||
require("config.rooms.bedroom").set_airfilter_on(false)
|
||||
end,
|
||||
["0 0 21 */1 * *"] = require("config.battery").notify_low_battery,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -56,19 +56,22 @@ function module.setup(mqtt_client)
|
||||
windows.add(window)
|
||||
|
||||
return {
|
||||
lights,
|
||||
lights_relax,
|
||||
air_filter,
|
||||
switch,
|
||||
window,
|
||||
devices = {
|
||||
lights,
|
||||
lights_relax,
|
||||
air_filter,
|
||||
switch,
|
||||
window,
|
||||
},
|
||||
schedule = {
|
||||
["0 0 19 * * *"] = function()
|
||||
air_filter:set_on(true)
|
||||
end,
|
||||
["0 0 20 * * *"] = function()
|
||||
air_filter:set_on(false)
|
||||
end,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
--- @param on boolean
|
||||
function module.set_airfilter_on(on)
|
||||
if air_filter then
|
||||
air_filter:set_on(on)
|
||||
end
|
||||
end
|
||||
|
||||
return module
|
||||
|
||||
Reference in New Issue
Block a user