Menu

time-counter and delayed activities

JensH
2009-06-22
2012-12-14
  • JensH

    JensH - 2009-06-22

    Jean Francois, all
    I want to start an activity after a certain time-frame after some last messages from multiple devices has been received.
    In detail: I have 3 motion-detectors and I want to ensure, that after 8 hours after the last motion was detected, an "out-of-home" status is raised.

    I thought I can do that with a delayed action. But it seems, that all delayed actions are queued and not "replaced" by a newer action.
    Therefore, if I delay the actions as shown below, I just get them (all) 8 hours later, but not only the most recent one.

    Can you help me, how I could realize my scenario?

    Thanks, best Regards, Jens

    <!--********************************************************************************************************* 
        check attendance
            timer resetet when motion is detected by one the motion detectors
    ********************************************************************************************************* -->
        <rule id="Away_Timer_restart">
            <condition type="or">
                <condition type="object" id="A_Floor_Motion" value="on" trigger="true" />
                <condition type="object" id="B_Floor_Motion" value="on" trigger="true" />
                <condition type="object" id="C_Floor_Motion" value="on" trigger="true" />
            </condition>                   
            <actionlist>
                <action type="set-value" id="Central_Away_Timer8h" value="off" />
                <!--reset Timer 8h-->
                <action delay="28800" type="set-value" id="Central_Away_Timer8h" value="on" />
            </actionlist>
        </rule>
        <!--*****************************************************************************************************-->
        <rule id="Away_trigger8h">
            <condition type="object" id="Central_Away_Timer8h" value="on" trigger="true" />
            </condition>                   
            <actionlist>
    <!--        ToDos here        -->
            </actionlist>
        </rule>
        <!--*****************************************************************************************************-->

     
    • JensH

      JensH - 2009-06-23

      Jeff,
      digging a little bit in the sources I found the "time-counter" condition. (I found it before - but I didn't knew what it does...)

      I ahven't found a description for that type of conditions - is it correct, that the "threshold" is the time in seconds, for which the subsequent condition has to be true until the actionlist is executed - and the "reset-delay" is the timeframe, after the "on-false"-actionlist is executed?

      I.e. Would the following solve my request?

      <!--********************************************************************************************************* 
      check attendance
      timer reset when motion is detected by one of the motion detectors
      ********************************************************************************************************* --> 
      <rule id="Away_Timer_restart">
      <condition type="time-counter" threshold="1" reset-delay="28800">
          <condition type="or">
              <condition type="object" id="A_Floor_Motion" value="on" trigger="true" />
              <condition type="object" id="B_Floor_Motion" value="on" trigger="true" />
              <condition type="object" id="C_Floor_Motion" value="on" trigger="true" />
          </condition> 
      </condition> 
      <actionlist>
          <action type="set-value" id="Central_Away_Timer8h" value="off" />
      </actionlist> 
      <actionlist type="on-false">
          <action type="set-value" id="Central_Away_Timer8h" value="on" />
      </actionlist> 
      </rule> 

      Thanks, best Regards, jens

       
    • jef2000

      jef2000 - 2009-06-24

      Hi,

      Yes, this time counter should work as you expect. I developed it to set a threshold between the noise detection status coming from a babyphone and the action to trigger.

      <condition type="time-counter" threshold="15" reset-delay="5m">
          <condition type="object" id="babyphone" value="on" trigger="true" />
      </condition>

      The condition is true if the babyphone detects noise during 15 seconds. If no noise is seen for 5 minutes, the counter is reset.

      I didn't document it because I thought it was too specific to serve another purpose, but you just shown me I was wrong.

      By the way, for reset-delay you can replace "28800" by "8h". It's equivalent but more readable.

      Regards,

      Jean-François

       
    • JensH

      JensH - 2009-06-25

      Great, Thanks!
      I was just afraid to get some RTFM feedback from someone :-)
      But I checked everything (even the release notes:) and haven't found anything.

      Regarding the "8h" good to know!
      I saw, that the "delays" are stored in integers.
      Sorry to ask: what is the "integer"-size nowadays? Is this still 65K? Because in this case this would mean a maximum delay of ~18h.
      Is this correct?
      Thanks again, Best Regards, Jens

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.