15.04.2017, 19:36
Thanks for your help Erwin,
However, I get an error from line 66 when trying to run your script. I might have done something wrong... I am completely new to lua programming.
I am also wondering if using a combination of an event-based script and a resident script could do the job.
I created the following two scripts before I saw your reply. The two scripts seem to work as intended, but this might be a poor use of resources in terms of memory etc compared to your script?
The logic is enabling and disabling the resident script...
Event-based script:
value = event.getvalue()
if value == true then
grp.write('Lights', 1)
script.disable('Sensor')
end
if value == false then
script.enable('Sensor')
end
Resident script:
os.sleep(300)
value1 = grp.getvalue('motion sensor')
if value1 == false then
grp.write('Lights', 0)
end
script.disable('Sensor')
What you think?
BR
Mr. D
However, I get an error from line 66 when trying to run your script. I might have done something wrong... I am completely new to lua programming.
I am also wondering if using a combination of an event-based script and a resident script could do the job.
I created the following two scripts before I saw your reply. The two scripts seem to work as intended, but this might be a poor use of resources in terms of memory etc compared to your script?
The logic is enabling and disabling the resident script...
Event-based script:
value = event.getvalue()
if value == true then
grp.write('Lights', 1)
script.disable('Sensor')
end
if value == false then
script.enable('Sensor')
end
Resident script:
os.sleep(300)
value1 = grp.getvalue('motion sensor')
if value1 == false then
grp.write('Lights', 0)
end
script.disable('Sensor')
What you think?
BR
Mr. D