Menu

Actionlist "on-false" is not executed

Help
2008-07-07
2012-12-14
  • Frank Eisold

    Frank Eisold - 2008-07-07

    Hallo jef2000,

    one rule in my linknx.xml contains an actionlist "on-false".
    When the object-id is changed that is triggered the rule will be evaluated but the actionlist "on-false" is not executed.
    Do you have an explanation?

    <rule id="Dunkelwerden">
    <condition type="object" id="Helligkeitsfuehler_Gartenhaus" value="true" trigger="true"/>
      <actionlist>
       <action type="set-value" id="J_Kind2_Pos_3_4" value="1"/>
       <action type="set-value" id="J_Schlafen_Pos_3_4" value="1"/>
       <action type="set-value" id="Beregnungsprogramm" value="1" delay="10"/>
      </actionlist>
    </rule>
    <rule id="Programm_Beregnung">
    <condition type="and">
      <condition type="object" id="Beregnungsprogramm" value="1" trigger="true"/>
      <condition type="object" id="Beregnung_Sperre" value="1"/>
    </condition>
    <actionlist>
      <action type="set-value" id="Strang_Rasen" value="1" />
    </actionlist>
    <actionlist type="on-false">
      <action type="set-value" id="Beregnungsprogramm" value="0" delay="5" />
    </actionlist>
    </rule>

    - "Helligkeitsfuehler_Gartenhaus" goes on true
    - "Beregnungsprogramm" is set to 1, but only if "Beregnung_Sperre" is 1 "Strang_Rasen" should be set true
    - if "Beregnung_Sperre" is 0 the rule will be evaluated but "Beregnungsprogramm" is not set back to 0

    Greetings from Berlin
    Frank

     
    • jef2000

      jef2000 - 2008-07-08

      If you want the on-false list to be executed when "Beregnung_Sperre" is changed to 0, you need to add also trigger="true" in the second condition.
      Change :
      <condition type="object" id="Beregnung_Sperre" value="1"/>
      into:
      <condition type="object" id="Beregnung_Sperre" value="1" trigger="true"/>

      But I'm not sure I completely understand your problem.
      If this is not answering your question, please provide the log messages of linknx (where it says which rules and conditions are evaluated)

      Regards,

      Jean-François

       
    • Frank Eisold

      Frank Eisold - 2008-07-10

      No, I don't want the on-false list to be executed when "Beregnung_Sperre" is changed to 0, but if it is 0 and "Beregnungsprogramm" is changed to 1, "Beregnungsprogramm" should be immediately set back to 0 (the value is shown in a visualisation).

      Here is the log:

      KnxConnection: Group socket opened. Waiting for messages.
      Write from 1.1.100 to 5/3/11: 00
      New value 0 for switching object Beregnung_Sperre
      Write from 1.1.100 to 5/3/10: 01
      New value 1 for switching object Beregnungsprogramm
      SwitchingObject (id=Beregnungsprogramm): Compare value_m='1' to value='1'
      ObjectCondition (id='Beregnungsprogramm') evaluated as '1'
      SwitchingObject (id=Beregnung_Sperre): Compare value_m='0' to value='1'
      ObjectCondition (id='Beregnung_Sperre') evaluated as '0'

      After that nothing happens - but now the on-false list should reset "Beregnungsprgramm" to 0.

      THX
      Frank

       
    • jef2000

      jef2000 - 2008-07-11

      Hi,

      The problem you have is because if the on-false action list will only be executed if the condition becomes false and not if the condition was already false and is still false when re-evaluated.

      The only workaround I see is to create another rule that reset "Beregnungsprogramm" if "Beregnung_sperre" is false:

      <rule id="Programm_Beregnung_reset">
      <condition type="and">
      <condition type="object" id="Beregnungsprogramm" value="1" trigger="true"/>
      <condition type="object" id="Beregnung_Sperre" value="0"/>
      </condition>
      <actionlist>
      <action type="set-value" id="Beregnungsprogramm" value="0" delay="5" />
      </actionlist>
      </rule>

      In future versions of linknx, I could create other action lists "if-true" and "if-false" in addition to "on-true" and "on-false" that would be called when the condition is true (or false), even if the condition was already true (or false) before.

      Regards,

      Jean-François

       
      • Frank Eisold

        Frank Eisold - 2008-07-11

        Thanks for your solution!

        Frank

         
      • JensH

        JensH - 2008-07-11

        Hi Jean-François,
        is this the general behaviour in the rules-engine? Are the actions not executed, if the objects sends values but the result is not changing?
        What is the reason, that it works this way?

        I have a similar problem and for me it does not work in the "true" -branch neither...

        I wanted to implement some additional function in a (dimmer) switch: if a second signal is set (Special1), switching of that switch should trigger some action.
        pressing the "off"-side should work, even if the switch is already switched off.
        Since the signal is otherwise the main light, there is no way to set it back to 1 after a certain time.

        Here is just a test I made after the more complex rule did not work as expected:

        <object id="OF_SRoom_Light_Switch" gad="5/1/1" type="EIS1" flags="cwtuf" OF_SRoom_Light_Switch</object>
        ..
        <rule id="SRoom_Test">
        <condition type="object" id="OF_SRoom_Light_Switch" value="off" trigger="true" />
        <actionlist>
          <action type="send-email" to="myname" subject="Home-Automation:SRoom_Test">test-message</action>
        </actionlist>
        </rule>

        That is, what is logged:

        ...
        Write from 1.1.90 to 5/1/1: 00
        New value 0 for switching object OF_SRoom_Light_Switch

        SwitchingObject (id=OF_SRoom_Light_Switch): Compare value_m='0' to value='0'

        ObjectCondition (id='OF_SRoom_Light_Switch') evaluated as '1'

        Execute SendEmailAction: to=...
        Content-Type: text/plain; charset=ISO-8859-1; format=flowed
        Content-Transfer-Encoding: 8bit

        ....later: second try to switch off:

        Write from 1.1.90 to 5/1/1: 00
        Write from 1.1.90 to 5/1/4: 00
        Write from 1.1.90 to 5/1/1: 00

        ...
        nothing happens

        there should be something like a "force"-flag also in the other direction (for receiving) Or, what if the rule is checked every time an object with a trigger sends a value?

        Thanks, Best Regards, jens

         
    • jef2000

      jef2000 - 2008-07-30

      Hi,

      Yes, it's the general behavior in the rule engine and in the object server to ignore the new value if it is equal to the actual value.
      If it was not the case, the fact that somedevices can send their actual value periodically would trigger the action-list again and again each time the device re-transmit its actual value.

      Perhaps I found a solution to your problem.
      If you define another object with the same group address 5/1/1 but with flags set to "cwu", that object would receive the on/off info from the pushbutton, but is not  allowed to transmit it's value to the bus. So if you setup a rule that does what you want to do when "off" button is pressed and also set this new object back to "on", it will work because the "on" will not be transmitted on the bus due to the transmit flag not set.

      In your example, it would look like this:

      <object id="OF_SRoom_Light_Switch" gad="5/1/1" type="EIS1" flags="cwtuf" OF_SRoom_Light_Switch</object>
      <object id="OF_SRoom_Light_OFF" gad="5/1/1" type="EIS1" flags="cwu">Object that becomes false when OFF is pressed </object>
      ..
      <rule id="SRoom_Test"> 
      <condition type="object" id="OF_SRoom_Light_OFF" value="off" trigger="true" />
      <actionlist> 
      <action type="set-value" id="OF_SRoom_Light_OFF" value="on" delay="2"/>
      <action type="send-email" to="myname" subject="Home-Automation:SRoom_Test">test-message</action>
      </actionlist> 
      </rule>

      The delay="2" parameters prevents that the e-mail is sent twice if I push the button twice in less than 2 seconds. You can remove it if you want that behavior.

      Regards,

      Jean-François

       
    • JensH

      JensH - 2008-08-01

      Hi Jean-François,

      thanks - again - for the time and efforts you spend in writing and maintaining your software.
      Thanks for the workaround - I'll try this at the weekend.

      I just have some comments regarding your feedback:

      >If it was not the case, the fact that somedevices can send their actual value
      >periodically would trigger the action-list again and again each time the device re-transmit its actual value.

      That is exactly what I want! And I think, that is also the behaviour of other intelligent "receiving" devices.

      I have for example a jalousie/blind actor, which can manage 4 Presets.
      first gad (EIS1) -> Value 0 --> Preset "A"
      first gad (EIS1) -> Value 1 --> Preset "B"
      2nd gad (EIS1) -> Value 0 --> Preset "C"
      2nd gad (EIS1) -> Value 1 --> Preset "D"

      Preset A is configured (in my case) with Blinds to be closed 30%...Preset B is 60% ...

      --> I.e. the first gad has not to be switched on, before can be switched off again. I just have to send a "0" to let the actor run Preset "A".
      If I would send a "1" inbetween, this would close the blinds to 60%...

      The same is valid for a Light-scenario-switch I have. Both values 0 and 1 are triggering different scenarios on a ABB / Busch Jaeger Triton Switch.

      So my proposal or request to you would be to also change this behaviour and pass these consequitive (same) values to the rule engine and let the "rules" decide what to do whithout the need of implementing workarounds. Just a reuqest... :-)

      2) What if not?
      I have furthermore a weather-station. I can configure it to send several values on the bus (temperature, wind, light, rain..). AND I can select, whether to send the values "on change" or "on change and periodically" in the latter case I can also specify in which interval.

      What kind of device are you thinking about, when you want to prevent it from re-transmitting their values??? This is often really wanted (and also often not done automatically.)
      And why not to check this in the rules? I have not spend much time thinking about this, but couldnt it be evalueted, whether the value has actually changed...?

      3) If you have specific needs (I'm currently not aware of), to prevent the re-evaluation / re-triggering of rules:
      How about the following solution: If the "f" - (force) flag is set in the configuration for the specific gad, then the message is always "forwarded" to the rule engine. If its not set, then the message is filtered in case the value has not changed. In the sending-direction it works this way. Why not applying this also for the receiving?

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