Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Question
Vinisz 15
Helle Everyone, hope someone can help me out here.
I have this simple scene below running to turn on and off the lights in a room (off after 15 minutes)
It works perfect, however, problems start when turning the light off with the physical light switch (pulse)
If I do that, the light goes out (of course) but this scene keeps running and won't turn on the light if I enter the room again in 5 minutes.
Ideal situation (in my opinion) , to kill this scene when the light is switched of but I have no success yet.... hope someone can help me with that.
Greeting,
Vincent.
--[[
%% autostart
%% properties
505 value
%% weather
%% events
%% globals
--]]
if (fibaro:countScenes()>1) then fibaro:abort() end -- Run only one scene
local light_1 = 513 -- ID Lamp 1
--local light_2 = 78 -- ID lamp 2
local sensor_1 = 505 -- Mov. sensor 1
--local sensor_2 = 86 -- Mov. sensor 2
local timer = 15 -- Timer in minutes
local counter = timer
local counter = timer
if
(tonumber(fibaro:getValue(sensor_1, "value")) > 0 )
then
fibaro:debug("Turn on lights")
--fibaro:call(light_1, "turnOn"--)
fibaro:call(light_1, "turnOn")
--fibaro:call(light_2, "turnOn")
while counter > 0
do
counter = counter -1
fibaro:sleep(60*1000)
fibaro:debug("Counter = ".. counter)
if
tonumber(fibaro:getValue(sensor_1, "value")) > 0 --or tonumber(fibaro:getValue(sensor_2, "value")) > 0
then
counter = timer
end
end
fibaro:debug("Turn off lights")
fibaro:call(light_1, "turnOff")
--fibaro:call(light_2, "turnOff")--
end
Link to comment
Share on other sites
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.