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

hi jgab 

 

Please login or register to see this attachment.

When I run ZB, I get an error

Link to comment
Share on other sites

  • Topic Author
  • Pull down the latest version of EventRunner4Engine.lua

    For a few minutes yesterday I managed to push a faulty version and you must have pulled it down at that moment...

    /J

    Link to comment
    Share on other sites

  • Topic Author
  • I looked at the repository and the 'missing then' bug was still there - to be sure I have pushed a new version of ER4 v.0.84 with the fix

    Link to comment
    Share on other sites

    Jan it does't update.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    56 minutes ago, jgab said:

    I looked at the repository and the 'missing then' bug was still there - to be sure I have pushed a new version of ER4 v.0.84 with the fix

    work

    thank you

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, Sjakie said:

    Jan it does't update.

    Please login or register to see this code.

     

    Sorry, misspelled tag. It should work now.

    Link to comment
    Share on other sites

    hehe I started to doubt on myself :)

    Yep all are updated now, thanks!

    Link to comment
    Share on other sites

    Please login or register to see this code.

    Jan is something like this possible?

    If having QA with 2  buttons can I trigger on button?

     
    Link to comment
    Share on other sites

    • 2 weeks later...
    On 7/14/2022 at 12:24 PM, jgab said:

    Yes, you need to put the loop that loads the rules after you define the HT table, otherwise it's not available when they are defined.

    Actually, maybe it's better to put the loop at the end of QuickApp:main() so your main rules load before the modules' rules.

    I really like this way to structure Eventrunner.

    Today i have only one EV4 instance with more that 100 rules

     

    Please login or register to see this attachment.

    • Like 1
    Link to comment
    Share on other sites

    • 2 weeks later...

    Hi @jgab

     

    I get after a while an Error in ZB, version 0.86.

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 14 minutes ago, RobLu said:

    Hi @jgab

     

    I get after a while an Error in ZB, version 0.86.

     

    Please login or register to see this code.

     

    That error comes from code used to update the running QA from the TQAE/ZB web interface.

    There are very special conditions when that should be used (you need to download the QA from the HC3 and push back updates - it's a bit of a wireline act...)

    - and I haven't looked at that code for a long time - it may be broken. So I don't recommend that "work flow".

     

    I would recommend enabling the proxy feature and upload real QA when it feels finished.

    Link to comment
    Share on other sites

    Hi @jgab

     

    I would like to create a log notification after every profile switch between "Home" and "Away".

    In the code below the log is only executed at the start of the Eventrunner. At a switch of the profile it is not executed anymore. Is there a possibility for this? The repeated log statement is executed after switching profiles, but I want only ones. 


     

    Please login or register to see this code.

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • The problem is that you want to run something (e.g. log) when an section becomes active. But the enablement of a section just makes rules active - it doesn't trigger them. For that it needs some event or device changing state.

    If you just want to log when the profile changes make a rule that trigger on profile event - like your last rules.

    Please login or register to see this code.

     

    If you want to run specific stuff in each section when they are active, post an event they can trigger on. 

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Please login or register to see this code.

     

    Thanks a lot this is the best way to do it!

     

    Now it has also become much clearer to me how the Events/triggers work. I had already adapted my code with a .start() this also works. 

    Which method do you prefer Event or starting a rule with .start()?

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • .start() will run/trigger the rule when the rule is defined. Once.

    Please login or register to see this code.

    will trigger the rule when it's defined and if device 77 is on, the action will be carried out. Without .start() the rule will trigger first when device 77 changes state the first time.

    .start() does not always work. Ex.

    Please login or register to see this code.

    will not work because when the rule is run, there is no event #foo, so the left-hand side that checks if there is the event #foo will fail and the action will not run.

    By defining your own events, like #foo above, you can control when to trigger a rule by posting the event.

    In fact it's a programming model, and you can see the rules as "subroutines" that can be called by posting a triggering event. 

    And events can carry values, like #foo{x=8}

    Ex.

    Please login or register to see this code.

    Learning to structure your code with events is very powerful.

     

    Ex. if you have some stuff that needs to be done at night

    Please login or register to see this code.

    Here we have a routine that should be done at night (turning on lamps)

    It will be done 1 hour after sunset, or when we press button 1 on our keyfob if we want to make "Night" earlier.

    (we could add rules that make sure we don't execute it more than once each day)

     

     

    Edited by jgab
    Link to comment
    Share on other sites

    Thanks @jgab for the great explanation! I'm going to apply it in me code, this structure is also much clearer to read

    Link to comment
    Share on other sites

    Long time ago i created these rules, but i never got them working the way it was intended.

    My issue was that i needed a post(#bad), post(#rooms) and a post(#Common_groups) to trigger the rules. So i guess i need to build the rules based on time. So it triggers on 00:00, Sunrise, 22:30

    But with this way my structure will be on time - and not on my defined Zones

    Please login or register to see this code.

     

    Wondering if there is some obvious way to make these rules clean and structured based on Zones/rooms? 

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    @ChristianSogaard,

    I do it a tad different

    I hopen it will also work with the new HUE V2api????

    I have Time Off the Day (TOD)  in Global Variables. 

    Wake-up, morning, afternoon, early evening, late evening, bedtime, sleep

    If TOD changes all color settings will be changed (lights are still off but numbers can be changed)

    fa living room has as basic setting TOD

    Adapting brightness and colors if:

    -tv-on

    -tv-off

    -reading

    -after 22:30

    -after 23:30

     

    • Like 1
    Link to comment
    Share on other sites

    3 hours ago, Sjakie said:

    @ChristianSogaard,

    I do it a tad different

    I hopen it will also work with the new HUE V2api????

    I have Time Off the Day (TOD)  in Global Variables. 

    Wake-up, morning, afternoon, early evening, late evening, bedtime, sleep

    If TOD changes all color settings will be changed (lights are still off but numbers can be changed)

    fa living room has as basic setting TOD

    Adapting brightness and colors if:

    -tv-on

    -tv-off

    -reading

    -after 22:30

    -after 23:30

     

    Do you have any logic checking when sunset comes before "early evening"  ? Like in the fall/winter when the sun goes down earlier 

     

    Lets say you want to turn on a light at 21.00 but if sunset if before 21.00 you turn it on at sunset

    Edited by ChristianSogaard
    P
    Link to comment
    Share on other sites

    In my HA the light switch on with correction for month and clear sky or by manual closing off the curtains.

    Please login or register to see this code.

    I hope it will clear a bit  if not let me know

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