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
Lucas.hannink 0
Hello,
I'm new to Fibaro Home Center and LUA scripts.
This script is serving me well, but I want to make it a bit smarter.
--[[
%% properties
288 value
196 value
%% events
%% globals
--]]
local lightID = 288 -- ID van de lamp
local Motion = 196 -- ID van de bewegingsensor
local sleepTime = 5*60 -- tijd in seconden, dat de lampen aanblijven
local DagNacht = fibaro:getGlobalValue("DagNacht")
if
fibaro:getValue(Motion,'value') == '1' and fibaro:getGlobalValue("DagNacht") == "Nacht"
then
fibaro:debug("Someone moved, turn on light and abort")
fibaro:call(lightID, "setSlider", "3", "50")
fibaro:call(lightID, "pressButton", "1")
fibaro:killScenes(__fibaroSceneId)
end
fibaro:debug("No one moving...")
fibaro:sleep(1000*sleepTime)
fibaro:debug(string.format("No one moved moved for %ss, turn off light %s",sleepTime,lightID))
fibaro:call(lightID,"pressButton", "2")
Now I want this scene to only turn on the lights in the room when they are off and the motion sensor reports motion. When the lights are already on, the scene doesn't have to change anything.
All of the lights are setup with the Philips Hue AIO VD. Can someone help me?
4 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.