Is this rule in an .rules file or have you added via the main UI? If it’s in a .rules file, are there other rules also in the file and are you sure the file is being parsed and loaded when you save changes to it?
You say there are no errors in the logs, but do you see any indication the rule runs at all in the logs? Is the problem that the rules doesn’t run at all or that the rules runs but your ‘if’ and ‘else if’ conditions never trigger?
Also, this shouldn’t be the problem but just to help improve readability, you have some extra sets of ()'s and {}'s in your code:
You don’t need the ()'s around SaunaTemp1.state
You need only one set of {}'s around the code executed as a result of an if or else if block
Another question: Did you setup the item to Number:Temperature yourself or was this set by openHAB?
Number:Temperature would carry the Unit of Measurement (°C in this case). The state should be 36.3 °C, not 36.3. If a channel uses UoM, it’s best to use it.
The rule is not more complex.
var Boolean Notify = false
rule "SaunaTemp1"
when
Item SaunaTemp1 changed
then
if(!(SaunaTemp1.state instanceof Number))
return;
val nTemp = (SaunaTemp1.state as Number).floatValue
if(nTemp > 60 && !Notify) {
sendNotification("XXX@xxx.com", "Sauna Temperatur: " + String::format("%.1f °C",nTemp))
logInfo("Sauna", "Sauna over 60")
Notify = true
} else if(nTemp < 30 && Notify) {
sendNotification("XXX@xxx.com", "Sauna unter 30 °C: " + String::format("%.1f °C",nTemp))
Notify = false
}
end