in my last question, i used a electric meter. Now i will convert this value always to a smaller value. This is not the problem. But i see that my defined condition in the rule only work once. I did not find the problem. Can anyone help me?
<objects><objectid="bigenergie"gad="1/6/216"type="29.xxx"init="persist">bigenergie</object><objectid="smallenergie"gad="1/6/218"type="EIS11"init="persist"forcewrite="true">smallenergie</object></objects><rules><ruleid="energy_convert"><conditiontype="object"id="bigenergie"trigger="true"/><actionlist><actiontype="script">
value = tonumber(obj("bigenergie"));
lowvalue = math.floor(value/1000);
set("smallenergie", lowvalue);
</action></actionlist></rule></rules>
In the logfile i can see only the first action of the rule:
1270471643 INFO KnxConnection : KnxConnection: Group socket opened. Waiting for messages.
1270471682 INFO Object : New value 3511860 for object bigenergie (type: 29.xxx)
1270471682 INFO Condition : ObjectCondition (id='bigenergie') evaluated as '1'
1270471682 INFO FilePersistentStorage : Writing '3511860' for object 'bigenergie'
1270471682 INFO Action : Execute LuaScriptAction
1270471682 INFO KnxConnection : write(gad=3802, buf, len=6):
1270471682 INFO Object : New value 3511 for object smallenergie (type: 12.xxx)
1270471682 INFO FilePersistentStorage : Writing '3511' for object 'smallenergie'
1270471753 INFO Object : New value 3512110 for object bigenergie (type: 29.xxx)
1270471753 INFO Condition : ObjectCondition (id='bigenergie') evaluated as '1'
1270471753 INFO FilePersistentStorage : Writing '3512110' for object 'bigenergie'
1270471756 INFO Object : New value 3512120 for object bigenergie (type: 29.xxx)
1270471756 INFO Condition : ObjectCondition (id='bigenergie') evaluated as '1'
1270471756 INFO FilePersistentStorage : Writing '3512120' for object 'bigenergie'
1270471801 INFO Object : New value 3512270 for object bigenergie (type: 29.xxx)
1270471801 INFO Condition : ObjectCondition (id='bigenergie') evaluated as '1'
1270471801 INFO FilePersistentStorage : Writing '3512270' for object 'bigenergie'
regards Ronny
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's because the action is executed only when the condition changes from false to true. Since the condition you use will always evaluate to "true", the action is only executed once. That's one of the reasons why I added "stateless" rules in 0.0.1.27. If you use that version or a more recent one, you can add the parameter type="if-true" in the actionlist tag (the default is type="on-true" ). With that parameter, the action will be executed every time the condition is evaluated to "true".
Jean-François
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
in my last question, i used a electric meter. Now i will convert this value always to a smaller value. This is not the problem. But i see that my defined condition in the rule only work once. I did not find the problem. Can anyone help me?
In the logfile i can see only the first action of the rule:
regards Ronny
Hi,
It's because the action is executed only when the condition changes from false to true. Since the condition you use will always evaluate to "true", the action is only executed once. That's one of the reasons why I added "stateless" rules in 0.0.1.27. If you use that version or a more recent one, you can add the parameter type="if-true" in the actionlist tag (the default is type="on-true" ). With that parameter, the action will be executed every time the condition is evaluated to "true".
Jean-François
Hi
the parameter was the missed thing. It works now!
Thanks!
hello hronny,
how it works:
<rules>
<rule id="energy_convert">
<condition type="object" id="bigenergie" trigger="true"/>
<actionlist type="if-true">
<action type="script">
value = tonumber(obj("bigenergie"));
lowvalue = math.floor(value/1000);
set("smallenergie", lowvalue);
</action>
</actionlist>
</rule>
</rules>
hans
Yes i know, thanks :-)
Ronny