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


Recommended Posts

Posted

in my lua i have a debug but instead of displayed it ones it displayed it three times

 

[DEBUG] 03:00:55: Lamps on 10%
[DEBUG] 03:00:55: Lamps on 10%
[DEBUG] 03:00:55: Lamp
s on 10%

 

what can i do

Posted

Would be nice to have the Lua to check whats wrong

Please login or register to see this image.

/emoticons/default_icon_biggrin.gif" alt=":-D" />

Posted

What sonnyboy said, but please reduce the script to the minimum, leave out everything that works and is non essential. Reading someone else's code can be difficult and stripping it helps.

 

You can also try this at the beginning of your script:

Please login or register to see this code.

If that helps, your script actually ran 3 times, when it produced those debug entries.

Posted

Were you able to solve your problem?

  • Topic Author
  • Posted

    i have debug it in a new if function and seporated it

     

    turnLightOn = function()
      for i = 1,#lamps do
        lightItems = lamps;
        if sunset == time90 or ((sunrise >= time90 and sunrise <=time75) and fibaro:getValue(eyeKeuken, "armed") == "0")
        then fibaro:call(lightItems, "setValue", lampValue10) 
        elseif sunset == time75 or ((sunrise >= time75 and sunrise <=time60) and fibaro:getValue(eyeKeuken, "armed") == "0")
        then fibaro:call(lightItems, "setValue", lampValue20) 
        elseif sunset == time60 or ((sunrise >= time60 and sunrise <=time45) and fibaro:getValue(eyeKeuken, "armed") == "0")
        then fibaro:call(lightItems, "setValue", lampValue30)
        elseif sunset == time45  or ((sunrise >= time45 and sunrise <=time30) and fibaro:getValue(eyeKeuken, "armed") == "0")
        then fibaro:call(lightItems, "setValue", lampValue40)
        elseif sunset == time30 or ((sunrise >= time30 and sunrise <=time15) and fibaro:getValue(eyeKeuken, "armed") == "0")
        then fibaro:call(lightItems, "setValue", lampValue50)
        elseif sunset == time15 or ((sunrise >= time15 and sunrise <=timeNow) )--and fibaro:getValue(eyeKeuken, "armed") == "0")
        then fibaro:call(lightItems, "setValue", lampValue60)
        elseif sunset == timeNow or (sunrise >= timeNow and fibaro:getValue(eyeKeuken, "armed") == "0")
        then fibaro:call(lightItems, "setValue", lampValue70)
        end
      end
    end 
     
    if (sunset or sunrise) <= time90
        then turnLightOn () 
    end
    ------------------debuging------------------------------------------------------------------
    if         sunset == time90 or ((sunrise >= time90 and sunrise <=time75) and fibaro:getValue(eyeKeuken, "armed") == "0")
        then fibaro:debug("Lamps goes on 10%")
        elseif sunset == time75 or ((sunrise >= time75 and sunrise <=time60) and fibaro:getValue(eyeKeuken, "armed") == "0")
        then fibaro:debug("Lamps goes on 20%")

       etc..................

  • Topic Author
  • Posted

    it works for now

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Join the conversation

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

    Guest
    Reply to this topic...

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