feat: Sync printer light with room light
Build and deploy / build (push) Successful in 18m22s
Build and deploy / Deploy container (push) Successful in 39s

This commit is contained in:
2026-06-19 04:05:11 +02:00
parent fe6b3b52e1
commit ce302b148e
2 changed files with 24 additions and 1 deletions
+2
View File
@@ -41,6 +41,8 @@ jobs:
-e AUTOMATION__SECRETS__MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} \ -e AUTOMATION__SECRETS__MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} \
-e AUTOMATION__SECRETS__HUE_TOKEN=${{ secrets.HUE_TOKEN }} \ -e AUTOMATION__SECRETS__HUE_TOKEN=${{ secrets.HUE_TOKEN }} \
-e AUTOMATION__SECRETS__NTFY_TOPIC=${{ secrets.NTFY_TOPIC }} \ -e AUTOMATION__SECRETS__NTFY_TOPIC=${{ secrets.NTFY_TOPIC }} \
-e AUTOMATION__SECRETS__PRINTER_DEVICE_ID=${{ secrets.PRINTER_DEVICE_ID }} \
-e AUTOMATION__SECRETS__PRINTER_ACCESS_CODE=${{ secrets.PRINTER_ACCESS_CODE }} \
$(echo ${{ toJSON(needs.build.outputs.images) }} | jq .automation -r) $(echo ${{ toJSON(needs.build.outputs.images) }} | jq .automation -r)
docker network connect web automation_rs docker network connect web automation_rs
+22 -1
View File
@@ -4,15 +4,35 @@ local helper = require("config.helper")
local presence = require("config.presence") local presence = require("config.presence")
local windows = require("config.windows") local windows = require("config.windows")
local secrets = require("automation:secrets")
--- @type Module --- @type Module
local module = {} local module = {}
function module.setup(mqtt_client) function module.setup(mqtt_client)
local light = devices.LightOnOff.new({ local light = nil
local bambu = devices.Bambu.new({
host = "thalia.huizinga.lan",
device_id = secrets.printer_device_id,
access_code = secrets.printer_access_code,
callbacks = {
connected = function(self)
if light ~= nil then
self:set_on(light:on())
end
end,
},
})
light = devices.LightOnOff.new({
name = "Light", name = "Light",
room = "Guest Room", room = "Guest Room",
topic = helper.mqtt_z2m("guest/light"), topic = helper.mqtt_z2m("guest/light"),
client = mqtt_client, client = mqtt_client,
callback = function(_, state)
bambu:set_on(state.state)
end,
}) })
presence.turn_off_when_away(light) presence.turn_off_when_away(light)
@@ -37,6 +57,7 @@ function module.setup(mqtt_client)
light, light,
window, window,
printer, printer,
bambu,
} }
end end