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

Question

Posted

Hi all,

 

I'm writing a scene for full automation of windows blinds.

 

I need to check a value against all the values in a table if it is smaller or not.

 

So far I have come up with:

 

local StateAll = { }
  StateAll = { value1, value2, value3, value4, value5, valu6, value7, value8, value9, value10, value11}
local Status1= 0
for i = 1, 11 do
    if value1<= StateAll then
      Status1= Status1+ 1
      end
end

if Status1== 11 then
    local Trigger1= true
    fibaro:setGlobal('Trigger1', true)
      else
        local Trigger1= false
        fibaro:setGlobal(''Trigger1', false)
end

 

I works but I think it is not the proper way to do that check. 

 

Can anyone suggest an easier code?

 

Thank you

Recommended Posts

  • 0
Posted

I've checked the impact, you can run it any time you like. On my system (that has a different number of devices than yours) it uses 25-50% percent of one CPU core. I've done a quick test, by putting this in a 100x loop and it did not influence response time (door sensor -> scene > lamp).

There are several ideas and some implementations on this forum, to get around the "changing IDs" problems.

  • 0
  • Inquirer
  • Posted

    Nice. Point me in the direction of those ideas pls

    Please login or register to see this image.

    /emoticons/default_icon_razz.gif" alt=":-P" />

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