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
Reinhold 18
Ik have lights outside with dimmer. Ik will if it's sunset the lights go on 20% en else if it's daylight the lights go off. This part i have is working.
I have a motion sensor and if there is motion it set a timer and the time part is also working.
But the part i don't get working is, if there is motion the dim level must go to 90% and is the timer is 0 the lights must go to 20% or off. If the lights are 20% then go to 90% and back to 20%. And if the lights are off the lights got to 90% and back to off.
This is what i have got so far.
--[[
%% properties
767 value
%% events
%% globals
--]]
-- Zet kleuren voor debug
function Info(color, message)
fibaro:debug(string.format('<%s style="color:%s;">%s</%s>', "span", color, message, "span"))
end
-- Buiten temperatuur
local BuitenTemp = tonumber(api.get('/weather')['Temperature'])
Info("white", "Buitentemperatuur is ".. BuitenTemp.." °C")
-- Tijd
Huidige = os.date("%H:%M", os.time())
HuidigeTijd = os.date("*t")
Volledige_Datum = os.date("%A %d %B %Y")
-- wis debug screen
-- api.delete("/scenes/"..__fibaroSceneId.."/debugMessages")
-- globals voor deze scene zijn
-- Buiten_Dimmer == Aan of Uit
-- Buiten_Timer == aantal minuten
-- Apparaten en locals
local Lamp1 = 764 -- buiten lamp muur woning
local Beweging = 767 -- Bewegings melder buiten
local DagNacht = fibaro:getGlobalValue("H_DagNacht")
local Timer = fibaro:getGlobalValue("Buiten_timer")
local Dimmer1 = fibaro:getValue(764, "value")
-- Buiten lampen savonds aan
if Huidige >= "16:00" and Huidige <= "22:45" then
if DagNacht == "Nacht" then
fibaro:call(Lamp1, "setValue", "20")
end
end
-- Buiten lampen smorgens aan
if Huidige >= "06:00" and Huidige <= "09:00" then
if DagNacht == "Nacht" then
fibaro:call(Lamp1, "setValue", "20")
end
end
-- Lampen automatisch uit
if Huidige == "23:45" then
fibaro:call(764, "turnOff")
end
if DagNacht == "Dag" then
fibaro:call(764, "turnOff")
end
-- Beweging lampen aan of uit
if (tonumber(fibaro:getValue(Beweging, "value")) > 0 ) then
fibaro:setGlobal("Buiten_timer", "6")
Info("Green", "Lampen aan of dimniveau verhogen")
Dimmer1 = Dimmer1 +50
end
if tonumber(Timer) <= 0
then
Info("Green", "Lampen terug in oude staat")
Dimmer1 = Dimmer1 - 50
end
-- Timer
i = Timer
repeat
--fibaro:debug(i)
i = i - 1
until i < tonumber(Timer)
fibaro:setGlobal("Buiten_timer", i)
Info("Green", "Nog "..i.." minuten te gaan")
-- Debug info
Info("red", " het is nu "..DagNacht)
Info("Yellow", " Vandaag is het ".. (Volledige_Datum))
Info("Yellow", " Dimniveau is "..fibaro:getValue(Lamp1, "value").." %")
Edited by Reinhold0 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.