Hello,
does somebody knows a way to check if a number is bigger or smaler then -100 in a rule?
Thank you for Help!!!
Err… If you are talking about DSL Rules:
if(myNumber < -100)
do a
else
do b
Thats easy. Thanks!!
Or use blockly
which shows you how to do that in ECMAScript:
var myNum;
myNum = -101;
if (myNum < -100) {
console.log('do this if value is less than -100');
} else {
concole.log('do that');
}
Thank you for replay. Many roads lead to Rome.
I have solved it now:
rule “Zuviel_Strom”
when
Item Zaeler_Momentan changed
then
if (Zaeler_Momentan.state < 0 && Zuviel_Strom_Schalter.state == ON)
{}
else
{
if (Zaeler_Momentan.state < -100)
{ Zuviel_Strom_Schalter.sendCommand(ON)
}
else
{ Zuviel_Strom_Schalter.sendCommand(OFF)
}
}
end
more straight forward:
rule “zu viel Strom”
when
Item Zaeler_Momentan changed
then
if(!(Zaeler_Momentan.state < 0 && Zuviel_Strom_Schalter.state == ON))
if(Zaeler_Momentan.state < -100) {
Zuviel_Strom_Schalter.sendCommand(ON)
} else {
Zuviel_Strom_Schalter.sendCommand(OFF)
}
}
end
Is Zuviel_Strom_Schalter
a real hardware? if not (i.e. it’s a proxy item or an unbound item), better use .postUpdate() instead of .sendCommand()
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.