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)

@jgab, Normaly if open ER5 QA it will show main.

After changing in erlib some QA's by edit opens with a blanc page and I need to click on main to modify a rule.

how to correct?

All ER5 QA's open and clicked on main changed >> saved >>no fix.

Question: can I use fa wall plug = not reachable or disconnect in a rule? if yes how?

Thanks

Edited by Sjakie
Posted

Dear all. 

I am using a similar rule "enable / disable"  elsewhere, and there it works as expected. However I try to trigger the rule enable / disable based on a GlobalVariable, but the few lines below do not work, and I do not spot my mistake. 

Any thoughts?

 

Please login or register to see this code.

 

The error I get: 

Please login or register to see this code.

Thanks for any insights... 

Jeroen 

  • Topic Author
  • Posted

    There is a bug where chaining of .enable() at the end of the rule definition don't return the rule,

    so 'Kitchen_rule' becomes nil, and it crashes later.

    It will work if you split it up and do a separate .enable().

    Please login or register to see this code.

     

    • Thanks 1
    • 2 weeks later...
    Posted

    Dear all, 

     

    Another question, trying to randomize my lights, it sort of works, but it doesn't in the sense that every day timer random_time_1 is scheduled for exactly the same random time. Do I have to (re)init something somewhere? 

    Thanks again for any thoughts!  Jeroen

     

    Example of what I tried: 

    Please login or register to see this code.

     

    Posted

    @jgab if I install a new ER5 QA how to get rid of the every 5 min ping?

    This does't work

    --[[var.i = 0 -- initialize ER variable
    rule("@@00:00:05 => i=i+1; log('ping: %s seconds',i*5)",{ruleTrue=false}) -- test rule, ping every 5 seconds
    ]]
  • Topic Author
  • Posted
    1 hour ago, Sjakie_ said:

    @jgab if I install a new ER5 QA how to get rid of the every 5 min ping?

    This does't work

    --[[var.i = 0 -- initialize ER variable
    rule("@@00:00:05 => i=i+1; log('ping: %s seconds',i*5)",{ruleTrue=false}) -- test rule, ping every 5 seconds
    ]]

    yes

  • Topic Author
  • Posted
    13 hours ago, JeroenL said:

    Dear all, 

     

    Another question, trying to randomize my lights, it sort of works, but it doesn't in the sense that every day timer random_time_1 is scheduled for exactly the same random time. Do I have to (re)init something somewhere? 

    Thanks again for any thoughts!  Jeroen

     

    Example of what I tried: 

    Please login or register to see this code.

     

    You shouldn't need to call _setupDailys here....

    The problem is that when the QA starts/restarts the number generator is initialized with the same starting values. 

    If you would let it run, without restarting the QA, for several days you would see different values.

    However, you can initialize the random generator with a "random" seed when the QA is started

    Please login or register to see this code.

     

    • Thanks 1
  • Topic Author
  • Posted
    On 1/29/2025 at 7:23 PM, JeroenL said:

    Dear all, 

     

    Another question, trying to randomize my lights, it sort of works, but it doesn't in the sense that every day timer random_time_1 is scheduled for exactly the same random time. Do I have to (re)init something somewhere? 

    Thanks again for any thoughts!  Gerona

     

    So, the rnd function takes either 1 argument or 2 arguments. With 2 arguments it returns a random value between the arguments/values.

    So, if you want a random time around 22:45, ex +/- 15 minutes you can write

    Please login or register to see this code.

    The @ rules will be scheduled every midnight (00:00) for the day to come. In this case it will compute 

    Please login or register to see this code.

    and schedule a timer for that time. Next midnight it will compute a new time.

    • Like 3
    • 1 month later...
    Posted (edited)

    @jgab, goodmorning,

    Jan I am still a happy camper with ER it's doing what is should do!

    What's the difference between doing a restart HC3 by the menu at the top and 

    Please login or register to see this code.

    Since the last fw I notice a big difference

    Restart by menu brings used memory back to 44%-45%

    Restart by hc3api...... lowers memory with around 4%-5%

     

    Never has seen this before, okay it is the fw but what can you change in the hc3ap?

    Thanks in advance!

    Edited by Sjakie
    typo
    • 1 month later...
    Posted

    @jgab I notice a strange thing in debug.

    @06:33:49 No occupation in kitchen

    @ 07:01:14 >> occupation in kitchen (radar detect)

    @ 07:01:16 >> kitchen door open

     

    Remark to have occupation in the kitchen I should first open the kitchen door to get in and make the radar to detects me.

     

     

    Please login or register to see this attachment.

  • Topic Author
  • Posted

    It's a 2 second difference. ER looks at the system events in the order they arrive. Could it be that the door sensor was a bit slow to report in? 

    How does rule 91 and 93 look like?

    Posted

    rule 91:

    Please login or register to see this code.

    rule 93:

    Please login or register to see this code.

     

     

  • Topic Author
  • Posted

    In general, you have to be careful to write rules like this

    Please login or register to see this code.

     

    Because, A can happen (ex. sensor breached), then later B happens, but A is still true (still breached), so you will run || A >> ...

    even though it was B that triggered the event.

    Rules with a lot of "OR" tests in the guard is generally very tricky to get right, unless you don't care what OR condition is true. But here you do as you do different logs depending on which OR condition is true...

     

    Posted

    I have just switched to Eventrunner5.
    1. Previously, when a certain rule was completed, I received app notifications using the msg command.
    However, since the app has been changed to Yubii Home, I no longer receive any notifications.
    Is there a way to make it work?

    2. I want to display a message like "Status" under the icon.
    In ER4, I used the command:
    rule("$PresentState=='Home' => QA:setIconMessage('Status:Home')")
    However, this no longer works in ER5.
    Is there a way to achieve the same functionality?

    • 1 month later...
    Posted

    @jgab I have a new seperate installation  with 2 ER QA's and both have this error;

    Please login or register to see this code.

     

    • 2 weeks later...
    Posted (edited)

    Hi Jan,

    Quick question, I may have overlooked this topic, but I do not find the possibility to create rules based on "custom events"...
    Like the below example.
    Basically I would like to do some action when the Custome event "DBBell" is triggered.
     

    With trial and error, it seems I've found the syntax:
     

    Please login or register to see this code.

     

    Thanks.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Edited by ClaudeH
  • Topic Author
  • Posted

    You should be able to trigger on it like a sourceTrigger event

    Please login or register to see this code.


    Just make sure that the customEvent DBBell is defined.

    • 2 weeks later...
    Posted

    Can't figure out what's wrong with a trueFor rule (excuse the liberal debug logging):

     

    rule([[
            @{sunset+01:00, 23:00, 00:00, 01:00, 02:00, 03:00}
            =>
            log("*** Shutters_Sunset_Terrace_Close ***");
            log("   Last: %s ***", HM(Terrace.Door:last));
           
            if Terrace.Shutter:isOpen then
                log("       Shutter Open");
                if trueFor(03:00, Terrace.Door:safe) then
                    log("       Closing Shutter (3h)");
                    log("       Last: %s ***", HM(Terrace.Door:last));
                   
                    764:msg={title='Fibaro', message='Terrace closing in 5 mins (3h)'};
                    wait(00:05);
                    Terrace.Shutter:close
                else
                    log("       Conditions Not Met")
                end
            else
                log("       Shutter Closed")
            end
        ]]
        , {ruleTrue=true, ruleFalse=true}
        ).name("Shutters_Sunset_Terrace_Close")

     

    It is closing the shutter when door has been "safe" for less than 3h:

     

    [2025-08-09] [21:30:00] [DEBUG] [QA_ER5_693]: *** Shutters_Sunset_Terrace_Close ***
    [2025-08-09] [21:30:00] [DEBUG] [QA_ER5_693]: Last: 02:19 ***
    [2025-08-09] [21:30:00] [DEBUG] [QA_ER5_693]: Shutter Open
    [2025-08-09] [21:30:00] [DEBUG] [QA_ER5_693]: Closing Shutter (3h)
    [2025-08-09] [21:30:00] [DEBUG] [QA_ER5_693]: Last: 02:19 ***
    [2025-08-09] [21:30:00] [TRACE] [QA_ER5_693]: [Rule:Shutters_Sunset_Terrace_Close:9]>> suspended action - wait 00:05:00

  • Topic Author
  • Posted

    trueFor needs to be on the left side of the =>, it's a condition test.

    I would split it up like this:

    Please login or register to see this code.

    However, at sunset+01:00, 23:00, 00:00, 01:00, 02:00, 03:00, it starts a watch that if the shutter is open and the door is safe for 3 hour it will close the shutter.

    If we run it at 01:00 and shutter is open and door is safe it will continue to "watch" until 04:00 when the condition will be true and it will close the shutter...
    So why run it 02:00, 03:00 etc?

    Maybe you want to not check for certain periods during the day? Then make a test that you are in the right time period?

    Please login or register to see this code.

     

    Is it what you want to do?

    • Like 1
    Posted

    Thanks @jgab. I hadn't understood that conditions can't be tested outside the conditions block, nor the way time triggers work. I'd worked around it by testing Terrace.Door:last instead.

     

    Purpose it to close the shutter if I've forgotten, but not if I'm potentially sat outside without my phone to repopen it 🫣

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