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 (edited)

Hi

 

If I use multiple conditions why doesn't work?  In EventRunner4 

  rule("@sunrise+07:00 & @sunset+00:10 & @@00:00:05 => log('apple ')")

 

this line in my interpretation must send messages between  sunrise +7 hours and sunset+10 min in every 5 seconds but,  only in this periods. But the sunrise and sunset criteria isn't applied. Why ?

 

 

Edited by iTibor
complete text
Posted

You request & so it will never be true!

sunrise+07:00..sunset00:10  this is between the two values

Posted (edited)

This conditions mean between 13.40 and  20.40  - or something like this, but this rule("@sunrise+07:00 & @sunset+00:10 & @@00:00:05 => log('apple ')")  now in 11.50 doesn't have to show on the debug line de log message Alma , but does , in every 5 sec.

 

My initial goal it is to run a scene in every hour but only between sunrise +3 hour and sunset 

Edited by iTibor
Posted

Please login or register to see this code.

This shows every hour between sunrise + 3 hour and sunset

Posted
3 hours ago, Sjakie said:

Please login or register to see this code.

This shows every hour between sunrise + 3 hour and sunset

Thank you very much . It's working.

How can I run a scene instead of printing a log message?

 

 

Posted

sceneID:start

Posted (edited)

@jgabIs this still usable?
 

 

On 7/9/2022 at 3:25 PM, jgab said:

New version 0.81 with a new experimental feature - user action events.

 

When someone interacts with a device in the app there are events emitted with the device and userid.

Ex. a com.fibaro.multilevelSwitch device with id 756.

When the user with id 917 turn on, off and changes dimming we get the events

Please login or register to see this code.

 

Which means that we can create a rule like

rule("#user{id=917,value='action',data={id=756,actionName='turnOn'}} => log('Ann turned on the light')")

 

Beware that the normal event 

Please login or register to see this code.

is also emitted.

Also the order of the events seems to not be predictable. I've seen the #device event being fired after the #user event.

 

Anyway, will experiment more with it to see how it can be used.

 

 

Edited by lux
Posted
On 9/1/2023 at 9:15 AM, Sjakie said:

sceneID:start

Thanks!

Posted

I have experimented some strange behavior. If someone can take a look at it?

 

Please login or register to see this code.

 

Posted (edited)

 

@Neo Andersson

Please login or register to see this code.

 

