Compare commits

...

3 Commits

Author SHA1 Message Date
b547f66d86 feat: Added 3d printer to guest room
All checks were successful
Build and deploy / build (push) Successful in 17m17s
Build and deploy / Deploy container (push) Successful in 3m19s
2025-11-16 16:37:12 +01:00
f3de8e36ea fix: Frontdoor presence is the wrong way around
All checks were successful
Build and deploy / build (push) Successful in 14m48s
Build and deploy / Deploy container (push) Successful in 1m59s
2025-10-30 20:56:49 +01:00
44f2c57819 fix: Set entrypoint lua path correctly in Dockerfile
All checks were successful
Build and deploy / build (push) Successful in 11m27s
Build and deploy / Deploy container (push) Successful in 29s
2025-10-22 05:17:02 +02:00
3 changed files with 24 additions and 19 deletions

View File

@@ -21,5 +21,7 @@ RUN cargo auditable build --release
FROM gcr.io/distroless/cc-debian12:nonroot AS runtime
COPY --from=builder /app/target/release/automation /app/automation
ENV AUTOMATION__ENTRYPOINT=/app/config/config.lua
ENV LUA_PATH="/app/?.lua;;"
COPY ./config /app/config
CMD [ "/app/automation" ]

View File

@@ -25,10 +25,18 @@ function module.setup(mqtt_client)
})
windows.add(window)
local printer = devices.OutletOnOff.new({
name = "3D Printer",
room = "Guest Room",
topic = helper.mqtt_z2m("guest/printer"),
client = mqtt_client,
})
--- @type Module
return {
light,
window,
printer,
}
end

View File

@@ -59,26 +59,21 @@ function module.setup(mqtt_client)
})
hallway_automation.set_trash(trash)
---@param duration number
---@return fun(_, open: boolean)
local function frontdoor_presence(duration)
local timeout = utils.Timeout.new()
local timeout = utils.Timeout.new()
local function frontdoor_presence(_, open)
if open then
timeout:cancel()
return function(_, open)
if open then
timeout:cancel()
if presence.overall_presence() then
mqtt_client:send_message(helper.mqtt_automation("presence/contact/frontdoor"), {
state = true,
updated = utils.get_epoch(),
})
end
else
timeout:start(duration, function()
mqtt_client:send_message(helper.mqtt_automation("presence/contact/frontdoor"), nil)
end)
if not presence.overall_presence() then
mqtt_client:send_message(helper.mqtt_automation("presence/contact/frontdoor"), {
state = true,
updated = utils.get_epoch(),
})
end
else
timeout:start(debug.debug_mode and 10 or 15 * 60, function()
mqtt_client:send_message(helper.mqtt_automation("presence/contact/frontdoor"), nil)
end)
end
end
@@ -89,7 +84,7 @@ function module.setup(mqtt_client)
topic = helper.mqtt_z2m("hallway/frontdoor"),
client = mqtt_client,
callback = {
frontdoor_presence(debug.debug_mode and 10 or 15 * 60),
frontdoor_presence,
hallway_automation.door_callback,
},
battery_callback = battery.callback,