// Regeln für Zustandsüberprüfung - Waschmaschine Ein / Aus
//
rule “Waschmaschine Zustand Ein”
when
item Strom_Waschmaschine changed
then
if (Zustand_Waschmaschine.state==OFF) {
if (Strom_Waschmaschine.state > 0.20) {
sendCommand(Zustand_Waschmaschine, ON)
}
}
end
rule “Waschmaschine Zustand Aus”
when
item Strom_Waschmaschine changed
then
if (Zustand_Waschmaschine.state==ON) {
if (Strom_Waschmaschine.state < 0.10) {
sendCommand(Zustand_Waschmaschine, OFF)
}
}
end
I also tried “received update” instead of changed - but with no luck.
Could be a lot of things. I can’t address any KNX issues that might be the cause. In your rules I recommend the following:
Add logging statements and watch your logs to see whether the rules are even triggering. If not then you know the problem is your Item configs.
Add some explicit casts to your Number Item’s states just to make sure the rules engine isn’t doing something stupid. For example: if((Strom_Waschmachine.state as DecimalType).doubleValue > 0.20) {
There is no need to have two rules here.
You can combine them:
rule "Waschmaschine Zustand"
when
item Strom_Waschmaschine changed
then
logInfo("Waschmaschine Zustand", "Strom_Waschmaschine changed: " + Strom_Waschmaschine.state.toString + " Zustand_Waschmaschine = " + Zustand_Waschmaschine.state.toString)
if(Zustand_Waschmaschine.state == OFF) {
if((Strom_Waschmaschine.state as DecimalType).doubleValue > 0.20) {
logInfo("Waschmaschine Zustand", "Setting Zustand_Waschmaschine to ON")
Zustand_Waschmaschine.sendCommand(ON)
}
}
else if(Zustand_Waschmaschine.state == ON) {
if((Strom_Waschmaschine.state as DecimalType).doubleValue < 0.10) {
logInfo("Waschmaschine Zustand", "Setting Zustand_Waschmaschine to OFF")
Zustand_Waschmaschine.sendCommand(OFF)
}
}
end
You should also be aware that as long as the switch (Zustand_Waschmaschine) hasn’t received any update or command since last reboot/startup the state could be “uninitialized” or “null” (if you haven’t configured persistence and restoreOnStartup) and therefore won’t match the conditions OFF or ON.