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

Prosta scena blokowa jak dodać czas ?


Question

Guest Idp.bydgoszcz
Posted (edited)

Witam serdecznie załączam zdjęcie prostej sceny która po wykryciu braku ruchu z czujnika Satel ma wyłączyć oświetlenie. 

Problem w tym że chciałbym aby to oświetlenie można było wyłączyć dopiero po 2 minutach od wykrycia braku reakcji. 

 

Proszę o pomoc dołączam zdjęcie oraz kod lua

 

czy wystarczy dodać linijkę ?? na samym końcu

fibaro.setTimeout(120000function()
end)

 

{
  conditions = { {
      conditions = { {
          isTrigger = false,
          operator = "match>=",
          property = "cron",
          type = "date",
          value = { "00""18""*""*""*""*" }
        }, {
          isTrigger = false,
          operator = "match<",
          property = "cron",
          type = "date",
          value = { "00""08""*""*""*""*" }
        } },
      operator = "any"
    }, {
      id = 1136,
      isTrigger = true,
      operator = "==",
      property = "value",
      type = "device",
      value = false
    }, {
      id = 141,
      isTrigger = false,
      operator = "==",
      property = "state",
      type = "device",
      value = true
    } },
  operator = "all"
}
 
 
------
 
fibaro.call(141'turnOff')

Please login or register to see this attachment.

Edited by Idp.bydgoszcz

2 answers to this question

Recommended Posts

  • 0
Posted

Moźesz użyć bloczka "Opóźnienie" - prosto w scenie blokowiej.
Nie potrzebujesz Lua :)

Please login or register to see this attachment.


 

  • Thanks 1
  • 0
Guest Rafal_ll
  • Inquirer
  • Posted

    Nie nam Satela-a i nie wiem jakie są możliwości wykorzystania czujników.

    ja wykorzystuję scenę zaczerpniętą z forum 

     

      

    a dokładnie taki kod 

     

    {
      conditions = { {
          id = 59,
          isTrigger = true,
          operator = "==",
          property = "value",
          type = "device",
          value = true
        }, {
          id = 82,
          isTrigger = true,
          operator = "==",
          property = "value",
          type = "device",
          value = true
        } },
      operator = "any"
    }
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    local light = {98,100,102}
    local motion1 = {59,82}
     
    local light = {98,100,102} -- ID's do włączenia
    local motion = {59,82} -- ID's Czujniki ruchu
    local lux = {60,84} -- ID's czujnik światła
    local maxTime = 1*60  -- Maksymalny czas, przez jaki czujnik powinien być bezczynny przed wyłączeniem 
    local sleepTime = 5 -- Czas w sekundach między każdym sprawdzeniem czujnika ruchu (domyślnie = 5)
    local debug_TAG = "Garage light" -- Znacznik dla komunikatów debugowania
     
    -- Poniżej tutaj żadne zmiany nie są konieczne
     
    for i in pairs(light) do -- Włącz światła
      fibaro.debug(debug_TAG,"Turning on (ID " ..light[i] ..") " ..fibaro.getName(light[i]) .." for " ..maxTime .." seconds")
      fibaro.call(light[i],"turnOn")
    end
     
    for i in pairs(lux) do -- Pokaż poziom luksów czujników Lux
      fibaro.debug(debug_TAG,"Aktualny poziom luksów " ..lux[i] .." " ..fibaro.getName(lux[i]) ..": " ..fibaro.getValue(lux[i],"value"))
    end
     
    local safeTime = 0
    while safeTime < maxTime do -- Pętla do osiągnięcia maxTime
      fibaro.sleep(sleepTime*1000)                 
      safeTime=safeTime+sleepTime 
      fibaro.debug(debug_TAG,"Odliczanie safeTime " ..safeTime .." do maxTime " ..maxTime)
      for i in pairs(motion) do 
        if fibaro.getValue(motion[i],"value") then -- Sprawdź, czy czujniki ruchu są naruszone
           fibaro.debug(debug_TAG,"Reset przez czujnik ruchu " ..motion[i] .." " ..fibaro.getName(motion[i]))
           safeTime = 0 -- Zresetuj safeTime do zera
        end
      end
    end 
      
    for i in pairs(light) do -- Odliczono do maxTime, wyłącz światła
      fibaro.debug(debug_TAG, "Turning off " ..light[i] .." " ..fibaro.getName(light[i]))
      fibaro.call(light[i],"turnOff") 
    end
     

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