Fix presence with overrides
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<model>c3c-knx-presence</model>
|
<model>c3c-knx-presence</model>
|
||||||
<created>2023-05-14</created>
|
<created>2023-05-14</created>
|
||||||
<modified>2026-07-04</modified>
|
<modified>2026-07-04</modified>
|
||||||
<version>233</version>
|
<version>234</version>
|
||||||
<agent>false</agent>
|
<agent>false</agent>
|
||||||
<control>lua_gen</control>
|
<control>lua_gen</control>
|
||||||
<controlmethod>KNX</controlmethod>
|
<controlmethod>KNX</controlmethod>
|
||||||
|
|||||||
@@ -119,7 +119,9 @@
|
|||||||
|
|
||||||
time = os.date("*t")
|
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
|
if C3C.Lib.State.DayTime.IsDay() or (time.hour >= 7 and time.hour <= 19) then
|
||||||
C3C.Logger.Debug("Switching on primary light", ctx)
|
C3C.Logger.Debug("Switching on primary light", ctx)
|
||||||
C3C.KnxAddresses.Get("Switch UF Bathroom Primary CTRL"):Send(1)
|
C3C.KnxAddresses.Get("Switch UF Bathroom Primary CTRL"):Send(1)
|
||||||
@@ -134,9 +136,13 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if mediaOverridden then
|
||||||
|
C3C.Logger.Debug("Media overridden, skipping media start event", ctx)
|
||||||
|
else
|
||||||
C3C.Logger.Debug("Firing event: UpperFloorBathroomMediaStart", ctx)
|
C3C.Logger.Debug("Firing event: UpperFloorBathroomMediaStart", ctx)
|
||||||
C4:FireEvent("UpperFloorBathroomMediaStart")
|
C4:FireEvent("UpperFloorBathroomMediaStart")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local presenceEnd = function()
|
local presenceEnd = function()
|
||||||
present = false
|
present = false
|
||||||
@@ -166,9 +172,6 @@
|
|||||||
C3C.Logger.Debug("Firing event: UpperFloorBathroomMediaEnd", ctx)
|
C3C.Logger.Debug("Firing event: UpperFloorBathroomMediaEnd", ctx)
|
||||||
C4:FireEvent("UpperFloorBathroomMediaEnd")
|
C4:FireEvent("UpperFloorBathroomMediaEnd")
|
||||||
end
|
end
|
||||||
|
|
||||||
unOverrideMedia()
|
|
||||||
unOverrideLight()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local presenceEndDelayed = function()
|
local presenceEndDelayed = function()
|
||||||
@@ -186,6 +189,9 @@
|
|||||||
C3C.Logger.Debug("Switching off ambient light", ctx)
|
C3C.Logger.Debug("Switching off ambient light", ctx)
|
||||||
C3C.KnxAddresses.Get("Switch UF Bathroom Ambient CTRL"):Send(0)
|
C3C.KnxAddresses.Get("Switch UF Bathroom Ambient CTRL"):Send(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unOverrideMedia()
|
||||||
|
unOverrideLight()
|
||||||
end
|
end
|
||||||
|
|
||||||
C3C.KnxAddresses.Watch("Control UF Bathroom Presence", function(ga, state)
|
C3C.KnxAddresses.Watch("Control UF Bathroom Presence", function(ga, state)
|
||||||
|
|||||||
Reference in New Issue
Block a user