Fix presence with overrides
This commit is contained in:
+1
-1
@@ -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>
|
||||
|
||||
@@ -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,8 +136,12 @@
|
||||
end
|
||||
end
|
||||
|
||||
C3C.Logger.Debug("Firing event: UpperFloorBathroomMediaStart", ctx)
|
||||
C4:FireEvent("UpperFloorBathroomMediaStart")
|
||||
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()
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user