Page 1 of 1

Device refused to go OFF after motion

Posted: Wednesday 19 April 2023 18:15
by BarryT
Hi all,

i have several motion detectors in my house wich are turning on lights, what is working perfectly well in a lua script,
but 1 device refused to go OFF after x seconds no motion detected.

Turning ON device works, like all other do:

Trigger=DEVICE:

Code: Select all

commandArray = {}

if devicechanged['Zigbee - BewegingBadkamer'] == 'On' 
then
    commandArray[#commandArray+1] = {['LampBadkamer'] ='Set Level 70' }
    commandArray[#commandArray+1] = {['LampBadkamer'] ='Set Level 70 AFTER 1' }
    print('Verlichting Badkamer AAN')
end
return commandArray
Turning OFF the device does not work at all, also it looks like the scipt does not excluded at all (as nothing see in the log).
Trigger=TIME:

Code: Select all

commandArray = {}
function datetimedifferencenow(s)
             s = s .. ":00"
             year = string.sub(s, 1, 4)
             month = string.sub(s, 6, 7)
             day = string.sub(s, 9, 10)
             hour = string.sub(s, 12, 13)
             minutes = string.sub(s, 15, 16)
             seconds = string.sub(s, 18, 19)
             t1 = os.time()
             t2 = os.time{year = year, month = month, day = day, hour = hour, min = minutes, sec = seconds}
             difference = os.difftime(t1, t2)
             return difference
end

if otherdevices['Zigbee - BewegingBadkamer'] == 'Off' and datetimedifferencenow(otherdevices_lastupdate['Zigbee - BewegingBadkamer']) >= 240 and datetimedifferencenow(otherdevices_lastupdate['Zigbee - BewegingBadkamer']) <= 300 
then
    commandArray[#commandArray+1] = {['LampBadkamer'] ='Off'} 
    commandArray[#commandArray+1] = {['LampBadkamer'] ='Off AFTER 1'} 
    print('Verlichting Badkamer UIT') 
end

return commandArray
Someone knows whats going on in here?
Also tried to make a new script and also with a new name, and tried a remote switch as well, but nothing worked.
All other scripts and lights/motions are working perfectly with exactly the same scripts.

The motion is sending out the ON/OFF state correctly, and light goes ON correctly, but it does never turning OFF..

Thanks!

Re: Device refused to go OFF after motion

Posted: Wednesday 19 April 2023 18:33
by BarryT
Last update: On remote site with exactly the same script it works.....

I'm lost! :roll:

Re: Device refused to go OFF after motion

Posted: Thursday 20 April 2023 17:42
by BarryT
Update:
I removed the (zigbee) motion sensor from domoticz and added it again, after that it works again.
It was a weird one, but it's fixed for now so this case can be closed... :)