Jump to content

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


  • 0

LUA help needed (again)


Question

Posted

Hi Guys,

I have a scene strating if I am up, or afternoon or evening.what will switch on my fountain if two doors are open, no problem.

It will switch of after 90 minutes no problem.

 

It will start again because both doors are still open, how to stop this?

I only want one cycle when door is open, in other cases it will be started manually

Thanks in advanced

 

--[[
%% properties
347 value
351 value
%% weather
%% events
%% globals
Dagdelen
--]]


local GlassHousedoor = 351
local DiningoomDoor= 347
local Fountain = 228
local startSource = fibaro:getSourceTrigger();

if
 ( fibaro:getGlobalValue("Dagdelen") == "Opstaan" )
or
 ( fibaro:getGlobalValue("Dagdelen") == "Middag" )
  or
  ( fibaro:getGlobalValue("Dagdelen") == "Evening" )
and
 ( tonumber(fibaro:getValue(347, "value")) > 0  )
 and  (tonumber(fibaro:getValue(351, "value")) > 0 )

  then
    fibaro:call(228, "turnOn");

elseif
     ( tonumber(fibaro:getValue(228, "value"))> 0)
then
  setTimeout(function()
        fibaro:call(228, "turnOff");
    end, 90*60*1000)

elseif
 ( tonumber(fibaro:getValue(347, "value")) == 0  )
 or  (tonumber(fibaro:getValue(351, "value")) == 0 )
then
    fibaro:call(228, "turnOff");
end
fibaro:debug()

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

Hi,

 

I'm not really into LUA, but I would create a variable "RunOnlyOnce".

The fountain should go on with both doors open and "RunOnlyOnce=0"

If Fountain is on Set "RunOnlyOnce = 1"

Reset "RunOnlyOnce = 0" if Both doors are closed, and "RunOnlyOnce=1" , or at midnight.

 

Hope this makes any sense.

 

Edited by Flash

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...