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


  • 1

HC3 Scene (light) Devices (more than one) trigger


NLWaard

Question

Is it possible to write a (one) trigger for the HC3 scene that responds to all devices, whose interfaces are light.

I don't want to write for every light device a trigger..

 

What I've tried, and it doesn't work is:

Please login or register to see this code.

OR id= 

Please login or register to see this code.

OR id= fibaro.getDevicesID

Please login or register to see this code.

And changing 'device' to 'interfaces' or 'interFaces' doesn't work either.

Please login or register to see this code.

 

The only code that's working is:

But, this trigger is only for 2 devices, and I have a lot more.... 
And I don't like it because it's hard to maintain..

 

Please login or register to see this code.

 

Can someone help me with this? please! 

 

 

Edited by NLWaard
At JCab's indication, I changed 'all' to 'any
Link to comment
Share on other sites

Recommended Posts

  • 0
42 minutes ago, NLWaard said:

Is it possible to write a (one) trigger for the HC3 scene that responds to all devices, whose interfaces are light.

I don't want to write for every light device a trigger..

 

What I've tried, and it doesn't work is:

Please login or register to see this code.

OR id= 

Please login or register to see this code.

OR id= fibaro.getDevicesID

Please login or register to see this code.

And changing 'device' to 'interfaces' or 'interFaces' doesn't work either.

Please login or register to see this code.

 

The only code that's working is:

But, this trigger is only for 2 devices, and I have a lot more.... 
And I don't like it because it's hard to maintain..

 

Please login or register to see this code.

 

and it should be "any", not "all".

 

...and no, I don't know of any other way to do it.

Link to comment
Share on other sites

  • 0

condition section like a HC2 header triggering can trigger only on "specific value" - device id for example and does not mean "like" values or "calculated" values.

alas. and it's pain

Edited by 10der
  • Like 1
Link to comment
Share on other sites

  • 0

Please login or register to see this code.

Is it ok to do this?

Edited by Arnes
posted before i was finish
Link to comment
Share on other sites

  • 0

@Arnes Hey, Cap!! we are stil talking about condition window?

 

Please login or register to see this image.

/monthly_2020_09/image.png.8dc1b1a29d034ab0459fffdcb4f90271.png" />

 

Edited by 10der
Link to comment
Share on other sites

  • 0
4 minutes ago, 10der said:
Quote

@Arnes Hey, Cap!! we are stil talking about condition window?

 

 

But is this a OK solution to do this as an action? Since it is not possible to do in condition.

Link to comment
Share on other sites

  • 0
  • Inquirer
  •  

    6 minutes ago, Arnes said:

     

     

    But is this a OK solution to do this as an action? Since it is not possible to do in condition.

     

    Okay, I think... 
    But what do you think, should be the trigger to perform this action?

    and, is a QA not better then (because of the loop)?

     

    thanks to you both!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 3 hours ago, jgab said:

    and it should be "any", not "all".

     

    ...and no, I don't know of any other way to do it.

    ? What you say makes sense .. (but the strange thing is, both codes work ?..)

    changed it to 'any', Thanks..

    Link to comment
    Share on other sites

    • 0
    1 hour ago, NLWaard said:

     

     

    Okay, I think... 
    But what do you think, should be the trigger to perform this action?

    and, is a QA not better then (because of the loop)?

     

    thanks to you both!

     

    Yes you might have right. Have the same problem as you, and just started to learn . I have to look at QA.
    Anyone have some idea how to do this with QA?

    Link to comment
    Share on other sites

    • 0
    10 minutes ago, Arnes said:

     

    Yes you might have right. Have the same problem as you, and just started to learn . I have to look at QA.
    Anyone have some idea how to do this with QA?

     

    Link to comment
    Share on other sites

    • 0
    2 hours ago, Arnes said:

    Please login or register to see this code.

    Is it ok to do this?

     

    Yes, you can do this.

    I would recommend

    Please login or register to see this code.

    instead of sleep.

     

    If you move to a QA you could try

    Please login or register to see this link.

    that is created for just this kind of stuff.

    Please login or register to see this code.

    It does look at all triggers generated by the HC3 but tries to be a bit smart and only invoke rules when they can be triggered.

    It's also easy to add recurring or daily schedulers.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 27 minutes ago, jgab said:

     

    Yes, you can do this.

    I would recommend

    Please login or register to see this code.

    instead of sleep.

     

    I tried this in my 0,15%,50%,99% light bulb, as you indicated,

    but with this it looks that you create a new class and can't refer to the main class where you are working in.

    In other words, you can't use self:.... I even had to change self:debug() to print(). ???


    Besides that, it looks odd to me, like you are building a stack,
    before the fuction is finished you call it again.
    Or am I wrong...

     

    You are the expert ;)

     

    Link to comment
    Share on other sites

    • 0
    1 minute ago, NLWaard said:

     

    I tried this in my 0,15%,50%,99% light bulb, as you indicated,

    but with this it looks that you create a new class and can't refer to the main class where you are working in.

    In other words, you can't use self:.... I even had to change self:debug() to print(). ???


    Besides that, it looks odd to me, like you are building a stack,
    before the fuction is finished you call it again.
    Or am I wrong...

     

    You are the expert ;)

     

     

    You need to be in a scope where you have access to 'self'

    Ex.

    Please login or register to see this code.

    setTimeout returns immediately without calling the function,  and after x ms the system will call the function for you in a new "thread". No stack is built-up.

    See explanation here

     

     

     

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 37 minutes ago, jgab said:

    If you move to a QA you could try

    Please login or register to see this link.

    that is created for just this kind of stuff.

    Please login or register to see this code.

    It does look at all triggers generated by the HC3 but tries to be a bit smart and only invoke rules when they can be triggered.

    It's also easy to add recurring or daily schedulers.

     

    sounds like music to my ears.

    Is it easy to understand?

     

    I already wanted to build something like that.

    A QA that checks light intensity and then sets variables that in turn switch devices...

    and more One big main loop for all (or any).


    to keep the HC speedy..

     

    thanks for sharing, I will dive into it.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 7 minutes ago, jgab said:

     

    You need to be in a scope where you have access to 'self'

    Ex.

    Please login or register to see this code.

    setTimeout returns immediately without calling the function,  and after x ms the system will call the function for you in a new "thread". No stack is built-up.

    See explanation here

     

    Ahum ??. thead's...

     

    I like thread's, harder to understand, but much better performance...

    I have changed 'sleep' into 'setInterval' as you indicated earlier.
    (I don't know. i think i'ts me. but that 'timeout' in the loop itself...).

    and guess what...  now it works, as it should.

     

    Thanks again, and like I said, you'r the expert..

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • By fine-tuning the code, I changed the following code by an anonymous function (Lambda expression)

    Sorry moved to the parent child question.

     

     

     

    Edited by NLWaard
    moved to correct location, and change Lambda to anonymous function
    Link to comment
    Share on other sites

    • 0
    1 hour ago, NLWaard said:

    Lambda expression,

    LUA?! Lambda expression??!

    OMG! :)  

    Link to comment
    Share on other sites

    • 0
    15 minutes ago, 10der said:

    LUA?! Lambda expression??!

    OMG! :)  

    Haskell programmer?

    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    Jan!!!!

    it hit me.

     

    what LUA lambda function is :) 

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
    18 minutes ago, 10der said:

    Jan!!!!

    it hit me.

     

    what LUA lambda function is :) 

    Please login or register to see this code.

     

    You have seen the light - welcome to a more functional world ?

    • Thanks 1
    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...