var Number Dusche_Temp_Soll
rule "Soll Temperatur Dusche"
when
Item OG_Bad_Dusche_Temp_Taster received command
then
if (Dusche_Temp_Soll == NULL) {
Dusche_Temp_Soll = 50
sendCommand(OG_Bad_Dusche_Temp_Display, Dusche_Temp_Soll)
}
if (OG_Bad_Dusche_Temp_Taster.state == ON) {
if (Dusche_Temp_Soll == 100) {
sendCommand(OG_Bad_Dusche_Temp_Display, "Max Temp")
}
else {
Dusche_Temp_Soll = (Dusche_Temp_Soll + 10)
sendCommand(OG_Bad_Dusche_Temp_Soll, Dusche_Temp_Soll)
sendCommand(OG_Bad_Dusche_Temp_Display, Dusche_Temp_Soll)
}
}
else (OG_Bad_Dusche_Temp_Taster.state == OFF) {
if (Dusche_Temp_Soll == 0) {
sendCommand(OG_Bad_Dusche_Temp_Display, "Min Temp")
}
else {
Dusche_Temp_Soll = (Dusche_Temp_Soll - 10)
sendCommand(OG_Bad_Dusche_Temp_Soll, Dusche_Temp_Soll)
sendCommand(OG_Bad_Dusche_Temp_Display, Dusche_Temp_Soll)
}
}
end
When I change in the last “else” case the calculation from a plus to a minus the hole rule is not working anymore and I get this ERROR in the logging:
Rule 'Soll Temperatur Dusche': The argument 'command' must not be null or empty.
Is there something wrong with the declaration of this values? I no idea anymore to solve this problem, maybe someone could help me!
probably it is the command at “when …”. Could you try sth. like “Channel “amazondashbutton:dashbutton:XX-XX-XX-XX-XX-XX:press” triggered”. How does your items/things look like?
No, I don’t think so. The crazy thing is, if I use in both calculations a plus, it runs. For example, I start with a value of 50, if one of the two buttons getting pressed it counts from 50 up to 100. 50, press button, 60, press button 70, etc…
If I change to minus in one of the two calulations, both calculations don’t running anymore. If I press the “increase” or “decrease” button dosen’t matter, the error message appears.
I always suggest not to use the action but the method
Another thing is: Really using a Number Item bound to a switch? I guess this is only a typo here…
The next to last else is missing an if:
else (OG_Bad_Dusche_Temp_Taster.state == OFF) {
I guess this may be the cause of the error.
I would try to use Int for Dusche_Temp_Soll instead of Number.
Another point to omit duplicate lines of code, you can use Dusche_Temp_Soll in another way…:
rule "Soll Temperatur Dusche"
when
Item OG_Bad_Dusche_Temp_Taster received command
then
var Int Dusche_Temp_Soll
if (OG_Bad_Dusche_Temp_Soll instanceof DecimalType)
Dusche_Temp_Soll = OG_Bad_Dusche_Temp_Soll.state as DecimalType
else
Dusche_Temp_Soll = 50
if (receivedCommand == ON)
Dusche_Temp_Soll = Dusche_Temp_Soll + 10 //don't care if overflow at this point
else // must be OFF...
Dusche_Temp_Soll = Dusche_Temp_Soll - 10 //don't care if underrun at this point
if (Dusche_Temp_Soll < 0) //underrun, so...
OG_Bad_Dusche_Temp_Display.sendCommand("Min Temp")
else if (Dusche_Temp_Soll > 100) //overflow, so...
OG_Bad_Dusche_Temp_Display.sendCommand("Max Temp")
else { //Range OK
OG_Bad_Dusche_Temp_Soll.sendCommand(Dusche_Temp_Soll)
OG_Bad_Dusche_Temp_Display.sendCommand(Dusche_Temp_Soll)
}
end