Rule event-based "analog" triggering

Hello, I am monitoring my gas fridge. So I have following telegram rule:

// == Send Fridge Gas alarm =========================

rule "Send telegram Fridge"

when
    Item vFridge changed

then
    var adc = vFridge.state
    if( adc < 350 ) 
        sendTelegram( "bot1", "Fridge OFF" )
end

My 2 questions are:

  1. Can I trigger like
Item vFridge changed to <350   (less tan 350)
  1. In my code above, adc can change staying below 350. Then each time it changes to any value below 350 I will get a telegram message?

thanks

(1) No, you cannot (as far as I know). (2) yes

But you can access the previous State (https://www.openhab.org/docs/configuration/rules-dsl.html#implicit-variables-inside-the-execution-block) of your item and if that was already <350 simply not send a telegram.
something like this (not tested):

rule "Send telegram Fridge"

when
    Item vFridge changed

then
    if( vFridge.state < 350  && previousState >= 350 )
        sendTelegram( "bot1", "Fridge OFF" )
end

There is one condition that may still lead to a large number of telegrams: if you fridge hovers/oscillates around 350 you will get a telegram every time it gets below 350. Not sure if this relevant, but I thought I’d mention it.

Tank you Markus. This solves my problem.

I did not know about implicit variables. They help a lot and save my food in the fridge from getting discomposed.