feat(config)!: Made schedule part of new modules
All checks were successful
Build and deploy / build (push) Successful in 11m57s
Build and deploy / Deploy container (push) Has been skipped

This commit is contained in:
2025-10-22 03:24:34 +02:00
parent a938f3d71b
commit 9546585440
7 changed files with 64 additions and 52 deletions

View File

@@ -38,4 +38,8 @@ function module.notify_low_battery()
})
end
module.schedule = {
["0 0 21 */1 * *"] = module.notify_low_battery,
}
return module

View File

@@ -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,
},
}

View File

@@ -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