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

Autostart sceene


HansAvlund

Question

Hello!

 

Probably very stupid question. But... Cant seem to find out how to get this sceene to autorun.  Have done a bit of searching in the forum, but cant seem to find anything that works? atleast I cant get it to work.

 

This sceene controlls blinds. Their posision and their angulation.

 

I use

scene run : Automatic.

Max running instances : 5

 

I used while true do function and a delay. But it does not seem like the best way to implement this...

 

I also tested local selfrun,  and local refresh. But did not seem to work :( 

 

Any idea how to make this sceene run one every 2 minutes or something?

 

Thanks! :D 

 

the code:

 

--[[
%%autostart
%% properties
%% events
%% globals

  
--]]

--[[

ID:

    1267 = Persienne kalle
    1264 = Trappegang/ arkiv
    1261 = Spiserom Ø-Side H
    1255 = Spiserom Ø-Side V
    1227 = Nytt møterom
]]--
-- While true do brukes for att denne scenen skal kjøre hele tiden.


local selfRun       = true
local refresh       = 120

 

  h = tonumber((os.date('%H%M')))
  posisjon = tonumber (fibaro:getValue(1261, "value"))
  vinkling = tonumber  (fibaro:getValue(1261, "value2"))
  Lux = tonumber (fibaro:getValue(1272, "value"))
  Tidned = 630
  Tidopp = 1800
  

  
-- Kjøres når persienne skal opp for natten. Mellom 1800 og 0630
  if ( h > Tidopp or h < Tidned) and (posisjon < 10) then
    
          fibaro:call(1267, "open")
         fibaro:call(1264, "open")
        fibaro:call(1255, "open")
        fibaro:call(1261, "open")
         fibaro:call(1227, "open")
    
  end
  
-- Kjører hvis kl er mellom 0630 og 1800 og Lux verdien er mellom 1200 og 20 000, solskjemingen må være opp fra før for att denne kommandoen skal kjøre.
  if (h > Tidned and h < Tidopp) and (Lux > 1200 and Lux < 20000) and (posisjon > 90)then
  
          fibaro:call(1267, "close")
          fibaro:call(1267, "setValue2", "60")
    
          fibaro:call(1264, "close")
          fibaro:call(1264, "setValue2", "60")
    
          fibaro:call(1255, "close")
          fibaro:call(1255, "setValue2", "60")
    
          fibaro:call(1261, "close")
          fibaro:call(1261, "setValue2", "60")
    
          fibaro:call(1227, "close")
          fibaro:call(1227, "setValue2", "60")
      
  end
  
-- Kjører hvis Lux verdien er undere 20 000 og solskjemingen er nede og vinkelen ikke er satt til 60 fra før
  if(Lux < 20000) and (posisjon < 10) and (vinkling ~= 60) then
    
    fibaro:call(1267, "setValue2", "60")
    fibaro:call(1264, "setValue2", "60")
    fibaro:call(1255, "setValue2", "60")
    fibaro:call(1261, "setValue2", "60")
    fibaro:call(1227, "setValue2", "60")
    
  end
 
-- Kjører hvis Lux verdien er over 20 000 og solskjemingen er nede og vinklingen ikke er satt til 35 fra før. 
  if(Lux > 20000) and (posisjon < 10) and (vinkling ~= 35) then
    
    fibaro:call(1267, "setValue2", "35")
    fibaro:call(1264, "setValue2", "35")
    fibaro:call(1255, "setValue2", "35")
    fibaro:call(1261, "setValue2", "35")
    fibaro:call(1227, "setValue2", "35")
    
  end
  
  -- Scene som kjører hvis det er veldig skart ute og solskjermingen ikke er tatt ned.
  if (h >= Tidned and h <= Tidopp) and (Lux > 20000) and (posisjon < 90) then
  
          fibaro:call(1267, "close")
          fibaro:call(1267, "setValue2", "35")
    
          fibaro:call(1264, "close")
          fibaro:call(1264, "setValue2", "35")
    
          fibaro:call(1255, "close")
          fibaro:call(1255, "setValue2", "35")
    
          fibaro:call(1261, "close")
          fibaro:call(1261, "setValue2", "35")
    
          fibaro:call(1227, "close")
          fibaro:call(1227, "setValue2", "35")
  end
-- tar en pause på 1min før den looper tilbake på starten. 


  
end

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

"while true do" combined with a "fibaro: sleep (X * 1000)" should work as you like, but without seeing your code, it's hard to guess what's wrong.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thanks for the answer. Been fiddeling around with the sceene. And so far I have got (see file attached)

    I am pretty saticfied with how this code works, and I think I will keep it this way. If not any of the experts on the forum sees a incoming problem with the code.

     

    4 hours ago, RH_Dreambox said:

    without seeing your code, it's hard to guess what's wrong.

    I attached new code.

     

    This sceene basicly controls the blinds according to time, and lux. It triggers when motion sensor changes Lux value.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    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...