Page 1 of 1

Script LUA: storing dimmer value

Posted: Wednesday 28 December 2016 13:57
by Timothy
Hello,

I'm new to the Domoticz and scripting in LUA. I would like som help to make a script for a dimmable light. I have searched the forum but could not find an awnser.

If the light is on, and there is no movment for 15 minutes i want to store the actual light level and dim the light.
If there is movment detected the light should return to the stored level. (before dimming)


if deviceValue["MotionDetector"]=='off'
then uservariables["Previous_Dim"] = otherdevices_svalues['Dimmer']
otherdevices_svalues['Dimmer'] = '15'

end

Re: Script LUA: storing dimmer value

Posted: Friday 13 January 2017 16:09
by vleud101
You can make this in blocky.

IF Motiondetector == off
dimmer_value_old = dimmer_value
dimmer_value = 15
If motiondetector == on
dimmer_value = dimmer_value_old

(Look at attachment, make a user variable to store old value)