Menu

timer rule issue

Help
Klaus
2012-05-13
2012-12-15
  • Klaus

    Klaus - 2012-05-13

    Hi everyone,

    I have configured a time rule to control my Espresso maker, but the timer rule does not trigger as expected. Any hint what is wrong with my setup would be highly appreciated:

    Object

    <object id="Espresso_Maschine" gad="1/1/2" type="1.001" flags="cwtu" init="request">Espresso_Maschine</object>
    

    Timer rule:

            <!-- Espressmaschine  -->
            <rule id="Espressomaschine">
                 <condition type="or">
                   <condition type="timer" trigger="true">
                     <at hour="6" min="30" wdays="12345" exception="no"/>
                     <until hour="8" min="30" />
                   </condition>
                   <condition type="timer" trigger="true">
                     <at hour="10" min="00" wdays="12345" exception="no"/>
                     <until hour="11" min="30" />
                   </condition>
                   <condition type="timer" trigger="true">
                     <at hour="14" min="30" wdays="12345" exception="no"/>
                     <until hour="16" min="30" />
                   </condition>
                   <condition type="timer" trigger="true">
                     <at hour="8" min="00" wdays="67" exception="no"/>
                     <until hour="10" min="30" />
                   </condition>
                   <condition type="timer" trigger="true">
                     <at hour="14" min="45" wdays="67" exception="no"/>
                     <until hour="16" min="30" />
                   </condition>
                   <condition type="timer" trigger="true">
                     <at hour="8" min="0" exception="yes"/>
                     <until hour="10" min="0" />
                   </condition>
                   <condition type="timer" trigger="true">
                     <at hour="14" min="45" exception="yes"/>
                     <until hour="16" min="30" />
                   </condition>
                 </condition>  <!-- or -->
                    <actionlist type="if-true">
                            <action type="set-value" id="Espresso_Maschine" value="on" />
                    </actionlist>
                    <actionlist type="if-false">
                            <action type="set-value" id="Espresso_Maschine" value="off" />
                    </actionlist>
            </rule>
    

    I would expect to timer rule to switch the machine off at 11:30 this morning, but this didn't happen:

    20120513 11:30:00,922 DEBUG PeriodicTask : PeriodicTask::onTimer Sun May 13 11:30:00 2012 (owner: Es
    pressomaschine)
    20120513 11:30:00,922  INFO Rule : Evaluate rule Espressomaschine
    20120513 11:30:00,922  INFO Condition : TimerCondition evaluated as '0'
    20120513 11:30:00,923 DEBUG Condition : 
    <TimerCondition::evaluate type="timer" trigger="true">
            <at hour="6" min="30" exception="no" wdays="12345" />
            <until hour="8" min="30" />
            <STATUS type="timer" trigger="true" next-exec="2012-05-14  6:30:00" value_m="false" owner="Espressomaschine" />
    </TimerCondition::evaluate>
    20120513 11:30:00,923  INFO Condition : TimerCondition evaluated as '0'
    20120513 11:30:00,924 DEBUG Condition : 
    <TimerCondition::evaluate type="timer" trigger="true">
            <at hour="10" min="0" exception="no" wdays="12345" />
            <until hour="11" min="30" />
            <STATUS type="timer" trigger="true" next-exec="2012-05-13 11:30:00" value_m="false" owner="Espressomaschine" />
    </TimerCondition::evaluate>
    20120513 11:30:00,924  INFO Condition : TimerCondition evaluated as '1'
    20120513 11:30:00,925 DEBUG Condition : 
    <TimerCondition::evaluate type="timer" trigger="true">
            <at hour="14" min="30" exception="no" wdays="12345" />
            <until hour="16" min="30" />
            <STATUS type="timer" trigger="true" next-exec="2012-05-13 16:30:00" value_m="true" owner="Espressomaschine" />
    </TimerCondition::evaluate>
    20120513 11:30:00,925  INFO Rule : Rule Espressomaschine evaluated as 1, prev value was 1
    20120513 11:30:00,926 DEBUG Rule : Action list 'true' executed for rule Espressomaschine
    20120513 11:30:00,928 DEBUG Rule : 
    <Rule::evaluate id="Espressomaschine">
            <condition type="or">
                    <condition type="timer" trigger="true">
                            <at hour="6" min="30" exception="no" wdays="12345" />
                            <until hour="8" min="30" />
                    </condition>
                    <condition type="timer" trigger="true">
                            <at hour="10" min="0" exception="no" wdays="12345" />
                            <until hour="11" min="30" />
                    </condition>
                    <condition type="timer" trigger="true">
                            <at hour="14" min="30" exception="no" wdays="12345" />
                            <until hour="16" min="30" />
                    </condition>
                    <condition type="timer" trigger="true">
                            <at hour="8" min="0" exception="no" wdays="67" />
                            <until hour="10" min="30" />
                    </condition>
                    <condition type="timer" trigger="true">
                            <at hour="14" min="45" exception="no" wdays="67" />
                            <until hour="16" min="30" />
                    </condition>
                    <condition type="timer" trigger="true">
                            <at hour="8" min="0" exception="yes" />
                            <until hour="10" min="0" />
                    </condition>
                    <condition type="timer" trigger="true">
                            <at hour="14" min="45" exception="yes" />
                            <until hour="16" min="30" />
                    </condition>
            </condition>
            <actionlist type="if-true">
                    <action type="set-value" id="Espresso_Maschine" value="on" />
            </actionlist>
            <actionlist type="if-false">
                    <action type="set-value" id="Espresso_Maschine" value="off" />
            </actionlist>
            <STATUS id="Espressomaschine" active="true" Stateless="ifTrue" state="true">
                    <condition type="or">
                            <condition type="timer" trigger="true" next-exec="2012-05-14  6:30:00" value_m="false" owner="Espressomaschine" />
                            <condition type="timer" trigger="true" next-exec="2012-05-13 11:30:00" value_m="false" owner="Espressomaschine" />
                            <condition type="timer" trigger="true" next-exec="2012-05-13 16:30:00" value_m="true" owner="Espressomaschine" />
                            <condition type="timer" trigger="true" next-exec="2012-05-19  8:00:00" value_m="false" owner="Espressomaschine" />
                            <condition type="timer" trigger="true" next-exec="2012-05-13 14:45:00" value_m="false" owner="Espressomaschine" />
                            <condition type="timer" trigger="true" next-exec="2012-07-21  8:00:00" value_m="false" owner="Espressomaschine" />
                            <condition type="timer" trigger="true" next-exec="2012-05-13 16:30:00" value_m="true" owner="Espressomaschine" />
                    </condition>
            </STATUS>
    </Rule::evaluate>
    20120513 11:30:00,929 DEBUG PeriodicTask : reschedule[Espressomaschine, 18:27:30.015]( Sun May 13 11:30:00 2012 ) nextExecTime_m = Sun May 13 11:30:00 2012 at_m=--::00:00 (wdays=31; exception=0) until_m=--::30:00 (wdays=0; exception=2), during_m = -1, after_m = -1, value_m = 0
    20120513 11:30:00,929  INFO PeriodicTask : Rescheduled at 2012-05-14 10:00:00 (1336982400)
    

    Any idea why at 11:30 (at the end of an 'until 11:30' statement) the rule does not switch the Espresso maker off?

    Have a great weekend and please let me know any thoughts to solve this,

    Klaus

     
  • Anthony

    Anthony - 2012-05-13

    Hi,

    try like this :

    <rule ...
    <actionlist type="on-true"> <action type="set-value" id="Espresso_Maschine" value="on" /> </actionlist>
    <actionlist type="on-false"> <action type="set-value" id="Espresso_Maschine" value="off" /> </actionlist>
    </rule>
    

    Regards,
    Anthony.

     
  • jef2000

    jef2000 - 2012-05-15

    Hi,

    I know this timer problem, it's due to the initial value of the timer condition. At startup, linknx will try to guess what's the actual value. For this, it will look in the future and determine which one of  the "at" or "until" part will occur first. If the "at" occurs first, it will initialize to "false", if the "until" occurs first, it will initialize to "true".

    In your case:
    <condition type="timer" trigger="true">
    <at hour="14" min="30" exception="no" wdays="12345" />
    <until hour="16" min="30" />
    </condition>
    It's sunday. The "at" will occur only on monday, while the "until" will occur sunday 4:30pm. That's why this condition will evaluate to "true" and cause the "or" condition to also stay "true" .
    That's what you see with the following log messages
    20120513 11:30:00,924 INFO Condition : TimerCondition evaluated as '1'
    20120513 11:30:00,925 INFO Rule : Rule Espressomaschine evaluated as 1, prev value was 1

    There is a parameter to set the condition initial value and avoid this "guess". You can add initval="false" to all the timers.
    Like this:
    <condition type="timer" trigger="true" initval="false">
      <at hour="14" min="30" exception="no" wdays="12345" />
      <until hour="16" min="30" />
    </condition>

    Of course with this initial value, if you start linknx between 14:30 and 16:30, nothing will happen and you'll have to wait the next day to see your espresso machine up.

    Regards,

    Jean-François

     
  • Rainer

    Rainer - 2012-12-15

    Hi,

    I have the same kind of problem. If I start linknx at a time where the timer should switch on, nothing happens.

    <object type="1.001" id="lampe_terr_droite" gad="0/0/2" init="request">Lampe devant    terasse droite</object>
    <rule id="Dummy_timer">
             <condition type="timer" trigger="true">
                <at hour="5" min="0" />
                <until hour="23" min="00" />
              </condition>
          <actionlist>
            <action type="set-value" id="lampe_terr_droite" value="on"/>
          </actionlist>
         </rule>
    

    If I start linknx at e.g. 8 A.M. it does not switch on.

    2012-12-15 07:43:58 [ INFO] Rule: Rule: Configuring Dummy_timer (active=1)
    2012-12-15 07:43:58 [ INFO] TimeSpec: 1899-0--1 5:0:0 (wdays=0; exception=2)
    2012-12-15 07:43:58 [ INFO] TimeSpec: 1899-0--1 9:0:0 (wdays=0; exception=2)
    2012-12-15 07:43:58 [ INFO] PeriodicTask: Rescheduled at 2012-12-15 9:0:0 (1355558400)
    2012-12-15 07:43:58 [ INFO] Rule: ActionList: Configuring 'on-true' action list
    2012-12-15 07:43:58 [ INFO] Action: SetValueAction: Configured for object lampe_terr_droite with value on
    2012-12-15 07:43:58 [ INFO] Rule: Rule: Configuration done

    I am trying around since quite a while.
    Any idea what's wrong.

    Rainer

     

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.