WIP
All checks were successful
Build and deploy / build (push) Successful in 10m15s
Build and deploy / Deploy container (push) Has been skipped

This commit is contained in:
2025-10-19 07:21:57 +02:00
parent a0c5189ada
commit 1766a7b175
10 changed files with 536 additions and 392 deletions

36
config/debug.lua Normal file
View File

@@ -0,0 +1,36 @@
local variables = require("automation:variables")
local presence = require("config.presence")
local light = require("config.light")
local helper = require("config.helper")
local utils = require("automation:utils")
local module = {}
if variables.debug == "true" then
module.debug_mode = true
elseif not variables.debug or variables.debug == "false" then
module.debug_mode = false
else
error("Variable debug has invalid value '" .. variables.debug .. "', expected 'true' or 'false'")
end
--- @param mqtt_client AsyncClient
function module.setup(mqtt_client)
presence.add_callback(function(p)
mqtt_client:send_message(helper.mqtt_automation("debug") .. "/presence", {
state = p,
updated = utils.get_epoch(),
})
end)
light.add_callback(function(l)
mqtt_client:send_message(helper.mqtt_automation("debug") .. "/darkness", {
state = not l,
updated = utils.get_epoch(),
})
end)
return {}
end
return module