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

Sterowanie RGBW - wschod/zachod slonca


Question

Posted

Pomozcie, jak stworzyc scene, w ktorej automatycznie bedzie sie wlaczac oswietlenie strerowane przez RGBW o zachodzie, i wylaczac o zachodzie slonca... probowalem tworzyc takie sceny, ale niestety nie dziala, i nie wiem czemu.  Druga sprawa, czy nalezy stworzyc dwie sceny? Jedna na wlaczenie, druga na wylaczenie? 

W zalaczniku przylad jak zrobilem wlaczanie. Cos robie nie tak?

Please login or register to see this attachment.

19 answers to this question

Recommended Posts

  • 0
Posted

najpierw włącz a potem ustaw kolor

Please login or register to see this image.

/emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

Please login or register to see this attachment.

  • 0
Posted

Powinieneś utworzyć dwie osobne sceny blokowe (względnie jedną w lua). Powyższa włączy oświetlenie, ale już go nie wyłączy.

  • 0
  • Inquirer
  • Posted

    najpierw włącz a potem ustaw kolor

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    dla mnie logiczne jest to, ze ustawiajac kolor automatycznie wlaczamy

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> ale moze to nie jest az tak "madre"

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> zobacze, dzieki za podpowiedz.

     

    Powinieneś utworzyć dwie osobne sceny blokowe (względnie jedną w lua). Powyższa włączy oświetlenie, ale już go nie wyłączy.

    Tak tez robilem, dzieki.

    • 0
  • Inquirer
  • Posted

    No wiec, scena zadziala moze ze dwa razy i na tym koniec... reczne wyzwalanie dziala bez problemu... Macie pomysl czemu nie dziala?

    • 0
    Posted

    Gdy jeszcze używałem scen blokowych miałem podobny problem. W moim przypadku rozwiązaniem problemu było dodanie zmiennej globalnej i zmiana jej wartosci o wschodzie i zachodzie słońca.

    Wartosc 1 zmiennej zapalała a wartość 0 gasiła oświetlenie.

    • 0
  • Inquirer
  • Posted

    Niestety nic to nie zmienilo

    Please login or register to see this image.

    /emoticons/default_sad.png" alt=":(" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> reczne wyzwalanie dziala, ale automat juz nie.

    Zrobilem taki skrypt w LUA co by sie wlaczalo i wylaczalo w zaleznosci od zmiennej globalnej.

    Please login or register to see this code.

    Do tego mam dwa skrypty zmieniajace wartosc "slonce":

    Please login or register to see this link.

     

    Czy skrypty zmieniajace wartosc zmiennej tez powinny byc LUA?

    • 0
    Posted

    Niestety nic to nie zmienilo

    Please login or register to see this image.

    /emoticons/default_sad.png" alt=":(" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> reczne wyzwalanie dziala, ale automat juz nie.

    Zrobilem taki skrypt w LUA co by sie wlaczalo i wylaczalo w zaleznosci od zmiennej globalnej.

    Please login or register to see this code.

    Do tego mam dwa skrypty zmieniajace wartosc "slonce":

    Please login or register to see this link.

     

    Czy skrypty zmieniajace wartosc zmiennej tez powinny byc LUA?

     

    Jeżeli zmienna "slonce" faktycznie zmienia wartość to powinno działać

    • 0
    Posted

    Kod w LUA do określania pory dnia, oczywiście znaleziony na naszym forum 

    Please login or register to see this image.

    /emoticons/default_icon_cool.gif" alt="8-)" />

    wypróbuj,u mnie działa świetnie (już podmieniłem nazwę zmiennej na "slonce").

     

     

    --[[
    %% properties
    %% autostart
    %% globals
    --]]
     
    -- Initial parameters -------------------------------------------------------
     
    sunriseDelay = 0
    sunsetDelay = 0
     
    -- Functions -----------------------------------------------------------------
     
    -- funkcja zamienia czas w formacie tekstowym "HH:MM" lub os.date("*t") 
    -- na liczbę minut od północy
     
    function toMinutes(czasHHMM)
    local a
    if type(czasHHMM) == "string" then
    a = tonumber(string.sub(czasHHMM, 1, 2)) * 60 + tonumber(string.sub(czasHHMM, 4, 5))
    else    
    a = tonumber(czasHHMM.hour) * 60 + tonumber(czasHHMM.min)
    end
    return a
    end
     
    -- funkcja zamienia liczbę minut od północy  na format tekstowy godziny "HH:MM"
     
    function toHHMM(minutes)
    local b = string.format("%02d",((minutes/60*100) - ((minutes/60*100) % 100))/100)
    local c = string.format("%02d",minutes - (tonumber(b)*60))
    local d = b..":"..c
    return d
    end
     
    -- end of Functions-----------------------------------------------------------
     
     
    while true do
      
    -- ustalenie ilości minut od północy do godziny wschodu i zachodu słońca
     
    local sunriseMinutes = toMinutes(fibaro:getValue(1, 'sunriseHour'))
    local sunsetMinutes = toMinutes(fibaro:getValue(1, 'sunsetHour'))
     
    -- ustalenie ilości minut od północy do teraz
     
    local nowMinutes = toMinutes(os.date("*t"))
        
    -- ustawienie zmiennej globalnej slonce   
     
     
        if nowMinutes > (sunriseMinutes + sunriseDelay) 
           and nowMinutes < (sunsetMinutes + sunsetDelay)
          then
          fibaro:setGlobal("slonce", "0")
          
          else
          fibaro:setGlobal("slonce", "1")
         
        end
     
     
    -- debug --------------------------------------------------------------------
     
    fibaro:debug("Teraz jest: "..toHHMM(nowMinutes))
    fibaro:debug("Wschód słońca: "..fibaro:getValue(1, 'sunriseHour'))
    fibaro:debug("Zachód słońca: "..fibaro:getValue(1, 'sunsetHour'))
    fibaro:debug("slonce = "..fibaro:getGlobalValue("slonce"))
    fibaro:debug("-----------------------------------------")
      
    -----------------------------------------------------------------------------
     
    fibaro:sleep(60*1000)
        
    end -- end while
    • 0
  • Inquirer
  • Posted

    Zobaczymy, dzieki!

     

    A jeszcze pytanie, czy skrypt wlaczajacy swiatlo w zaleznosci od zmiennej nie powinien byc jakos zapetlony? Tzn. nie powinien sprawdzac co jakis czas czy sie zmienna nie zmienila?

    • 0
    Posted

    Jesli chodzi o tą scene:

    --[[

    %% autostart

    %% properties

    %% events

    %% globals

    slonce

    --]]

    local startSource = fibaro:getSourceTrigger();

    if

    (tonumber(fibaro:getGlobalValue("slonce")) == tonumber("1"))

    then

    fibaro:call(22, "turnOn");

    fibaro:call(22, "setColor", "10","3","0","0");

    else

    fibaro:call(22, "turnOff");

    end

    To wyzwalasz ją każdą zmianą stanu ziennej "slonce", czyli wygląda ok

    Please login or register to see this image.

    /emoticons/default_wink.png" alt=";)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    • 0
  • Inquirer
  • Posted

    nalezy teraz trzymac kciuki...

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> dzieki jeszcze raz za pomoc.

    • 0
  • Inquirer
  • Posted

    A jeszcze jedno, chcialbym zeby zmienna zmieniala wartosc po zachodzie slonca 30 min i 30 min przed wschodem slonca... jak ustawic parametry:

    sunriseDelay = 0

    sunsetDelay = 0
    W jakich sa one jednostkach?
    • 0
    Posted

    W milisekundach, 60*1000 to 60 sekund

    • 0
  • Inquirer
  • Posted

    rozumiem, ze jezeli chce dana zmienna zmienic "przed" pare minut, to moge podac wartosc ujemna?

    • 0
    Posted

    Nie testowalem tego ale wydaje mi sie że nie. Poprostu podajesz ile przed a algorytm już "wie" co z tym zrobic.

    • 0
  • Inquirer
  • Posted

    No nie do konca, bo zmienna jest tylko opoznienie, a ja bym chcial zeby to nastapilo wczesniej

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> Plan jest taki, zeby zapalalo sie swiatlo ok 30 min po zachodzie i gaslo 30 min przed wschodem.

    • 0
  • Inquirer
  • Posted

    Ok, raz dziala, raz nie dziala... jako ze jestem zielony w tej materii, nie mam pojecia czemu. Raz na jakis czas widze ze w okienku debugowania zatrzymuje sie skrypt do okreslenia pory dnia... bo rozumiem, ze jezeli skrypt chodzi, to powinien sie tam caly czas uaktualniac? A jezeli sie zatrzymuje, to jak mozna sprawdzic co jest przyczyna?

    • 0
    Posted

    U mnie po aktualizacji do 4.080 też sie zatrzymuje kiedy chce. Przed aktualizacją bardzo rzadko się zawieszał.

    • 0
  • Inquirer
  • Posted

    u mnie mam centralke zintegrowana z satelem, pomoglo zaznaczenie opcji "Chroń scenę przed wyłączeniem podczas alarmu"

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