Started work on reimplementing schedules

This commit is contained in:
2024-04-29 04:52:54 +02:00
parent 456d7a359b
commit 02d6630ac6
6 changed files with 112 additions and 135 deletions

View File

@@ -160,23 +160,14 @@ automation.device_manager:add(ContactSensor.new({
},
}))
local bedroom_air_filter = automation.device_manager:add(AirFilter.new({
local bedroom_air_filter = AirFilter.new({
name = "Air Filter",
room = "Bedroom",
topic = "pico/filter/bedroom",
client = mqtt_client,
}))
-- TODO: Use the wrapped device bedroom_air_filter instead of the string
automation.device_manager:add_schedule({
["0 0 19 * * *"] = {
on = {
"bedroom_air_filter",
},
},
["0 0 20 * * *"] = {
off = {
"bedroom_air_filter",
},
},
})
automation.device_manager:add(bedroom_air_filter)
automation.device_manager:schedule("0/1 * * * * *", function()
print("Device: " .. bedroom_air_filter:get_id())
end)