Edited by lux
  • Topic Author
  • Posted
    11 hours ago, Neo Andersson said:

    I have experimented some strange behavior. If someone can take a look at it?

     

    Please login or register to see this code.

     

    Yes, the once(ext_lux_sensor:lux < 720) effectively disables the rule until the lux goes above 720 again (or you restart the QA and the rules start afresh again)

    You need 'once' less than you think...

    3 hours ago, lux said:

     

    @Neo Andersson

    Please login or register to see this code.

     

    Yes, the || >> is an syntactic way to express if-then

    Please login or register to see this code.

     

    Posted

    Hello guys

     

    How can we access the value coming from an event on the action side of the rule?

    In case of log function it is evidently like

    Please login or register to see this code.

    I have tried event like this

    Please login or register to see this code.

     

    On 9/10/2023 at 5:02 AM, lux said:

     

    @Neo Andersson

    Please login or register to see this code.

     

    Yeah that is similar to 

    Please login or register to see this code.

    Thanks anyway

  • Topic Author
  • Posted

    Please login or register to see this code.

    The $ tells the engine that it's a variable you want to match against. But then the variable is used without the '$' in the rule. It becomes a rule local variable bound to the matched value

    Posted
    1 hour ago, jgab said:

    Please login or register to see this code.

    The $ tells the engine that it's a variable you want to match against. But then the variable is used without the '$' in the rule. It becomes a rule local variable bound to the matched value

    Thanks, meanwhile I figured it out, that strings can not be concatenated on the right side of the rule...

    Also found two examples in this topic, how to catch who accessed a door lock. I tried both, but none of them work. Is this a deprecated function, or i just didn't get the point?

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    9 hours ago, Neo Andersson said:

    Thanks, meanwhile I figured it out, that strings can not be concatenated on the right side of the rule...

    Yes, they can, but the operator is '++' not '..'

    '..' is reserved for time intervals.

     

    9 hours ago, Neo Andersson said:

    Also found two examples in this topic, how to catch who accessed a door lock. I tried both, but none of them work. Is this a deprecated function, or i just didn't get the point?

    Please login or register to see this code.

     

    It seems that it kind of depends on the lock.

    Can you provide me of the log of the whole event. Like

    Please login or register to see this code.

    and see what it reports when you lock/unlock it?

     

    The format

    Please login or register to see this code.


    don't work (anymore), the event that should be generated is

    Please login or register to see this code.

    and what's available after myLock:access... are the properties in value

     

    Posted (edited)
    4 hours ago, jgab said:

    Yes, they can, but the operator is '++' not '..'

    '..' is reserved for time intervals.

     

    It seems that it kind of depends on the lock.

    Can you provide me of the log of the whole event. Like

    Please login or register to see this code.

    and see what it reports when you lock/unlock it?

     

    The format

    Please login or register to see this code.


    don't work (anymore), the event that should be generated is

    Please login or register to see this code.

    and what's available after myLock:access... are the properties in value

     

    Jan, we have some other unexpected behaviours here. Custmer asked as to play some welcome message when directors arrive to office, once a day, when the first person arrives. So we created a rule like this.

     

    Please login or register to see this code.

     

    Edited by Neo Andersson
    Posted
    6 hours ago, jgab said:

    Yes, they can, but the operator is '++' not '..'

    '..' is reserved for time intervals.

     

    It seems that it kind of depends on the lock.

    Can you provide me of the log of the whole event. Like

    Please login or register to see this code.

    and see what it reports when you lock/unlock it?

     

    The format

    Please login or register to see this code.


    don't work (anymore), the event that should be generated is

    Please login or register to see this code.

    and what's available after myLock:access... are the properties in value

     

    This is what a recieved

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    3 minutes ago, Neo Andersson said:

    This is what a recieved

    Please login or register to see this code.

     

    Then you don't get an accessControlEvent from the lock - just a property change (and no user id)

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    2 hours ago, Neo Andersson said:

    Jan, we have some other unexpected behaviours here. Custmer asked as to play some welcome message when directors arrive to office, once a day, when the first person arrives. So we created a rule like this.

     

    Please login or register to see this code.

     

    Well, if you at the right hand do <expr> & <expr> & <expr> ... it will stop when the first expr becomes false.

    My guess here is that broadcast() return nil - i.e. false, and the expression terminates and the CEO flag never gets set.

    Make broadcast return true or rewrite 

    Please login or register to see this code.

    or alternatively

    Please login or register to see this code.

    or alternatively

    Please login or register to see this code.

     

    The second error doesn't make sense and I can't repeat it. You have some invisible unicode characters in that string?

  • Topic Author
  • Posted
    19 minutes ago, jgab said:

    Well, if you at the right hand do <expr> & <expr> & <expr> ... it will stop when the first expr becomes false.

    My guess here is that broadcast() return nil - i.e. false, and the expression terminates and the CEO flag never gets set.

    Make broadcast return true or rewrite 

    Please login or register to see this code.

    or alternatively

    Please login or register to see this code.

    or alternatively

    Please login or register to see this code.

     

    The second error doesn't make sense and I can't repeat it. You have some invisible unicode characters in that string?

     

    The use case to do something once a day when something happens is quite common and there are different ways to solve it. Using a global variable to remember if it's done like you do is on approach.

    One could also use something like

    Please login or register to see this code.

    Here we use a time period 6-9 and wrap it in a once(). This means that one time during the time period when the sensor is breached it will play the message.

    The problem we have with once is that if there is no more sensor breach until 6-9 the next day, it will not play as the once is waiting for the condition to be false before triggering again (that's why once is tricky to use...)

    We solve it by sending an event at midnight that "bypasses" the sensor and test the time interval, which will be false at 00:00 so it's enabled to return true again the next morning. 

     

    In fact, @Sjakie and I spent some time on this some time ago and we come up with two solutions. There is an optional extra argument to once that is a time when the state should be cleared.

    Please login or register to see this code.

    so this also works.

    There was also the "invention" of the time interval that is only true once a day, using 3 dots '...'

    Please login or register to see this code.

    It's kind of a forgotten command but I checked and it's still there.

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