Menu

Year change error of Timercondition?

Help
chris_14
2011-01-01
2012-12-14
  • chris_14

    chris_14 - 2011-01-01

    For several month my rule for calculating the opening- and closing-time for the blinds works correct. But today (1.1.2011) it is faulty. The aim is: opening-time is 8:00 at weekdays and 9:00 at weekend. Closing time is 21:45 or at sunset + 1h, if this is later (in the summer).
    The code of this rule:

            <rule id="calc_daylight_present">
                <condition type="or">
                    <condition type="timer" trigger="true">
                        <at hour="08" min="00" exception="no" wdays="12345" />
                        <until hour="21" min="45"/>
                    </condition>
                    <condition type="timer" trigger="true">
                        <at hour="09" min="00" exception="no" wdays="67" />
                        <until hour="21" min="45"/>
                    </condition>
                    <condition type="timer" trigger="true">
                        <at hour="12" min="0"/>
                        <until type="sunset" offset="1h"/>
                    </condition>
                </condition>
                <actionlist type="if-true">
                    <action type="set-value" id="daylight_present" value="on" />
                </actionlist>
                <actionlist type="if-false">
                    <action type="set-value" id="daylight_present" value="off" /> 
                </actionlist> 
            </rule>
    

    Here is the log:

    2010-12-28 21:45:0 > off
    2010-12-29 8:0:0 > on
    2010-12-29 21:45:0 > off
    2010-12-30 8:0:0 > on
    2010-12-30 21:45:0 > off
    2010-12-31 8:0:0 > on
    2010-12-31 21:45:0 > off
    2011-1-1 12:0:0 > on
    2011-1-1 17:33:0 > off
    

    As one can see, both times are calculated wrong at 1.1.2011.
    Any idea?

     
  • jef2000

    jef2000 - 2011-01-01

    Hi,

    I guess January 1st is in the list of exception days.
    Since you use parameter  exception="no", the first 2 timers will not  trigger during exception days.
    Due to this, the only timer that operates is the 3rd one, starting at 12:00 and stopping at sunset +1h
    If you want the same behavior regardless if it's an exception day or not, you need to completely remove parameter exception="…" from the timer definitions.

    Happy new year 2011, and have a lot of fun with linknx,

    Jean-François

     
  • chris_14

    chris_14 - 2011-01-02

    Hi Jean-François,

    yes you are right, I schould have known this. Thank you and a happy new year from me too.
    Chris

     

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.