You make a character string comparison: value < ("20")
So if you temperature is 3, it compares string "3" and "20" character by character. And 3 > 2, so "3" > "20".
You should try with:
if tonumber(value) < 20 then
Regards,
Jean-François
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
the following LUA script works fine, just not in the range of 9 to 3,
why not? what am I doing wrong?
Hans
<object type="9.xxx" id="aussentemp" >aussentemp</object>
<object type="1.001" id="pumpe_gaertnerei" >pumpe_gaertnerei</object>
<rule id="gaerterei">
<condition type="or">
<condition type="object" id="aussentemp" trigger="true"/>
</condition>
<actionlist type="if-true">
<action type="script"><![CDATA[
value = obj("aussentemp")
if value < ("20") then
set("pumpe_gaertnerei", 1)
else
set("pumpe_gaertnerei", 0)
end
]]>
</action>
</actionlist>
</rule>
Hi,
You make a character string comparison: value < ("20")
So if you temperature is 3, it compares string "3" and "20" character by character. And 3 > 2, so "3" > "20".
You should try with:
if tonumber(value) < 20 then
Regards,
Jean-François
Hi,
worked, thank you very much, Merry Christmas.
Hans