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

  • Topic Author
  • 12 hours ago, jgab said:

    The second issue, the feature of having a list of deviceIDs in an event "disappeared' in the new version. I will fix it tonight.

    Ok, fixed that.

    rule("#property{deviceID={4,5,6}} => ...") works now. Pushed a new version but didn't bump the version number.

    Still can't reproduce the error with rule("Switches:central => d=env.event.deviceID; log('Test switch id=%s',d)")

    /J

     

    Link to comment
    Share on other sites

    Thanks. Fix is working.

     

    for switch issue - still doesn't work (in my previous example there was only 3 values but  issue appear if there is more than 3 values). Example bellow definitly doesn't  work :)

    Please login or register to see this code.

    Problem is in function esort :

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, petrkl12 said:

     

    Please login or register to see this code.

    Thanks!, nothing better than starting the day with fixing a bug :-)

    Yes, the problem was that incoming events are tagged with timestamps that I sort on, correction, that I though I sorted on. Pushed a fix.

    Why sort?, <table>:central returns an array of all the data parts of the event ids in the <table>. All <table>:prop return a table with the prop values. However, for :central and :access, the result array is sorted with the last event first. That means that it is possible to write something like this, because the last event was the event that triggered the rule.

    Please login or register to see this code.

     

     

    Edited by jgab
    Link to comment
    Share on other sites

    can i combine an variable and a lux value together?

    like If var == xxxx and lux > 100 then xxxx ?

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 8 minutes ago, jompa68 said:

    can i combine an variable and a lux value together?

    like If var == xxxx and lux > 100 then xxxx ?

     

    Please login or register to see this code.

     

    Yes, the rule should triggered when UHASDarkness changes value or deviceID 800's value changes - and the left hand is computed and if true the right hand side is run.

    You need to declare

    --[[

    %% properties

    800 value

    %% globals

    UHASDarkness

    --]]

    Edited by jgab
    Link to comment
    Share on other sites

    @jgab can you tell what is wrong with your example code of alarmmode?

     

    Please login or register to see this code.

    Compilation error on line 65:
    C:\zerobranestudio\myprograms\EventRunner.lua:65: '=' expected near 'Rule'  

    line 65 is this:

    Please login or register to see this code.

    UPDATE! 

    Never mind, must been some copy&paste error, did redo it and now it works.

    Edited by jompa68
    Link to comment
    Share on other sites

    if i want to have a delay for 30 sec before it runs the #dwBreached, how to achieve that?

    Scenario: when arriving to home the alarm will go off direct when i open the door so i have no "window" time to disarm it. 

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 58 minutes ago, jompa68 said:

    if i want to have a delay for 30 sec before it runs the #dwBreached, how to achieve that?

    Scenario: when arriving to home the alarm will go off direct when i open the door so i have no "window" time to disarm it. 

     

    Please login or register to see this code.

     

    Please login or register to see this code.

    I think this should work. When it wakes up from the wait, and the state has changed it won't run the transition. 'wait' always return true.

    ...or even

    Please login or register to see this code.

    and you could sound a warning (Sonos?) instead of the log.

    Edited by jgab
    Link to comment
    Share on other sites

    5 minutes ago, jgab said:

    I think this should work. When it wakes up from the wait, and the state has changed it won't run the transition.

    Yes, that did do it. Thanks :D

    Link to comment
    Share on other sites

    23 hours ago, jgab said:

    Please login or register to see this code.

    I think this should work. When it wakes up from the wait, and the state has changed it won't run the transition. 'wait' always return true.

    ...or even

    Please login or register to see this code.

    and you could sound a warning (Sonos?) instead of the log.

    Notice one thing, when i arm by keypad and opens the door when leaving the house it will trigger #dwBreached after 30sec and trigger the alarm

    Link to comment
    Share on other sites

  • Topic Author
  • 50 minutes ago, jompa68 said:

    Notice one thing, when i arm by keypad and opens the door when leaving the house it will trigger #dwBreached after 30sec and trigger the alarm

    Yes, that doesn't work. I'm starting to suspect that it may be a need for some more states...

    However, a fix may be like below, i.e to re-check after the sleep if the sensors are still breached. Maybe you have to extend the sleep period depending on how long the sensors stay breached.

    Please login or register to see this code.

     

    Thinking about it, maybe it is easier to delay the arm event from the keypad so you have time to get out? A delay in the post?

    Link to comment
    Share on other sites

    13 minutes ago, jgab said:

    Thinking about it, maybe it is easier to delay the arm event from the keypad so you have time to get out? A delay in the post?

    Yes could also be possible, but above fix did also work. (atleast in ZBS) :)

    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, jompa68 said:

    Yes could also be possible, but above fix did also work. (atleast in ZBS) :)

     

    I think from a theoretical stand-point (state-machines that is), if you find yourself adding a lot of extra conditions to state a transition, it is probably hiding a state-machine involving more states and transitions. The risk is that one miss some transitions. 

    Having said that, it's also an art to keep state-machines reasonable small - they have a tendency to grow fast (states x transitions), and carefully placed extra conditions can help in "collapsing" the code into fever states and transitions. 

    However, in this case, I think it's cleaner to delay the posting of the arm event. Better to put conditions on what and when fires events that changes the states. I guess one could also wait posting the arm until the door is opened and closed.

    Please login or register to see this code.

    About the cat... can the delay, 'wait(00:00:30)' allow a burgler to sneak in, instead of the cat getting out?

    Link to comment
    Share on other sites

    2 hours ago, jgab said:

    About the cat... can the delay, 'wait(00:00:30)' allow a burgler to sneak in, instead of the cat getting out?

    True, i thinking to use iOSlocator and set variable and use that together with alarmmodule

     

    Please login or register to see this code.

    So if  door opens and nobody at home it will trigger alarm direct.
    When my cat wants to go out or come in during the night, my pirSensors will react and disable alarm for 10min

    Link to comment
    Share on other sites

  • Topic Author
  • 3 minutes ago, jompa68 said:

    This is not working

    Please login or register to see this code.

     

    It should be or ’|’ instead of and ’&’. Two events can’t be true at the same time

    Edited by jgab
    Link to comment
    Share on other sites

    i don't see that this line is working for me, what could be wrong?

    Please login or register to see this code.

     

    and how can i do test with users that leave and arrive at home?

    Link to comment
    Share on other sites

  • Topic Author
  • 9 hours ago, jompa68 said:

    i don't see that this line is working for me, what could be wrong?

    Please login or register to see this code.

     

    and how can i do test with users that leave and arrive at home?

    I need some context - what is posting the presence event and in what way isn’t it working?

    Link to comment
    Share on other sites

    This is my lines in EventRunner

    Please login or register to see this code.

    So when all iOS devices get a new location away from 'Home' should not #presence{state='allaway'} be true?

    On 11/3/2018 at 11:54 AM, petrkl12 said:

    Rule.eval("@20:00 & wday('sat,sun') & $BankHoliday>0 & $HolidayTime>0 => 125:on")

    @petrkl12 how have you implement the bankholiday function? in ER or outside?

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