Menu

problem in time-counter with 0-threshold

Help
JensH
2010-11-27
2012-12-14
  • JensH

    JensH - 2010-11-27

    Hi Jean-Francois,
    I found an error in the time-counter condition.
    When I use a time-counter with a "0" threshold, then the "on-false" is never executed.
    i.e.:

    <objects>
    <object id="Test_Switch1" gad="10/5/15" type="1.001" flags="cwtus">Test_Switch1</object>
    <object id="Test_Switch2" gad="10/5/16" type="1.001" flags="cwtus">Test_Switch2</object>
    </objects>
    <rules>
            <rule id="LightTimer">
                    <condition type="time-counter" threshold="0" reset-delay="20" >
                            <condition type="object" id="Test_Switch1" value="on" trigger="true" />
                    </condition>
                    <actionlist>
                            <action type="set-value" id="Test_Switch2" value="on" />
                    </actionlist>
                    <actionlist type="on-false">
                            <action type="set-value" id="Test_Switch2" value="off" />
                    </actionlist>
            </rule>
    </rules>
    

    gives the following log:

    Write from 0.0.0 to 10/5/15: 01
    2010-11-27 23:16:58,555  INFO > Object  - New value on for object Test_Switch1 (type: 1.001)
    2010-11-27 23:16:58,555 DEBUG > Object  - Calling onChange on listener for Test_Switch1
    2010-11-27 23:16:58,556  INFO > SwitchingObject  - SwitchingObject (id=Test_Switch1): Compare value_m='1' to value='1'
    2010-11-27 23:16:58,556  INFO > Condition  - ObjectCondition (id='Test_Switch1') evaluated as '1'
    2010-11-27 23:16:58,556  INFO > Action  - Execute SetValueAction with value on
    2010-11-27 23:16:58,556  INFO > KnxConnection  - write(gad=21776, buf, len=2):
    Send request
    2010-11-27 23:16:58,556  INFO > Object  - New value on for object Test_Switch2 (type: 1.001)
    Write from 0.0.0 to 10/5/16: 01
    2010-11-27 23:16:58,557  INFO > Object  - New value on for object Test_Switch2 (type: 1.001)
    ..........
    Write from 0.0.0 to 10/5/15: 00
    2010-11-27 23:17:19,453  INFO > Object  - New value off for object Test_Switch1 (type: 1.001)
    2010-11-27 23:17:19,453 DEBUG > Object  - Calling onChange on listener for Test_Switch1
    2010-11-27 23:17:19,453  INFO > SwitchingObject  - SwitchingObject (id=Test_Switch1): Compare value_m='0' to value='1'
    2010-11-27 23:17:19,453  INFO > Condition  - ObjectCondition (id='Test_Switch1') evaluated as '0'
    2010-11-27 23:17:19,453  INFO > FixedTimeTask  - Rescheduled at 2010-11-27 23:17:40 (1290896260)
    ...
    2010-11-27 23:17:40,204  INFO > TimerManager  - TimerTask execution. 1290896260
    2010-11-27 23:17:40,204  INFO > SwitchingObject  - SwitchingObject (id=Test_Switch1): Compare value_m='0' to value='1'
    2010-11-27 23:17:40,205  INFO > Condition  - ObjectCondition (id='Test_Switch1') evaluated as '0'
    2010-11-27 23:17:40,206  INFO > FixedTimeTask  - Not rescheduled
    

    when I use a threshold >0:

          <condition type="time-counter" threshold="1" reset-delay="20" >
    

    everything works well: (especially for the "on-false" branch

    Write from 0.0.0 to 10/5/15: 01
    2010-11-27 23:07:09,475  INFO > Object  - New value on for object Test_Switch1 (type: 1.001)
    2010-11-27 23:07:09,475 DEBUG > Object  - Calling onChange on listener for Test_Switch1
    2010-11-27 23:07:09,475  INFO > SwitchingObject  - SwitchingObject (id=Test_Switch1): Compare value_m='1' to value='1'
    2010-11-27 23:07:09,475  INFO > Condition  - ObjectCondition (id='Test_Switch1') evaluated as '1'
    2010-11-27 23:07:09,475  INFO > FixedTimeTask  - Rescheduled at 2010-11-27 23:7:11 (1290895631)
    ..........
    2010-11-27 23:07:11,963  INFO > TimerManager  - TimerTask execution. 1290895631
    2010-11-27 23:07:11,964  INFO > SwitchingObject  - SwitchingObject (id=Test_Switch1): Compare value_m='1' to value='1'
    2010-11-27 23:07:11,964  INFO > Condition  - ObjectCondition (id='Test_Switch1') evaluated as '1'
    2010-11-27 23:07:11,964  INFO > Condition  - TimeCounterCondition: counter is now  '2'
    2010-11-27 23:07:11,964  INFO > FixedTimeTask  - Not rescheduled
    2010-11-27 23:07:11,964  INFO > Action  - Execute SetValueAction with value on
    2010-11-27 23:07:11,964  INFO > KnxConnection  - write(gad=21776, buf, len=2):
    Send request
    2010-11-27 23:07:11,966  INFO > Object  - New value on for object Test_Switch2 (type: 1.001)
    Write from 0.0.0 to 10/5/16: 01
    2010-11-27 23:07:11,967  INFO > Object  - New value on for object Test_Switch2 (type: 1.001)
    ....................
    Write from 0.0.0 to 10/5/15: 00
    2010-11-27 23:07:23,289  INFO > Object  - New value off for object Test_Switch1 (type: 1.001)
    2010-11-27 23:07:23,290 DEBUG > Object  - Calling onChange on listener for Test_Switch1
    2010-11-27 23:07:23,290  INFO > SwitchingObject  - SwitchingObject (id=Test_Switch1): Compare value_m='0' to value='1'
    2010-11-27 23:07:23,290  INFO > Condition  - ObjectCondition (id='Test_Switch1') evaluated as '0'
    2010-11-27 23:07:23,290  INFO > FixedTimeTask  - Rescheduled at 2010-11-27 23:7:44 (1290895664)
    ..........
    2010-11-27 23:07:44,023  INFO > TimerManager  - TimerTask execution. 1290895664
    2010-11-27 23:07:44,025  INFO > SwitchingObject  - SwitchingObject (id=Test_Switch1): Compare value_m='0' to value='1'
    2010-11-27 23:07:44,025  INFO > Condition  - ObjectCondition (id='Test_Switch1') evaluated as '0'
    2010-11-27 23:07:44,025  INFO > FixedTimeTask  - Not rescheduled
    2010-11-27 23:07:44,026  INFO > Action  - Execute SetValueAction with value off
    2010-11-27 23:07:44,026  INFO > KnxConnection  - write(gad=21776, buf, len=2):
    Send request
    2010-11-27 23:07:44,032  INFO > Object  - New value off for object Test_Switch2 (type: 1.001)
    Write from 0.0.0 to 10/5/16: 00
    2010-11-27 23:07:44,033  INFO > Object  - New value off for object Test_Switch2 (type: 1.001)
    

    I have not yet found the reason - probably you are faster :-)
    Thank you very much,
    best Regards, Jens

     
  • Ben

    Ben - 2010-11-28

    Hi Jens,

    I don't know this condition type (time-counter)…
    Where can I found english or french documentation about it?
    (I tried to read german posts… too difficult for me ;-))

    Thanks,
    Ben

     
  • JensH

    JensH - 2010-11-28

    Hi,
    Jean-Francois, if it is OK for you, I have added explanation on the "condition's syntax" page.
    https://sourceforge.net/apps/mediawiki/linknx/index.php?title=Condition%27s_Syntax

    I wrote BETA on it…
    BR, Jens

     
  • JensH

    JensH - 2010-11-29

    Hi Jean-François,
    I guess I found the reason for the problem  and uploaded a patch, which - IMHO - should work.
    I tested it here in a VM and it seems to do what is expected.
    Can you please check???

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