Script LUA: storing dimmer value

Moderator: leecollings

Post Reply
Timothy
Posts: 9
Joined: Wednesday 28 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Netherlands
Contact:

Script LUA: storing dimmer value

Post 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
vleud101
Posts: 3
Joined: Friday 13 January 2017 15:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 15b013c
Location: The Netherlands
Contact:

Re: Script LUA: storing dimmer value

Post 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)
Attachments
example.PNG
example.PNG (25.09 KiB) Viewed 2263 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest