Menu

rule evaluation / action execution happens only when program exits

Help
geronimo
2013-04-14
2013-08-11
  • geronimo

    geronimo - 2013-04-14

    Hi all,

    As a "proof of concept" for my project, I tried to create a simple rule based on an OR-condition: if one of two different lights is switched ON, a third light should switch ON as well.
    (Below you find my full config file.)

    When trying this, I start with all lights switched OFF and then run linknx.
    Next, I switch one of the "source" lights ON. Linknx sees this change, but nothing else happens.
    When I exit linknx (ctrl-C), suddenly the condition is evaluated and the "target" light switches ON.
    You find a full transcript of console below -- blank lines and lines with ### were added manually.

    Any ideas on what could be wrong??

    thanks a lot!

    geronimo

    /var/lib/linknx/test.xml content

    <?xml version="1.0" ?>
    <config>
        <services>
            <knxconnection url="ip:192.168.0.56" />
        </services>
        <objects>
            <object type="1.001" id="source 1" gad="1/0/7">source 1</object>
            <object type="1.001" id="source 2" gad="1/0/2">source 2</object>
    
            <object type="1.001" id="target" gad="1/0/3">target</object>
        </objects>
        <rules>
            <rule id="test">
                <condition type="or">
                    <condition type="object" trigger="true" id="source 1" value="on"/>
                    <condition type="object" trigger="true" id="source 2" value="on"/>
                </condition>
                <actionlist type="if-true">
                    <action type="set-value" id="target" value="on"/>
                </actionlist>
                <actionlist type="if-false">
                    <action type="set-value" id="target" value="off"/>
                </actionlist>
            </rule>
        </rules>
    </config>
    

    console output

    $ # linknx -c/var/lib/linknx/test.xml
    1365969474 INFO Object : Configured object 'source 1': gad=1/0/7
    1365969474 INFO Object : Configured object 'source 2': gad=1/0/2
    1365969474 INFO Object : Configured object 'target': gad=1/0/3
    1365969474 INFO Rule : Rule: Configuring test (active=1)
    1365969474 INFO Condition : ObjectCondition: configured value_m='on'
    1365969474 INFO Condition : ObjectCondition: configured value_m='on'
    1365969474 INFO Rule : ActionList: Configuring 'if-true' action list
    1365969474 INFO Action : SetValueAction: Configured for object target with value on
    1365969474 INFO Rule : ActionList: Configuring 'if-false' action list
    1365969474 INFO Action : SetValueAction: Configured for object target with value off
    1365969474 INFO Rule : Rule: Configuration done
    1365969474 INFO main : Config file loaded: /var/lib/linknx/test.xml
    1365969474 INFO KnxConnection : KnxConnection: Group socket opened. Waiting for messages.
    
    ### push the button for 'source 2' ###
    1365969536 INFO Object : New value on for object source 2 (type: 1.001)
    1365969536 INFO Rule : Evaluate rule test
    1365969536 INFO KnxConnection : write(gad=1/0/7, buf, len=2)
    
    ### quit linknx (ctrl-c) ###
    ^C1365969597 INFO Services : Stopping services
    1365969597 INFO ObjectValue : SwitchingObjectValue: Compare value_m='0' to value='1'
    1365969597 INFO Condition : ObjectCondition (id='source 1') evaluated as '0'
    1365969597 INFO ObjectValue : SwitchingObjectValue: Compare value_m='1' to value='1'
    1365969597 INFO Condition : ObjectCondition (id='source 2') evaluated as '1'
    1365969597 INFO Rule : Rule test evaluated as 1, prev value was 0
    1365969597 INFO Action : Execute SetValueAction: set target with value on
    1365969597 INFO KnxConnection : write(gad=1/0/3, buf, len=2)
    1365969597 INFO Object : New value on for object target (type: 1.001)
    1365969597 INFO KnxConnection : Out of KnxConnection loop.
    
     
    • geronimo

      geronimo - 2013-04-16

      Self-reply:
      It seems to be related to initialization of group address statuses. Once both "source" lights have been switched on or off, things work as expected.

      I added init="request" to the object definitions (although that's the default value for the init attribute), but that did NOT help.

      Any ideas, anyone?

       
  • geronimo

    geronimo - 2013-08-11

    Another self-reply: downloading the latest sources from CVS (0.0.1.31) helped.

     

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.