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?
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