Fix presence with overrides

This commit is contained in:
2026-07-29 08:21:05 +02:00
parent b176c7705d
commit d4fe451788
2 changed files with 13 additions and 7 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<model>c3c-knx-presence</model>
<created>2023-05-14</created>
<modified>2026-07-04</modified>
<version>233</version>
<version>234</version>
<agent>false</agent>
<control>lua_gen</control>
<controlmethod>KNX</controlmethod>
+10 -4
View File
@@ -119,7 +119,9 @@
time = os.date("*t")
if lux < 50 then
if lightOverridden then
C3C.Logger.Debug("Light overridden, skipping automatic light control", ctx)
elseif lux < 50 then
if C3C.Lib.State.DayTime.IsDay() or (time.hour >= 7 and time.hour <= 19) then
C3C.Logger.Debug("Switching on primary light", ctx)
C3C.KnxAddresses.Get("Switch UF Bathroom Primary CTRL"):Send(1)
@@ -134,9 +136,13 @@
end
end
if mediaOverridden then
C3C.Logger.Debug("Media overridden, skipping media start event", ctx)
else
C3C.Logger.Debug("Firing event: UpperFloorBathroomMediaStart", ctx)
C4:FireEvent("UpperFloorBathroomMediaStart")
end
end
local presenceEnd = function()
present = false
@@ -166,9 +172,6 @@
C3C.Logger.Debug("Firing event: UpperFloorBathroomMediaEnd", ctx)
C4:FireEvent("UpperFloorBathroomMediaEnd")
end
unOverrideMedia()
unOverrideLight()
end
local presenceEndDelayed = function()
@@ -186,6 +189,9 @@
C3C.Logger.Debug("Switching off ambient light", ctx)
C3C.KnxAddresses.Get("Switch UF Bathroom Ambient CTRL"):Send(0)
end
unOverrideMedia()
unOverrideLight()
end
C3C.KnxAddresses.Watch("Control UF Bathroom Presence", function(ga, state)