Temp Rule not working

Hi guys,
I´m quite new to Openhab and at the moment I try to build my first rules. But I can´t get my temperature to work.

My item:

Number Sonoff_Garten_Temp "Garten: Temperature [%.1f °C]" <temperature>
    { mqtt="<[broker:tele/sonoff/gartensteckdose/SENSOR:state:JSONPATH($.DS18B20.Temperature)]" }

And here´s my rule:

rule "Poolintervallschaltung Pumpe an" //Gartensteckdose für Pool nach Intervall an

when
        Time cron "0 0,15,30,45 9-23 * * ? *"
then
        if (Sonoff_Garten_Temp.state > 15) {
        [| Sonoff_Garten.sendCommand(ON)
                sendTelegram("bot1", "Pumpe Intervall an")
        ]
        }
end

And that´s the entry in the log:

22:20:08.859 [INFO ] [del.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'poolintervallschaltung.rules', using it anyway:
This expression is not allowed in this context, since it doesn't cause any side effects.
22:20:12.069 [INFO ] [del.core.internal.ModelRepositoryImpl] - Refreshing model 'poolintervallschaltung.rules'

Thank you for your help.

[ | ] denotes a lambda. A lambda is a function all wrapped up in an Object so you can pass it around to other functions that take a lambda as an argument and can run it. For example,

createTimer(now.plusMinutes(1), [ | logInfo("Test", "Hello World") ])

Creates a timer to go off in one minute and we pass in a chunk of code (i.e. the stuff between [ | ]) that the Timer will execute at that time.

A lambda makes absolutely no sense in this context. if isn’t a method that takes a lambda as an argument. And just dropping a lambda in the middle of nowhere doesn’t do anything. The [ | ] only defines the lambda. It doesn’t execute it. It’d be like the following:

if(Sonoff_Garten_Temp.state > 15) {
    new String("Hello world")
}

OK, I created a new String and set it to the text “Hello world”. But I don’t use it anywhere. I can’t reference it later because I didn’t save it to a variable. I just created an Object and then it just goes away. And this isn’t allowed as the body of an if statement in the Rules DSL.

To fix your problem, just get rid of the [ | ]

        if (Sonoff_Garten_Temp.state > 15) {
            Sonoff_Garten.sendCommand(ON)
            sendTelegram("bot1", "Pumpe Intervall an")
        }

Thank you for your quick answer, your explanations always helps beginners like me.
I didn´t even realize, that there is a [|], came with a copy and paste.
Now the validation issue is gone.

Thank you very much!!!