Menu

10 questions needing clarification for Wiki

Damago
2011-03-13
2012-12-14
  • Damago

    Damago - 2011-03-13

    I am currently extending documentation wiki for LinKnx. I have some questions regarding this which I would like to clarify before placing any public information:

    1) Is ‘copy-value’ action official? Shall I include it in documentation Wiki? In my installation it did not work for some reason (if I added such action it did not sucsesfully read the config file. But I might have some older version.
    2) The same for ‘log’ parameter of object definition.
    3) Is the attribute active=xxx for rules official? Can I include it in the wiki?
    4) What is the “stopcondition” attribute for cycle-on-off? I found it in the code. Is it official?
    5) What is the behavior when within one rule’s actionlist a value is changed which should normally trigger another rule. Will the second rule be triggered after the first is finished evaluating? Or will they overlap?
    6) Is there an official way to include comments in XML file linknx.config?
    7) Do the rules get triggered by initial value reads during object initialization? I mean directly after starting the program
    8) When such condition occurs and what it means? I found it in logs:

    20110228 19:37:21,318  INFO Action : CycleOnOffAction stopped by condition
    

    9) What does the sentence in the Wiki mean (regarding ‘timer’ conditions):

    If neither until nor during is specified, the timer is instantaneous. In this case, if the timer reach the configured time, its value will change to true, the rule will be re-evaluated (if trigger is true) and the timer value will be set back to false.

    What does ‘the rule will be re-evaluated’ means? Does it mean that that the rule is evaluated twice? Does it mean that both actionlists, for ‘on-true’ and ‘on-false’ will be executed immediately one after another?

    10) Can anybody confirm, that rules, which have “at” and “until” are executing the first set of actions ‘’ when the “at” time occurs, and then are executing the second set of action ‘on-false’ when the condtition becomes false again? Then how will such rule work?

    <rule id="test_sunrise">
        <condition type="and">
            <condition type="timer"><at month="1" exception="no"/>
             <condition type="timer" trigger="true">
                 <at type="sunrise" offset="0"/>
                 <until type="sunset" offset="0"/>
             </condition>
        </condition>
        <actionlist>
             <action type="set-value" id="elewacja_ganek" value="off"/>
        </actionlist>
        <actionlist type="on-false">
             <action type="set-value" id="elewacja_ganek" value="on"/>
        </actionlist>
    </rule>
    

    I think it will be setting “elewacja_ganek” to “off” every day in January at sunrise, and turn it back to “on” at sunset every day in January, in any other month(February etc) it will only turn the “elewacja_ganek” to “on” at sunset. So in January both actionlists will be executed every day, and in any other month only the on-false?

    Is it true? Or will the on-false be triggered twice a day at sunrise and sunset any month except January?

    Can I use something like this below (note the placement of the ‘trigger’)?

       <condition type="timer">
           <at type="sunrise" offset="0" trigger="true"/>
           <until type="sunset" offset="0"/>
             </condition>
    

    Yours
    Damago1

     
  • JensH

    JensH - 2011-03-14

    Hi damago1

    1) its official; At least it is already listet in the general "configuration" page:
    https://sourceforge.net/apps/mediawiki/linknx/index.php?title=Configuration
    (maybe Jef added it very recently? don't know.)
    But I don't understand, what this has to do with reading a config file? O do you mean, that linknx has complained about the syntax?
    2) "log" is very old and very "official" :-). Maybe the problem came because of a missing

    <logging output="/path.../service.log" .../>
    

    statement in the <config> area of the xml…
    5) if the first rule changes some object in the actions-part, this will trigger the evaluation(!) of all rules, which contain the changed object in their conditions. AFAIK the first rules actions are completed first and then the next rule evaluation will start. Correct, Jean-Francois?
    6) by using:

    <!--  put whatever you want here  -->
    

    … and sorry for not being able to answer the following questions … never used such sophisticated time-clauses :-)
    …but I would just test it.
    For debugging purposes I always use e-mails.  - I.e. instead of switching an object, I let linknx send me a mail:

    <action type="send-email" to="auto-mate@somedomain.com" subject="Debug:Timerule1:On-True">Timerrule has triggered on!</action>
    

    best Regards, Jens

     
  • jef2000

    jef2000 - 2011-03-15

    Hi,

    Everything that is in the code is "official", but some features are "not yet documented".
    Stopcondition is a way to stop the cycle on-off action before it reach the maximum count.

    Example:
    <action type="cycle-on-off" id="entrance_light" on="2" off="2" count="15">
        <stopcondition type="object" id="alarm_enabled" value="off" trigger="true" />
    </action>
    This action will blink the entrance light for some time (to warn me and give a chance to disable alarm before triggering real alert). If I disable alarm while it's blinking, cycle-on-off stops instantly.

    A rule's condition is always completely evaluated before action list is executed. Each action is started in a different thread. This allows that an action with for example delay="10" does not delay execution of other actions in the list.  If an action modifies an object, this modification trigger immediately the evaluation of other rules depending on this object, but the execution of related actions will create new threads to be executed later on.

    Any valid XML comment is allowed but ignored. So if linknx save its configuration back on disk, the comments will be removed.

    7) no

    8) I think this is related to the stopcondition of question 4)

    9) The rule is evaluated twice. During the first evaluation, the timer condition value is true, but for the second evaluation (and also all the rest of time), the timer condition is always false.
    If you have such a timer triggering every minute, combined with an object condition by an AND logical condition. A change of the object value can trigger the evaluation of the rule, but it will always be false because timer condition is false. Only once every minute when timer is triggered, the timer condition will be true, so the AND condition will have the same truth value as the object condition.

    10) the condition <condition type="timer"><at month="1" exception="no"/>  has no closing </condition> tag.
    Even if it was <condition type="timer"><at month="1" exception="no"/> </condition>, the fact that it's instantaneous and that there is no trigger="true" means that it will always be evaluated as "false".
    If it's <condition type="timer" trigger="true"><at month="1" exception="no"/> </condition> , this condition will trigger evaluation of the rule at every minute of every hour of every day in january (except for exception days). And during all these evaluation, this condition will be true. The AND condition will then become true somewhere between sunrise and 1 minute after sunrise, and become false somewhere between sunset and 1 minute after sunset.

    To do something at sunrise and sunset every day of january, I would use:
    <condition type="timer" trigger="true"> <at type="sunrise" month="1" /> <until type="sunset" month="1" /></condition>

    The trigger="true" attribute is not allowed in "at" or "until" tags.

    With action lists of type "on-true" and "on-false", the list of actions are always executed alternatively, when the result of condition evaluation changes from false to true or from true to false.
    Since it cannot change twice from true to false without changing from false to true in between, the "on-false" action list can not be executed twice without excuting the other action list in between.

    Jean-François

     
  • Damago

    Damago - 2011-03-18

    Thank you very much for your answers. And J-F: BIG THANKS for version 1.28. It is a major breakthrough. Especially toggle-value, conditional actions and repetitions are making immediately LinKnx mature immediately. The world is open now. I have compacted the rules by a factor of 2!

    Some comments to the above (keeping original numbering):

    2) By 'log' I meant log as a part of an object definition.

    <object id="xxxxxx" gad="x/y/z"  log="true"/>
    

    The logging section mentioned by Jeff in his answer applies to the general log, not an individual object log. What is important as far as I know those logs are saved somewhere else than the main log file. And I don't see a way to define where such logs should be placed.

    3) if active is official for the rules, than my question is: can rules be enabled on the fly? i.e.

    <action type="set-value" id="some_rule_id" active="false"/>
    

    or it was ment to be used only for static enable / disable for the rules?

    8) J-F: just for your information: I did find the 'stopped by condition' in the logs even before I ever did use the <stopcondition> XML tag. So there must be some other built in condition stopping cycle-on-off actions which you dont need to define explicitely

    Yours

    Damago1

     
  • jef2000

    jef2000 - 2011-03-18

    Hi,

    For the logs, look at parameter "logpath" in persistance configuration. See wiki section below:
    https://sourceforge.net/apps/mediawiki/linknx/index.php?title=Configuration#Services_section

    The active parameter is only for static enable/disable. But in fact not so static, because you can change it dynamically using the XML interface on port 1028.
    If a rule with same id already exist, it will be updated. And in case of update existing condition or actionlists are preserved if missing from update request. The following request can be used to enable an existing (but disabled) rule:
    <write><config><rules><rule id="my_rule_xyz" active="true" /></rules></config></write>

    I never thought about creating an action to enable / disable another rule, but it's so easy to do that I'll probably add it soon. Thanks for the idea.

    Jean-François

     

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.