[LUA - PIR and DIMMER] How to override the "SET... FOR... " command
Posted: Sunday 30 October 2016 0:53
Hi all and thank you all for all your ideas around this forum!
In my system (DOMOTICZ on RASPBERRY) I have a PIR sensor in a hallway.
During the night, from bedroom you must to pass in this hallway (where I have a Fibaro Motion Sensor) to go to the bathroom (where there is a FIBARO DIMMER) .
In LUA I write a simple script that SET LEVEL 20% to batroom FOR 2 MINUTES during nighttime (so your eyes are safe!) .
All is ok, but only when we are sleeping!
Because, if someone go to bathroom for a shower in the evening, in example, the light turn off after 2 minutes (it must to pass through the hallway).
I would like to understand if there is the possibility to "cancel" the LUA command ("set 20 for 2") if I press the BATHROOM SWITCH (linked to S1 of the DIMMER).
I read all the SMART LUA and SMART PIR sections, but no idea there to cancel (or what else!) the first command set from the LUA SCRIPT.
So... anyone can explain me how to make a shower with light on after dinner?
Thank you a lot in advance!
If you need some other informations to help me, please ask me.
Giulio
In my system (DOMOTICZ on RASPBERRY) I have a PIR sensor in a hallway.
During the night, from bedroom you must to pass in this hallway (where I have a Fibaro Motion Sensor) to go to the bathroom (where there is a FIBARO DIMMER) .
In LUA I write a simple script that SET LEVEL 20% to batroom FOR 2 MINUTES during nighttime (so your eyes are safe!) .
All is ok, but only when we are sleeping!
Because, if someone go to bathroom for a shower in the evening, in example, the light turn off after 2 minutes (it must to pass through the hallway).
I would like to understand if there is the possibility to "cancel" the LUA command ("set 20 for 2") if I press the BATHROOM SWITCH (linked to S1 of the DIMMER).
I read all the SMART LUA and SMART PIR sections, but no idea there to cancel (or what else!) the first command set from the LUA SCRIPT.
Code: Select all
-- NightLightBathroom.lua
-- Bathroom Dimmer name: Level Luce Bagno
-- Hallway PIR SENSOR: Sensore Disimpegno
local DeviceDimmer = 'Level Luce Bagno'
local DeviceSensore = 'Sensore Disimpegno'
local SetLevel = 'Off'
commandArray = {}
if (devicechanged[DeviceSensore]) then
if (timeofday['Nighttime']) and (otherdevices[DeviceDimmer]=="Off") then
SetLevel = 'Set Level 20 FOR 2';
commandArray[DeviceDimmer] = SetLevel
end
end
Thank you a lot in advance!
If you need some other informations to help me, please ask me.
Giulio