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

OK, thanks

Posted

@jgab 

i have trouble with this 2 lines, will never be active on live scene. Works very well in ZBS and i cannot find where the problem is.

 

Please login or register to see this code.

 

  • Topic Author
  • Posted
    17 minutes ago, jompa68 said:

    @jgab 

    i have trouble with this 2 lines, will never be active on live scene. Works very well in ZBS and i cannot find where the problem is.

     

    Please login or register to see this code.

     

    You have the pirsensors and dwsensors declared in the scene headers?

    Also, something need to trigger the rule to start the ‘for’ monitoring. Like a sensor being breached or safe or time being 22:30 or 05:30:01. 

    The second rule doesn’t work either? (to exclude any issue with ‘repeat’)

     

    Posted (edited)
    18 minutes ago, jgab said:

    You have the pirsensors and dwsensors declared in the scene headers?

    Also, something need to trigger the rule to start the ‘for’ monitoring. Like a sensor being breached or safe or time being 22:30 or 05:30:01. 

    The second rule doesn’t work either? (to exclude any issue with ‘repeat’)

     

    If i understand right the first rule should arm ring if pir and door/window sensor was safe for 20 min and time is between 22:00 and 05:00. But that never happens in live scene, nothing is written in debug window (only in ZBS)
    Yes have sensors declared in headers

    Please login or register to see this code.

     

    Edited by jompa68
  • Topic Author
  • Posted
    9 minutes ago, jompa68 said:

    If i understand right the first rule should arm ring if pir and door/window sensor was safe for 20 min and time is between 22:00 and 05:00. But that never happens in live scene, nothing is written in debug window (only in ZBS)
    Yes have sensors declared in headers

    Please login or register to see this code.

     

    On the HC2, if you wrap the first rule like this, what output do you get?

    Please login or register to see this code.

     

    Posted

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    3 minutes ago, jompa68 said:

     

    Ok, that's strange. I will try to reproduce it when I'm back this evening.

     

     

    17 minutes ago, jgab said:

    Ok, that's strange. I will try to reproduce it when I'm back this evening.

     

     

    Ah!, one of dwSensors or pirSensors is empty?

    Please login or register to see this code.

    {}:safe should return true. Is that it? Will fix this evening.

    28 minutes ago, jgab said:

    Ok, that's strange. I will try to reproduce it when I'm back this evening.

     

     

    Ah!, one of dwSensors or pirSensors is empty?

    Please login or register to see this code.

    {}:safe should return true. Is that it? Will fix this evening.

    Hm, doesn't explain why it works on ZBS - or you have different tables?

    Posted (edited)
    3 hours ago, jgab said:

    Hm, doesn't explain why it works on ZBS - or you have different tables?

    i define pir and dwsensors in scene. Could be it, i will recheck that.

     

    Please login or register to see this code.

    Ah! think i found the problem. Look at the time since last update....

    Please login or register to see this image.

    /monthly_2018_12/image.png.003ed76d922e385e1837b052b98184f4.png" alt="image.png.003ed76d922e385e1837b052b98184f4.png" />

    Edited by jompa68
  • Topic Author
  • Posted

    Ok, that’s probably it. Anyway, you helped me finding a bug with {}:safe ...

  • Topic Author
  • Posted

    New version, v1.6, of EventRunner. Update EventRunner.lua, EventRunnerDebug.lua, example_rules.lua

    Lot's of changes but mostly internal stuff . Most changes are in EventRunnerDebug, so there shouldn't be much affecting (live) HC2 versions.

     

    -Complete rewrite of setTimeout on ZBS (doesn't affect HC2). The framework depends on setTimeout for scheduling rules and posting events, and Lua/ZBS doesn't have a setTimeout. I used to have home cooked version that worked, but now it is implemented with Lua's coroutines which makes it much more robust and cleaner and allows for mixing setTimeout with fibaro:sleep etc. I hope this will allow me to add more features like stepping through time etc (It is also a preparation for reusing EventRunnerDebug.lua  to implement a framework that can run standard HC2 scenes (and VDs), and several in parallell... a nice Xmas project). I have tested it quite extensively but there can still be bugs - it's like replacing the heart of the code, and I may have overlooked something...

     

    -Incompatible changes; _setClock, and _setMaxTime is replaced by _System.setTime(string starttime, int number). Ex. _System.setTime("08:00", 24*30), start simulation at 08:00 and run for 30 days.

     

    -EventRunner.lua. Fixed parsing of scene headers when running without debug in ZBS. Fix {}:safe to return true.

     

    -Log output in ZBS uses colors like on the HC2.

    • Thanks 1
    Posted (edited)

    it looks there is problem with folowing rules where is -xx:xx :

      rule("@@-01:00 => log('Start Run scene ClearDebugMsg'); scene.ClearDebugMsg:start; log('End Run scene ClearDebugMsg')")
      rule("@@-00:02 => log('Start Update VD - Multizasuvky'); MultiZasuvky:btn=19; log('End Update VD - Multizasuvky')")
    ---

    rules run every a few seconds ...

    Edited by petrkl12
  • Topic Author
  • Posted
    56 minutes ago, petrkl12 said:

    it looks there is problem with folowing rules where is -xx:xx :

      rule("@@-01:00 => log('Start Run scene ClearDebugMsg'); scene.ClearDebugMsg:start; log('End Run scene ClearDebugMsg')")
      rule("@@-00:02 => log('Start Update VD - Multizasuvky'); MultiZasuvky:btn=19; log('End Update VD - Multizasuvky')")
    ---

    rules run every a few seconds ...

    Sorry, disappeared when I rewrote the last time (I had forgotten about that hack, maybe need to start document this...). I have pushed a new version that fixes it.

     

    Posted

    Now everything is OK! Thanks a lot.

    Posted

    @jgab i still have problems with my alarm setup. It does now work in HC2 but same setup do work in ZBS.

     

    HC2

    Please login or register to see this code.

    It should have arm the house when "lock" on keypad but it did not. It should also arm arm when "presence" state is "allaway" 

     

     

    ZBS debug

     

    Please login or register to see this code.

    Please login or register to see this code.

    any idea what could be wrong?

  • Topic Author
  • Posted

    Can you pm me the scene rules?

  • Topic Author
  • Posted
    1 hour ago, jompa68 said:

    @jgab i still have problems with my alarm setup. It does now work in HC2 but same setup do work in ZBS.

    It should have arm the house when "lock" on keypad but it did not. It should also arm arm when "presence" state is "allaway" 

    any idea what could be wrong?

     

    Try to add log on #arm rule and see what you get  - something seems to stop the transition from happen.

    Please login or register to see this code.

     

    1 hour ago, jompa68 said:

    ZBS debug

     

    Please login or register to see this code.

    Please login or register to see this code.

     

    The color output in ZBS debug window is really ugly when cut and paste into other places... I will make color output an optional flag in the next release.

    Posted
    3 hours ago, jgab said:

    Try to add log on #arm rule and see what you get  - something seems to stop the transition from happen.

    Added it now and will monitor it tonight and tomorrow and let you know the result.

    Posted
    On 12/14/2018 at 1:23 PM, jgab said:

    Possible to group rules & event handlers in sections

    This does not work in ZBS, at least not the code example

     

    Please login or register to see this code.

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    9 hours ago, jompa68 said:

    This does not work in ZBS, at least not the code example

     

    Please login or register to see this code.

    Please login or register to see this code.

     

    I seem to have invented this new function "Event.rule" that doesn't exists. It should have been 'Rule.eval'. I have changed the example in the previous post.

    So, the way it is implemented is that 'Rule.eval' and 'Event.event' definitions add their event handlers to the current 'SECTION' table, and the enable/disable command then do enable/disable on every handler belonging to the section specified. (In fact, a typical EventScript rule defined with Rule.eval 'compiles' to one or several 'Event.event' definitions, so I'm in reality only collecting Event.event definitions)

     

    Posted
    2 minutes ago, jgab said:

    I seem to have invented this new function "Event.rule" that doesn't exists. It should have been 'Rule.eval'. I have changed the example in the previous post.

    So, the way it is implemented is that 'Rule.eval' and 'Event.event' definitions add their event handlers to the current 'SECTION' table, and the enable/disable command then do enable/disable on every handler belonging to the section specified. (In fact, a typical EventScript rule defined with Rule.eval 'compiles' to one or several 'Event.event' definitions, so I'm in reality only collecting Event.event definitions)

    Ah, i see :D

    Time to sort up rules, thanks Jan.

     

    Merry Christmas!

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