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)

Please login or register to see this attachment.


EventRunner is a powerful rule-based automation framework for Fibaro Home Center 3 (HC3) home automation systems. It provides an intuitive domain-specific language for creating complex automation rules with advanced event handling, scheduling, and device control capabilities.
Disclaimer: It's still under development so there may be bugs 🪲

 

Please login or register to see this attachment.


 

Please login or register to see this attachment.

Documentation

  • Please login or register to see this link.

  • Please login or register to see this link.

     
  • Please login or register to see this link.

  • Please login or register to see this link.

     
  • Please login or register to see this link.


Preferred way to install is using

Please login or register to see this link.

Manually installation using links below also works.
 

Links

  • Please login or register to see this link.

    (EventRunner7.fqa)
  • Please login or register to see this link.

     ER6 (EventRunner6.fqa)
  • Please login or register to see this link.

  • Please login or register to see this link.

  • Please login or register to see this link.

     
  • Please login or register to see this link.

    - with rules or custom functions (Extra QA files)
  • Please login or register to see this link.

    ( Ex. deviceID:myProperty = 42)
  • Please login or register to see this link.

    ( MyObject:value = 42)
  • Please login or register to see this link.

  • Please login or register to see this link.

Edited by jgab
  • Like 6
  • Topic Author
  • Posted (edited)

    EventRunner 6 was the follow up to EventRunner 5. The latter will not be developed further. However, if you run EventRunner 5 today and it works for you, please continue. 
    EventRunner 6 had some (breaking) changes from EventRunner 5, and some missing features, so upgrading required some work.
    The advantage with EventRunner 6 was that its new architecture made it's faster and smaller and easier for me to maintain, so this will be the new architecture for EventRunner...

    EventRunner 7 is a rewrite of the ER6 engine, trying to keep backward compatibility with ER6.
    ER7 should be better at error messages and usability. If not let me know and I fix it. In ER7 it's much easier to fix such things compared to ER6.

    This means that EventRunner 6 is not further developed and EventRunner 7 now takes the lead.
    I decided to make a separate ER7 because there are some aspects that may break backward compatibility and there may be more in the future.

    I'm running ER7 myself for the rules I have (I don't have that much to automate these days...).

    All links to official downloads and documentation in first post.

    Rest of this thread is open for questions, how-to-do-stuffs, and bugs.
    Also, EventRunner 7 is missing some features from EventRunner 5, but we can discuss how to add it yourself, or if it's a great feature, I can add it to the official ER7 dist.
    There is also an

    Please login or register to see this link.

     that can used to upgrade/downgrade/install EventRunner 6/7.

     

    Edited by jgab
  • Topic Author
  • Posted (edited)

    Changes from EventRunner 5

    Lot's of functions are missing, see 

    how to add your own functions. Also ask in this thread if you need help implementing something that is missing.

     

    Missing er.* functions

    • er.defTriggerVar don't exist. Define trigger variables on er.triggerVariables.*

    Please login or register to see this code.

    • er.defvar(tab) don't exist. Define variables on er.variables

    Please login or register to see this code.

    • If you need the MODULE system, you can implement it yourself. See <

      Please login or register to see this link.

      >

     

    Breaking syntax

    The "case" statement was problematic in ER5, The || <expr> >> <statements ...
    The reason was that it was difficult to parse. In EventRunner 6 it's still there but looks like
     

    Please login or register to see this code.

    Ex,
     

    Please login or register to see this code.

     

    Edited by jgab
  • Topic Author
  • Posted (edited)

    📦 EventRunner7 — The Module System

    EventRunner7 includes a simple module system that lets you split your rules into separate files without modifying the main QuickApp file. This is useful for organising rules by topic, sharing reusable rule sets, or adding support libraries.

    How it works

    A module is a .lua file that registers itself in the global MODULE table. When EventRunner7 boots, it loads all registered modules in priority order and passes the er object to each one — the same object your main(er) callback receives.

    The basic structure of a module file:

    Please login or register to see this code.

    The module table entry has three fields:

    • name — a label for log output. If the name starts with _, no "Loaded module …" message is printed.
    • prio — controls load order (see below).
    • code — a function that receives er and is called during boot.

    Load order and priority

    Modules with a negative priority load before your main(er) callback. Modules with a positive priority load after it. Within each group they are sorted smallest-first.

    Please login or register to see this code.

    The typical use of a negative-priority module is to set up variables, register custom properties, or subscribe to events that your rules depend on. Positive-priority modules are useful for post-boot actions, like sending a startup notification once all rules are loaded.

    ⚠️ Important: file naming convention

    If you use the EventRunner7 auto-update feature (which synchronises the QuickApp files from GitHub), any extra files you have added will be deleted unless their filename starts with the letter x.

    Always name your module files starting with x, for example:

    • xMyRules.lua
    • xLighting.lua
    • xSetup.lua

    A more complete example

    Here is a self-contained module that defines a trigger variable, sets up a few rules, and uses a negative priority so the trigger variable is registered before main(er) runs:

    Please login or register to see this code.

    Summary

    • Modules keep your rules organised across multiple files.
    • Each module registers a code(er) function in MODULE.
    • Use negative prio to run before main(er), positive to run after.
    • Always start module filenames with x to survive auto-updates.
    Edited by jgab
  • Topic Author
  • Posted

    Installation tips

    <TBD>

    Posted

    Jan, congratiolations with your brand new Eventrunner.

    Just started to implement Hue Connector that's why is see your announcement.

    tw, where is the .fqa >> I am curious to start  a QU in ER6 as test

  • Topic Author
  • Posted
    4 minutes ago, Sjakie said:

    Jan, congratiolations with your brand new Eventrunner.

    Just started to implement Hue Connector that's why is see your announcement.

    tw, where is the .fqa >> I am curious to start  a QU in ER6 as test

    Yes, in 

    Please login or register to see this link.

    Posted

    Jan, QA crashed on

    Util.defTriggerVar
  • Topic Author
  • Posted

    Yep, it's not  there. (Will add to breaking changes)

    Please login or register to see this code.

     

    Posted

    Jan,

    Please login or register to see this code.

    Error:

    [01.09.2025] [12:11:01] [ERROR] [QUICKAPP503]: main.lua:86: attempt to index a nil value (global 'Util')

     

    rule86:

    Util.defTriggerVar("ring_alarm_state",false)
  • Topic Author
  • Posted
    24 minutes ago, Sjakie said:

    Jan,

    Please login or register to see this code.

    Error:

    [01.09.2025] [12:11:01] [ERROR] [QUICKAPP503]: main.lua:86: attempt to index a nil value (global 'Util')

     

    rule86:

    Util.defTriggerVar("ring_alarm_state",false)

    Yes, there is no Util.defTriggerVar - you define them on triggerVar.* - like x1 in the example.
    If you want the old function you define it yourself.

    Please login or register to see this code.


    ...or something

    Posted (edited)

    Jan,

    For me, the concept of ER6 is very tempting, but it would be a serious transfer. Some of my installations are quite complex, and in those cases I see a huge benefit in ER6—mainly because of its higher speed and smaller size. That’s why I’ll probably go for it.

    However, before making the move, I need to wait for a stable version. (Of course, on my own system I’m happy to help with bug hunting.) Most importantly, I need to know what functionalities are missing—what’s not in ER6 that is currently available in ER5.

    I would really need a list to get an overview of how much work the transfer would require.

    • Which functions should I avoid?

    • Which ones should I rewrite for ER6?

    • And, very importantly: is the MODUL structure from ER5 present in ER6?

    Edited by Neo Andersson
  • Topic Author
  • Posted (edited)

    1. Well, the ones documented in the EventScript reference are there - or should be there.
    2. That depends on what you use :-) There may be a reason to do a ER5 compatible extension file. Some exotic resource support and NodeRed, and sync http, Dim function, ...
    3. What you mean with MODEL? The 'definePropClass' for custom objects? Yes, it's there. The definition of your own async functions is there.

    1 minute ago, Sjakie said:

    Jan,

    trueFor(00:00:05, appPhone.beveiligen_Appartement:isOff) =>

    ??

    Edited by jgab
    Posted

    Rule 10: Expected table, got: nil 'trueFor(00:00:05, appPhone.beveiligen_Appartement:isOff)

  • Topic Author
  • Posted
    1 minute ago, Sjakie said:

    Rule 10: Expected table, got: nil 'trueFor(00:00:05, appPhone.beveiligen_Appartement:isOff)

    appPhone is not declared as a table (containing 'beveiligen_Appartement'). Have you added your home table to er.variables the way described in 

    ?

    16 minutes ago, Neo Andersson said:

    And, very importantly: is the MODUL structure from ER5 present in ER6?

    You mean loading quickapp files with your own functions? No, but it's easy to roll your own (compatible with ER5) - see 

     

     

    Posted (edited)
    9 minutes ago, jgab said:

    1. Well, the once documented in the EventScript reference are there - or should be there.
    2. That depends on what you use :-) There may be a reason to do a ER5 compatible extension file. Some exotic resource support and NodeRed, and sync http, Dim function, ...
    3. What you mean with MODEL? The 'definePropClass' for custom objects? Yes, it's there. The definition of your own async functions are there.

    I meant the prioritized modul structure

    Please login or register to see this code.

    Alaso noticed in your basic examples that HT table elements are no longer accessible as in ER5.

    Its jut for the sake of examples ? Or HT elements need to be accessed using HT.elementname syntax

     

    Okay, this is gonna be very hard for you to manage answering all the stuff we ask here. Probably the better way will be just to start using it in my own house, and then try every of my rules from ER5 tansfer one by one to ER6 and see where are the problems. Make a list and the post it here so you can answer a whole list point by point, and it will be easier to read for others too.

    Edited by Neo Andersson
  • Topic Author
  • Posted

    You just add them with a loop to er.variables

    Please login or register to see this code.

     

    Posted

    Jan,

    HomeTable I have in  a QA id 290 Named HomeTable

    I can't get it in ER 6

    Please login or register to see this code.

    what to fill in .....

  • Topic Author
  • Posted (edited)

    Here is a ER5 compatible module system - put it in a QA file. It defines a global lua function loadModules.
    From main do

    Please login or register to see this code.

     

    Please login or register to see this code.

     

    Edited by jgab
    • Like 1
  • Topic Author
  • Posted

     

    10 minutes ago, Sjakie said:

    Jan,

    HomeTable I have in  a QA id 290 Named HomeTable

    I can't get it in ER 6

    Please login or register to see this code.

    what to fill in .....

     

    Please login or register to see this code.

    Assuming you have a lua table named HomeTable? Or are you saying that you have a table in another QA, ID 290, and you want to import it to ER6?
    Have you stored it in some GV or QV ?
    If you stored in in a GV you can do
     

    Please login or register to see this code.

     

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