I have this dzVents script but the when the nomotionCounter variable hits 3 the lights won't turn off:
Code: Select all
return {
on = {
timer = { 'at 22:15' },
variables = { 'nomotionCounter' },
devices = { 'IsDonker', 'IemandThuis' },
},
execute = function(domoticz, device, variable)
--Niemand thuis, Alle verlichting aan = alle verlichting UIT
if
domoticz.devices('VerlichtingBeneden_IemandThuis').state == 'On' and
domoticz.devices('IemandThuis').state == 'Off' and
domoticz.time.matchesRule('between 22:15 and sunrise')
then
domoticz.scenes('VerlichtingBeneden_AllOff').switchOn()
domoticz.log('Verlichting beneden uit', domoticz.LOG_INFO)
--Iemand thuis, Alle verlichting aan, 10 minuten geen beweging = sommige verlichting DIMMEN
elseif
domoticz.devices('VerlichtingBeneden_IemandThuis').state == 'On' and
domoticz.devices('VerlichtingBeneden_BijnaUit').state == 'Off' and
domoticz.variables('nomotionCounter').value == 10 and
domoticz.time.matchesRule('between 22:15 and sunrise')
then
domoticz.devices('DimmerKeukenTafel').dimTo(20)
domoticz.devices('DimmerStaandeLamp').dimTo(20)
domoticz.devices('VerlichtingBeneden_BijnaUit').switchOn()
domoticz.log('Verlichting beneden bijna uit', domoticz.LOG_INFO)
--Niemand thuis, Alle verlichting aan, Slaapkamer verlichting 3 minuten aan = alle verlichting UIT
elseif
domoticz.devices('VerlichtingBeneden_IemandThuis').state == 'On' and
domoticz.devices('EntertainmentUit').state == 'On' and
domoticz.devices('DimmerSlaapkamer').state ~= 'Off' and
domoticz.variables('nomotionCounter').value == 3 and
domoticz.time.matchesRule('between 22:15 and sunrise')
then
domoticz.scenes('VerlichtingBeneden_AllOff').switchOn()
domoticz.log('Verlichting beneden uit', domoticz.LOG_INFO)
--Donker, Niemand thuis = Sommige verlichting UIT
elseif
domoticz.devices('VerlichtingBeneden_NiemandThuis').state == 'On' and
domoticz.time.matchesRule('at 22:15')
then
domoticz.scenes('VerlichtingBeneden_SomeOff').switchOn()
domoticz.log('Sommige Verlichting beneden uit', domoticz.LOG_INFO)
--Donker, Niemand thuis, Na 22:15 = Keuken verlichting tijdelijk UIT
elseif
domoticz.devices('VerlichtingBeneden_Tijdelijk').state == 'On' and
domoticz.devices('IemandThuis').state == 'Off' and
domoticz.time.matchesRule('between 22:15 and sunrise')
then
domoticz.devices('DimmerKeukenTafel').switchOff()
domoticz.devices('VerlichtingBeneden_Tijdelijk').switchOff()
domoticz.log('Keuken Verlichting tijdelijk uit', domoticz.LOG_INFO)
end
end
}
- Spoiler: show