Added automatic storage room light
This commit is contained in:
23
config.lua
23
config.lua
@@ -368,6 +368,29 @@ automation.device_manager:add(ContactSensor.new({
|
|||||||
client = mqtt_client,
|
client = mqtt_client,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
local storage_light = LightBrightness.new({
|
||||||
|
name = "Light",
|
||||||
|
room = "Storage",
|
||||||
|
topic = mqtt_z2m("storage/light"),
|
||||||
|
client = mqtt_client,
|
||||||
|
})
|
||||||
|
automation.device_manager:add(storage_light)
|
||||||
|
|
||||||
|
automation.device_manager:add(ContactSensor.new({
|
||||||
|
name = "Door",
|
||||||
|
room = "Storage",
|
||||||
|
sensor_type = "Door",
|
||||||
|
topic = mqtt_z2m("storage/door"),
|
||||||
|
client = mqtt_client,
|
||||||
|
callback = function(_, open)
|
||||||
|
if open then
|
||||||
|
storage_light:set_brightness(100)
|
||||||
|
else
|
||||||
|
storage_light:set_on(false)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}))
|
||||||
|
|
||||||
automation.device_manager:schedule("0 0 19 * * *", function()
|
automation.device_manager:schedule("0 0 19 * * *", function()
|
||||||
bedroom_air_filter:set_on(true)
|
bedroom_air_filter:set_on(true)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user